 
   test "encode/1,2" do
     assert URI.encode("4_test.is-s~") == "4_test.is-s~"
+
     assert URI.encode("\r\n&<%>\" ゆ", &URI.char_unreserved?/1) ==
-           "%0D%0A%26%3C%25%3E%22%20%E3%82%86"
+             "%0D%0A%26%3C%25%3E%22%20%E3%82%86"
   end
 
   test "encode_www_form/1" do


    test "can parse IPv6 addresses" do
      addresses = [
        "::",                                      # undefined
        "::1",                                     # loopback
        "1080::8:800:200C:417A",                   # unicast
        "FF01::101",                               # multicast
        "2607:f3f0:2:0:216:3cff:fef0:174a",        # abbreviated
        "2607:f3F0:2:0:216:3cFf:Fef0:174A",        # mixed hex case
        "2051:0db8:2d5a:3521:8313:ffad:1242:8e2e", # complete
        "::00:192.168.10.184"                      # embedded IPv4
      ]

      Enum.each(addresses, fn(addr) ->
        simple_uri = URI.parse("http://[#{addr}]/")
        assert simple_uri.authority == "[#{addr}]"
        assert simple_uri.host == addr

      URI.merge("/relative", "")
    end

    assert URI.merge("http://google.com/foo", "http://example.com/baz")
           |> to_string == "http://example.com/baz"

    assert URI.merge("http://google.com/foo", "http://example.com/.././bar/../../baz")
           |> to_string == "http://example.com/baz"

    assert URI.merge("http://google.com/foo", "//example.com/baz")
           |> to_string == "http://example.com/baz"

    assert URI.merge("http://google.com/foo", "//example.com/.././bar/../../../baz")
           |> to_string == "http://example.com/baz"

    assert URI.merge("http://example.com", URI.parse("/foo"))
           |> to_string == "http://example.com/foo"

    assert URI.merge("http://example.com", URI.parse("/.././bar/../../../baz"))
           |> to_string == "http://example.com/baz"

    base = URI.parse("http://example.com/foo/bar")
    assert URI.merge(base, "") |> to_string == "http://example.com/foo/bar"
    assert URI.merge(base, "#fragment") |> to_string == "http://example.com/foo/bar#fragment"
    assert URI.merge(base, "?query") |> to_string == "http://example.com/foo/bar?query"
    assert URI.merge(base, %URI{path: ""}) |> to_string == "http://example.com/foo/bar"

    assert URI.merge(base, %URI{path: "", fragment: "fragment"})
           |> to_string == "http://example.com/foo/bar#fragment"

    base = URI.parse("http://example.com")
    assert URI.merge(base, "/foo") |> to_string == "http://example.com/foo"
