From 38aaa2aa6aba8dcaffea28192567c983a5a10853 Mon Sep 17 00:00:00 2001 From: PgBiel <9021226+PgBiel@users.noreply.github.com> Date: Mon, 15 Apr 2024 20:29:38 -0300 Subject: fix matching split returning list with Nil on JS --- test/gleam/regex_test.gleam | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test') 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+") -- cgit v1.2.3