Sha256: c097d392893bd55c56e50d63d2ecc6c7325785a8ff513dd6f561dc0c7e1e37e2

Contents?: true

Size: 1.13 KB

Versions: 78

Compression:

Stored size: 1.13 KB

Contents

require File.expand_path('../../helper', __FILE__)
require 'citrus/grammars'

Citrus.require 'uri'

class UniformResourceIdentifierTest < Test::Unit::TestCase
  U = UniformResourceIdentifier

  def test_uri
    match = U.parse('http://www.example.com')
    assert(match)
  end

  def test_uri_with_query_string
    match = U.parse('http://www.example.com/?q=some+query')
    assert(match)
  end

  def test_authority
    match = U.parse('michael@', :root => :authority)
    assert(match)
  end

  def test_host
    match = U.parse('127.0.0.1', :root => :host)
    assert(match)

    match = U.parse('[12AD:34FC:A453:1922::]', :root => :host)
    assert(match)
  end

  def test_userinfo
    match = U.parse('michael', :root => :userinfo)
    assert(match)

    assert_raise(Citrus::ParseError) do
      U.parse('michael@', :root => :userinfo)
    end
  end

  def test_ipliteral
    match = U.parse('[12AD:34FC:A453:1922::]', :root => :'IP-literal')
    assert(match)
  end

  def test_ipvfuture
    match = U.parse('v1.123:456:789', :root => :IPvFuture)
    assert(match)

    match = U.parse('v5A.ABCD:1234', :root => :IPvFuture)
    assert(match)
  end
end

Version data entries

78 entries across 78 versions & 2 rubygems

Version Path
harbr-2.8.1 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/grammars/uri_test.rb
harbr-0.2.10 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/grammars/uri_test.rb
harbr-0.2.9 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/grammars/uri_test.rb
harbr-0.2.8 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/grammars/uri_test.rb
harbr-0.2.7 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/grammars/uri_test.rb
harbr-0.2.6 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/grammars/uri_test.rb
harbr-0.2.5 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/grammars/uri_test.rb
harbr-0.2.4 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/grammars/uri_test.rb
harbr-0.2.3 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/grammars/uri_test.rb
harbr-0.2.2 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/grammars/uri_test.rb
harbr-0.2.1 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/grammars/uri_test.rb
harbr-0.2.0 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/grammars/uri_test.rb
harbr-0.1.99 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/grammars/uri_test.rb
harbr-0.1.98 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/grammars/uri_test.rb
harbr-0.1.97 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/grammars/uri_test.rb
harbr-0.1.96 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/grammars/uri_test.rb
harbr-0.1.95 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/grammars/uri_test.rb
harbr-0.1.94 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/grammars/uri_test.rb
harbr-0.1.93 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/grammars/uri_test.rb
harbr-0.1.91 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/grammars/uri_test.rb