diff options
author | Louis Pilfold <louis@lpil.uk> | 2021-07-26 19:09:23 +0100 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2021-07-26 19:09:23 +0100 |
commit | 0cc6c9002b781af900bd5da2b7c974c6d3e2a9ab (patch) | |
tree | 83b0c30ec6d75f89003bfe18a6de325a11f2e9da /test | |
parent | 8d56e443e1df58a320629dfeae42270f9e7ef4da (diff) | |
download | gleam_stdlib-0cc6c9002b781af900bd5da2b7c974c6d3e2a9ab.tar.gz gleam_stdlib-0cc6c9002b781af900bd5da2b7c974c6d3e2a9ab.zip |
Complete string module conversion
Diffstat (limited to 'test')
-rw-r--r-- | test/gleam/string_test.gleam | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/test/gleam/string_test.gleam b/test/gleam/string_test.gleam index b6762ca..734d369 100644 --- a/test/gleam/string_test.gleam +++ b/test/gleam/string_test.gleam @@ -258,42 +258,40 @@ pub fn drop_right_test() { |> should.equal("gleam") } -if erlang { - pub fn pad_left_test() { - "121" - |> string.pad_left(to: 5, with: ".") - |> should.equal("..121") - - "121" - |> string.pad_left(to: 3, with: ".") - |> should.equal("121") - - "121" - |> string.pad_left(to: 2, with: ".") - |> should.equal("121") - - "121" - |> string.pad_left(to: 5, with: "XY") - |> should.equal("XYXY121") - } +pub fn pad_left_test() { + "121" + |> string.pad_left(to: 5, with: ".") + |> should.equal("..121") + + "121" + |> string.pad_left(to: 3, with: ".") + |> should.equal("121") + + "121" + |> string.pad_left(to: 2, with: ".") + |> should.equal("121") + + "121" + |> string.pad_left(to: 5, with: "XY") + |> should.equal("XYXY121") +} - pub fn pad_right_test() { - "121" - |> string.pad_right(to: 5, with: ".") - |> should.equal("121..") +pub fn pad_right_test() { + "121" + |> string.pad_right(to: 5, with: ".") + |> should.equal("121..") - "121" - |> string.pad_right(to: 3, with: ".") - |> should.equal("121") + "121" + |> string.pad_right(to: 3, with: ".") + |> should.equal("121") - "121" - |> string.pad_right(to: 2, with: ".") - |> should.equal("121") + "121" + |> string.pad_right(to: 2, with: ".") + |> should.equal("121") - "121" - |> string.pad_right(to: 5, with: "XY") - |> should.equal("121XYXY") - } + "121" + |> string.pad_right(to: 5, with: "XY") + |> should.equal("121XYXY") } pub fn pop_grapheme_test() { @@ -324,17 +322,19 @@ pub fn to_graphemes_test() { |> should.equal([]) } -if erlang { - pub fn utf_codepoint_test() { - string.utf_codepoint(1114444) - |> should.be_error +pub fn utf_codepoint_test() { + string.utf_codepoint(1114444) + |> should.be_error - string.utf_codepoint(65534) - |> should.be_error + string.utf_codepoint(65534) + |> should.be_error - string.utf_codepoint(55296) - |> should.be_error + string.utf_codepoint(55296) + |> should.be_error +} +if erlang { + pub fn bit_string_utf_codepoint_test() { assert Ok(snake) = string.utf_codepoint(128013) should.equal(<<snake:utf8_codepoint>>, <<"🐍":utf8>>) } |