diff options
author | Louis Pilfold <louis@lpil.uk> | 2020-06-30 13:21:20 +0100 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2020-06-30 13:21:20 +0100 |
commit | cd9f78320acf2942b5e63cd5370f14f3cce12662 (patch) | |
tree | a59329451db43d2fefb6a3707e1a0bc6696a3497 /test | |
parent | 1fb3e8e6c69fbd254fdf5ede2dd098746ce35498 (diff) | |
download | gleam_stdlib-cd9f78320acf2942b5e63cd5370f14f3cce12662.tar.gz gleam_stdlib-cd9f78320acf2942b5e63cd5370f14f3cce12662.zip |
bit_string.{to_string, is_utf8}
Diffstat (limited to 'test')
-rw-r--r-- | test/gleam/bit_string_test.gleam | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/gleam/bit_string_test.gleam b/test/gleam/bit_string_test.gleam index 997f379..ea577fd 100644 --- a/test/gleam/bit_string_test.gleam +++ b/test/gleam/bit_string_test.gleam @@ -69,3 +69,25 @@ pub fn u32_test() { bit_string.int_from_u32(bit_string.from_string("12345")), ) } + +pub fn to_string_test() { + <<>> + |> bit_string.to_string + |> should.equal(Ok("")) + + <<"":utf8>> + |> bit_string.to_string + |> should.equal(Ok("")) + + <<"Hello":utf8>> + |> bit_string.to_string + |> should.equal(Ok("Hello")) + + <<"ø":utf8>> + |> bit_string.to_string + |> should.equal(Ok("ø")) + + <<65535:16>> + |> bit_string.to_string + |> should.equal(Error(Nil)) +} |