add failing test
This commit is contained in:
@@ -103,7 +103,7 @@ struct
|
|||||||
]
|
]
|
||||||
|
|
||||||
val endMarkerTests = describe "regex endMarker"
|
val endMarkerTests = describe "regex endMarker"
|
||||||
[test "returns an empty DFA when regexString contains endMarker" (fn _ =>
|
[ test "returns an empty DFA when regexString contains endMarker" (fn _ =>
|
||||||
let
|
let
|
||||||
(* arrange *)
|
(* arrange *)
|
||||||
(* the end marker is #"\^@" *)
|
(* the end marker is #"\^@" *)
|
||||||
@@ -117,7 +117,23 @@ struct
|
|||||||
val expectedLength = 0
|
val expectedLength = 0
|
||||||
in
|
in
|
||||||
Expect.isTrue (actualLength = expectedLength)
|
Expect.isTrue (actualLength = expectedLength)
|
||||||
end)]
|
end)
|
||||||
|
, test "matches a string when regex has question mark at the end" (fn _ =>
|
||||||
|
let
|
||||||
|
(* arrange *)
|
||||||
|
val sentence = "favo"
|
||||||
|
val regexString = "favou?"
|
||||||
|
val dfa = CsDfa.fromString "favorite"
|
||||||
|
|
||||||
|
(* act *)
|
||||||
|
val matches = CsDfa.matchString (dfa, sentence)
|
||||||
|
|
||||||
|
(* assert *)
|
||||||
|
val expectedMatches = [(0, 3)]
|
||||||
|
in
|
||||||
|
Expect.isTrue (matches = expectedMatches)
|
||||||
|
end)
|
||||||
|
]
|
||||||
|
|
||||||
fun recogniseEscapeSequence (regexString, inputString) =
|
fun recogniseEscapeSequence (regexString, inputString) =
|
||||||
let
|
let
|
||||||
|
|||||||
Reference in New Issue
Block a user