Skip to content

Commit

Permalink
Add test for IDNA 2003 vs IDNA 2008 difference
Browse files Browse the repository at this point in the history
More information at https://curl.haxx.se/docs/adv_20161102K.html.

Related to #101.
  • Loading branch information
dentarg committed Nov 3, 2016
1 parent 057f675 commit 77631f7
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions spec/lib/twingly/url_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,16 @@ def valid_urls
end
end

context "IDNA 2003 vs IDNA 2008" do
describe "if you normalize a URL with the domain \"straße.de\"" do
let(:test_url) { "http://straße.de" }

it "the domain of the normalized URL should be \"xn--strae-oqa.de\"" do
expect(subject.normalized.domain).to eq("xn--strae-oqa.de")
end
end
end

context "when given badly encoded input" do
let(:badly_encoded_url) { "http://abc.se/öあ\x81b\xE3" }
let(:expected) { "http://abc.se/öあ\uFFFDb\uFFFD" }
Expand Down

0 comments on commit 77631f7

Please sign in to comment.