diff options
author | Nick Wilson <nijolas.wilson@gmail.com> | 2024-06-14 17:37:03 +1000 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2024-07-17 13:07:16 +0100 |
commit | f31f5ef4239e4418eaa21bfc8c118b3cf40fceda (patch) | |
tree | a483ee0d8cb0ee64d032427e06782c790ec22b1e /test | |
parent | 2bd61406c2c215cfcbecab1a0ce20543a0eca267 (diff) | |
download | gleam_stdlib-f31f5ef4239e4418eaa21bfc8c118b3cf40fceda.tar.gz gleam_stdlib-f31f5ef4239e4418eaa21bfc8c118b3cf40fceda.zip |
Correct implementation of uri.origin and add tests for default ports
Diffstat (limited to 'test')
-rw-r--r-- | test/gleam/uri_test.gleam | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/test/gleam/uri_test.gleam b/test/gleam/uri_test.gleam index 506c246..2d2732a 100644 --- a/test/gleam/uri_test.gleam +++ b/test/gleam/uri_test.gleam @@ -409,19 +409,19 @@ pub fn parse_segments_test() { pub fn origin1_test() { let assert Ok(parsed) = uri.parse("http://example.test/path?weebl#bob") uri.origin(parsed) - |> should.equal(Ok("http://example.test/")) + |> should.equal(Ok("http://example.test")) } pub fn origin2_test() { let assert Ok(parsed) = uri.parse("http://example.test:8080") uri.origin(parsed) - |> should.equal(Ok("http://example.test:8080/")) + |> should.equal(Ok("http://example.test:8080")) } pub fn origin3_test() { let assert Ok(parsed) = uri.parse("https://example.test") uri.origin(parsed) - |> should.equal(Ok("https://example.test/")) + |> should.equal(Ok("https://example.test")) } pub fn origin4_test() { @@ -448,6 +448,18 @@ pub fn origin7_test() { |> should.equal(Error(Nil)) } +pub fn origin8_test() { + let assert Ok(parsed) = uri.parse("https://mozilla.org:443/") + uri.origin(parsed) + |> should.equal(Ok("https://mozilla.org")) +} + +pub fn origin9_test() { + let assert Ok(parsed) = uri.parse("http://localhost:80/") + uri.origin(parsed) + |> should.equal(Ok("http://localhost")) +} + pub fn merge1_test() { let assert Ok(a) = uri.parse("/relative") let assert Ok(b) = uri.parse("") |