Skip to content

Commit

Permalink
Added test for unicode regex in visit
Browse files Browse the repository at this point in the history
  • Loading branch information
DavyLandman committed Jul 18, 2024
1 parent 17aa397 commit a23db0e
Showing 1 changed file with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,48 @@ test bool StringVisit74() = deescape("\\\<") == "\<";
test bool StringVisit75() = deescape("\\\>") == "\>";
test bool StringVisit76() = deescape("\\n") == "n";
// test some unicode features of string visiting
test bool StringUnicodeVisitEmoji1() {
return visit ("Hello 🌈World") {
case /🌈/ => ""
} == "Hello World";
}
test bool StringUnicodeVisitEmoji2() {
return visit ("Hello World") {
case / / => "🌈"
} == "Hello🌈World";
}
test bool StringUnicodeVisitEmoji3() {
return visit ("Hello👍🏽World") {
case /👍🏽/ => "🌈"
} == "Hello🌈World";
}
test bool StringUnicodeVisitEmoji4() {
return visit ("Hello🫂🌈World") {
case /🫂/ => "🌈"
} == "Hello🌈🌈World";
}
test bool StringUnicodeVisitEmoji5() {
return visit ("Hello🫂🫂🫂World") {
case /[🫂]+/ => "🌈"
} == "Hello🌈World";
}
test bool StringUnicodeVisitEmoji6() {
return visit ("Hello🫂🫂🫂World") {
case /🫂[🫂]*/ => "🌈"
} == "Hello🌈World";
}
test bool StringUnicodeVisitEmoji7() {
return visit ("Hello🌈World") {
case /World/ => "🌍"
} == "Hello🌈🌍";
}
// Keywords and visit
data RECT = rect(int w, int h, str color = "white");
Expand Down

0 comments on commit a23db0e

Please sign in to comment.