From 9676dd757d89fc5b48778bca1765209e8b014527 Mon Sep 17 00:00:00 2001 From: Dilson Rosa Higa Date: Sun, 30 Jun 2024 14:08:37 -0400 Subject: [PATCH 1/3] Commenting inline expects to avoid the bug described in https://github.com/roc-lang/roc/issues/5680 --- package/CodePoint.roc | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/package/CodePoint.roc b/package/CodePoint.roc index 1b71687..eed7427 100644 --- a/package/CodePoint.roc +++ b/package/CodePoint.roc @@ -121,8 +121,7 @@ appendUtf8 = \bytes, codePoint -> else ## This was an invalid Unicode scalar value, even though it had the Roc type Scalar. ## This should never happen! - expect - u32 < 0x110000 + # expect u32 < 0x110000 byte1 = u32 @@ -179,9 +178,7 @@ countUtf8Bytes = \codePoint -> 3 else # If this expectation fails, it was an invalid Scalar and shouldn't have been allowed! - expect - u32 < 0x110000 - + # expect u32 < 0x110000 4 ## parse a 2-byte code point From 9e48ba006a5766b77f8a5bcff264c7876678624b Mon Sep 17 00:00:00 2001 From: Dilson Rosa Higa Date: Sun, 30 Jun 2024 14:18:07 -0400 Subject: [PATCH 2/3] Adding an example --- .gitignore | 1 + examples/splitGraphemes.roc | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 examples/splitGraphemes.roc diff --git a/.gitignore b/.gitignore index c60a4ab..c756e7e 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ # Ignore the example binaries examples/simple examples/visualWidth +example/splitGraphemes # Ignore the generated files generated-docs diff --git a/examples/splitGraphemes.roc b/examples/splitGraphemes.roc new file mode 100644 index 0000000..e1ed508 --- /dev/null +++ b/examples/splitGraphemes.roc @@ -0,0 +1,20 @@ +app [main] { + pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.11.0/SY4WWMhWQ9NvQgvIthcv15AUeA7rAIJHAHgiaSHGhdY.tar.br", + unicode: "../package/main.roc", # use release URL (ends in tar.br) for local example, see github.com/roc/unicode/releases +} + +import pf.Stdout +import pf.Task +import unicode.Grapheme + +string = "πŸ‡¦πŸ‡ΊπŸ¦˜πŸͺƒ" + +expect Grapheme.split string == Ok ["πŸ‡¦πŸ‡Ί", "🦘", "πŸͺƒ"] + +main = + string + |> Grapheme.split + |> Inspect.toStr + |> \splitted -> + Stdout.line! "\n\nThe string \"$(string)\" has following graphemes:" + Stdout.line! splitted From 8ff65eac9d2ffb4b6631e69c5dbd44f78a1a27eb Mon Sep 17 00:00:00 2001 From: Dilson Rosa Higa Date: Mon, 1 Jul 2024 09:13:18 -0400 Subject: [PATCH 3/3] Updating dependency that was failing the CI --- package/GraphemeTestGen.roc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/GraphemeTestGen.roc b/package/GraphemeTestGen.roc index e4299d3..415eb9a 100644 --- a/package/GraphemeTestGen.roc +++ b/package/GraphemeTestGen.roc @@ -4,7 +4,7 @@ ## parse it and then generate the individual tests. app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.11.0/SY4WWMhWQ9NvQgvIthcv15AUeA7rAIJHAHgiaSHGhdY.tar.br", - parser: "https://github.com/lukewilliamboswell/roc-parser/releases/download/0.5.2/9VrPjwfQQ1QeSL3CfmWr2Pr9DESdDIXy97pwpuq84Ck.tar.br", + parser: "https://github.com/lukewilliamboswell/roc-parser/releases/download/0.7.1/MvLlME9RxOBjl0QCxyn3LIaoG9pSlaNxCa-t3BfbPNc.tar.br", } import pf.Task exposing [Task]