From 9dc8bc4b3e9b58396ceae3e2bb466c1eb4679f86 Mon Sep 17 00:00:00 2001 From: inoas Date: Fri, 9 Dec 2022 09:10:36 +0100 Subject: replace string.to_ints with string.utf_codepoint_to_int --- test/gleam/string_test.gleam | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) (limited to 'test') diff --git a/test/gleam/string_test.gleam b/test/gleam/string_test.gleam index d8c62d6..07bbfb9 100644 --- a/test/gleam/string_test.gleam +++ b/test/gleam/string_test.gleam @@ -487,31 +487,13 @@ pub fn bit_string_utf_codepoint_test() { should.equal(<>, <<"🐍":utf8>>) } -pub fn to_ints_test() { - "" - |> string.to_ints - |> should.equal([]) - - "abc" - |> string.to_ints - |> should.equal([97, 98, 99]) - - "🐍" - |> string.to_ints - |> should.equal([128013]) - +pub fn utf_codepoint_to_int_test() { { - assert Ok(cp) = string.utf_codepoint(128013) - [cp] + assert Ok(ordinal_value) = string.utf_codepoint(128_013) + ordinal_value } - |> string.from_utf_codepoints - |> string.to_ints - |> should.equal([128013]) - - string.to_utf_codepoints("🐍") - |> string.from_utf_codepoints - |> string.to_ints - "🐍" + |> string.utf_codepoint_to_int + |> should.equal(128_013) } pub fn to_option_test() { -- cgit v1.2.3