diff options
author | PgBiel <9021226+PgBiel@users.noreply.github.com> | 2024-04-15 20:29:38 -0300 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2024-04-19 13:17:47 +0100 |
commit | 38aaa2aa6aba8dcaffea28192567c983a5a10853 (patch) | |
tree | 9533a27443fdf5be02264b5d8b8bc305b98ccba7 /test | |
parent | 3fde1cdf30523354b4dacbc76a856e922dcad2f4 (diff) | |
download | gleam_stdlib-38aaa2aa6aba8dcaffea28192567c983a5a10853.tar.gz gleam_stdlib-38aaa2aa6aba8dcaffea28192567c983a5a10853.zip |
fix matching split returning list with Nil on JS
Diffstat (limited to 'test')
-rw-r--r-- | test/gleam/regex_test.gleam | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/gleam/regex_test.gleam b/test/gleam/regex_test.gleam index 8c13827..4174125 100644 --- a/test/gleam/regex_test.gleam +++ b/test/gleam/regex_test.gleam @@ -73,6 +73,15 @@ pub fn split_test() { |> should.equal(["foo", "32", "4", "9", "0"]) } +pub fn matching_split_test() { + let assert Ok(re) = regex.from_string("([+-])( *)(d)*") + + regex.split(re, "abc+ def+ghi+ abc") + |> should.equal([ + "abc", "+", " ", "d", "ef", "+", "", "", "ghi", "+", " ", "", "abc", + ]) +} + pub fn scan_test() { let assert Ok(re) = regex.from_string("Gl\\w+") |