Skip to content

Commit

Permalink
Split URI::Parser examples with RFC2396 and RFC3986
Browse files Browse the repository at this point in the history
Prepare for ruby/uri#107
  • Loading branch information
hsbt authored and headius committed Nov 5, 2024
1 parent c2ec9df commit 6f6918a
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions library/uri/shared/parse.rb
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,15 @@
file.should be_kind_of(URI::Generic)
end

it "raises errors on malformed URIs" do
-> { @object.parse('http://a_b:80/') }.should raise_error(URI::InvalidURIError)
-> { @object.parse('http://a_b/') }.should raise_error(URI::InvalidURIError)
if URI::DEFAULT_PARSER == URI::RFC2396_Parser
it "raises errors on malformed URIs" do
-> { @object.parse('http://a_b:80/') }.should raise_error(URI::InvalidURIError)
-> { @object.parse('http://a_b/') }.should raise_error(URI::InvalidURIError)
end
elsif URI::DEFAULT_PARSER == URI::RFC3986_Parser
it "does not raise errors on URIs contained underscore" do
-> { @object.parse('http://a_b:80/') }.should_not raise_error(URI::InvalidURIError)
-> { @object.parse('http://a_b/') }.should_not raise_error(URI::InvalidURIError)
end
end
end

0 comments on commit 6f6918a

Please sign in to comment.