Skip to content

Commit

Permalink
Add some more edge cases
Browse files Browse the repository at this point in the history
  • Loading branch information
radeusgd committed Feb 23, 2022
1 parent 6ed176a commit 9284a15
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/Tests/src/Data/Text_Spec.enso
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,16 @@ spec =
long_text . starts_with "EOL.SOL" (Regex_Matcher.new dot_matches_newline=True) . should_be_true
long_text . starts_with "EOL.SOL" (Regex_Matcher.new dot_matches_newline=False) . should_be_false

"aaazzz" . starts_with "a|b" Regex_Matcher.new . should_be_true
"bbbzzz" . starts_with "a|b" Regex_Matcher.new . should_be_true
"zzzaaa" . starts_with "a|b" Regex_Matcher.new . should_be_false
"zzzbbb" . starts_with "a|b" Regex_Matcher.new . should_be_false
"aaazzz" . starts_with "(a|b){2}" Regex_Matcher.new . should_be_true
"bbbzzz" . starts_with "(a|b){2}" Regex_Matcher.new . should_be_true
"zzzaaa" . starts_with "(a|b){2}" Regex_Matcher.new . should_be_false
"foobar" . starts_with "" Regex_Matcher.new . should_be_true
"" . starts_with "" Regex_Matcher.new . should_be_true

Test.specify "should check for ends_with using Unicode normalization" <|
"Hello".ends_with "lo" . should_be_true
"Hello".ends_with "LO" . should_be_false
Expand Down Expand Up @@ -581,6 +591,16 @@ spec =
long_text . ends_with "EOL.SOL" (Regex_Matcher.new dot_matches_newline=True) . should_be_true
long_text . ends_with "EOL.SOL" (Regex_Matcher.new dot_matches_newline=False) . should_be_false

"zzzaaa" . ends_with "a|b" Regex_Matcher.new . should_be_true
"zzzbbb" . ends_with "a|b" Regex_Matcher.new . should_be_true
"aaazzz" . ends_with "a|b" Regex_Matcher.new . should_be_false
"bbbzzz" . ends_with "a|b" Regex_Matcher.new . should_be_false
"zzzaaa" . ends_with "(a|b){2}" Regex_Matcher.new . should_be_true
"zzzbbb" . ends_with "(a|b){2}" Regex_Matcher.new . should_be_true
"aaazzz" . ends_with "(a|b){2}" Regex_Matcher.new . should_be_false
"foobar" . ends_with "" Regex_Matcher.new . should_be_true
"" . ends_with "" Regex_Matcher.new . should_be_true

Test.group "Regex matching" <|
Test.specify "should be possible on text" <|
match = "My Text: Goes Here".match "^My Text: (.+)$" mode=Regex_Mode.First
Expand Down

0 comments on commit 9284a15

Please sign in to comment.