Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reproduce the issue with absolutize_uri #516

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions test/uri_util_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ def test_ref_fragment_path
base = 'http://www.example.com/foo/#bar'

assert_equal Addressable::URI.parse('http://www.example.com/foo/#some-thing'), JSON::Util::URI.normalize_ref(uri, base)
JSON::Util::URI.clear_cache
assert_equal Addressable::URI.parse('http://www.example.com/foo/#'), JSON::Util::URI.absolutize_ref(uri, base)
end

Expand All @@ -137,6 +138,7 @@ def test_ref_file_path
base = 'http://www.example.com/foo/#bar'

assert_equal Addressable::URI.parse('http://www.example.com/some/thing#'), JSON::Util::URI.normalize_ref(uri, base)
JSON::Util::URI.clear_cache
assert_equal Addressable::URI.parse('http://www.example.com/some/thing#'), JSON::Util::URI.absolutize_ref(uri, base)
end

Expand All @@ -145,6 +147,7 @@ def test_ref_uri
base = 'http://www.example.com/foo/#bar'

assert_equal Addressable::URI.parse('http://foo-bar.com/#'), JSON::Util::URI.normalize_ref(uri, base)
JSON::Util::URI.clear_cache
assert_equal Addressable::URI.parse('http://foo-bar.com/#'), JSON::Util::URI.absolutize_ref(uri, base)
end

Expand All @@ -153,6 +156,7 @@ def test_ref_uri_with_path
base = 'http://www.example.com/foo/#bar'

assert_equal Addressable::URI.parse('http://foo-bar.com/some/thing#'), JSON::Util::URI.normalize_ref(uri, base)
JSON::Util::URI.clear_cache
assert_equal Addressable::URI.parse('http://foo-bar.com/some/thing#'), JSON::Util::URI.absolutize_ref(uri, base)
end

Expand All @@ -161,6 +165,7 @@ def test_ref_uri_with_fragment
base = 'http://www.example.com/hello/#world'

assert_equal Addressable::URI.parse('http://foo-bar.com/some/thing#foo'), JSON::Util::URI.normalize_ref(uri, base)
JSON::Util::URI.clear_cache
assert_equal Addressable::URI.parse('http://foo-bar.com/some/thing#'), JSON::Util::URI.absolutize_ref(uri, base)
end

Expand All @@ -169,6 +174,7 @@ def test_ref_uri_with_fragment_and_base_with_no_fragment
base = 'http://www.example.com/hello'

assert_equal Addressable::URI.parse('http://foo-bar.com/some/thing#foo'), JSON::Util::URI.normalize_ref(uri, base)
JSON::Util::URI.clear_cache
assert_equal Addressable::URI.parse('http://foo-bar.com/some/thing#'), JSON::Util::URI.absolutize_ref(uri, base)
end

Expand All @@ -177,6 +183,7 @@ def test_ref_relative_path
base = 'http://www.example.com/foo/#bar'

assert_equal Addressable::URI.parse('http://www.example.com/foo/hello/world#'), JSON::Util::URI.normalize_ref(uri, base)
JSON::Util::URI.clear_cache
assert_equal Addressable::URI.parse('http://www.example.com/foo/hello/world#'), JSON::Util::URI.absolutize_ref(uri, base)
end

Expand All @@ -185,6 +192,7 @@ def test_ref_addressable_uri_with_host
base = 'http://www.example.com/hello/#world'

assert_equal Addressable::URI.parse('http://www.example.com/foo-bar.com#'), JSON::Util::URI.normalize_ref(uri, base)
JSON::Util::URI.clear_cache
assert_equal Addressable::URI.parse('http://www.example.com/hello/#world'), JSON::Util::URI.absolutize_ref(uri, base)
end

Expand All @@ -193,6 +201,7 @@ def test_ref_addressable_uri_with_host_and_path
base = 'http://www.example.com/a/#b'

assert_equal Addressable::URI.parse('http://www.example.com/foo-bar.com/hello/world#'), JSON::Util::URI.normalize_ref(uri, base)
JSON::Util::URI.clear_cache
assert_equal Addressable::URI.parse('http://www.example.com/hello/world'), JSON::Util::URI.absolutize_ref(uri, base)
end

Expand All @@ -201,6 +210,7 @@ def test_ref_addressable_uri_with_scheme_host_and_path
base = 'http://www.example.com/a/#b'

assert_equal Addressable::URI.parse('https://foo-bar.com/hello/world#'), JSON::Util::URI.normalize_ref(uri, base)
JSON::Util::URI.clear_cache
assert_equal Addressable::URI.parse('https://foo-bar.com/hello/world'), JSON::Util::URI.absolutize_ref(uri, base)
end
end
Loading