From 5d7b9e35ba5f9f457bfd49098635ad059e769688 Mon Sep 17 00:00:00 2001 From: Humza Shahid Date: Thu, 9 Oct 2025 05:44:35 +0100 Subject: [PATCH] add tests that the regex returns an empty DFA when the regexString contains the endMarker --- test/regex-tests.sml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/test/regex-tests.sml b/test/regex-tests.sml index 3319b74..35cbb78 100644 --- a/test/regex-tests.sml +++ b/test/regex-tests.sml @@ -102,5 +102,22 @@ struct end) ] - val tests = [caseInsensitiveTests, caseSensitiveTests] + val endMarkerTests = describe "regex endMarker" + [test "returns an empty DFA when regexString contains endMarker" (fn _ => + let + (* arrange *) + (* the end marker is #"\^@" *) + val regexString = "hello \^@ world" + + (* act *) + val dfa = CsDfa.fromString regexString + + (* assert *) + val actualLength = Vector.length dfa + val expectedLength = 0 + in + Expect.isTrue (actualLength = expectedLength) + end)] + + val tests = [caseInsensitiveTests, caseSensitiveTests, endMarkerTests] end