diff options
| author | Eduardo Julian | 2018-08-23 01:24:29 -0400 | 
|---|---|---|
| committer | Eduardo Julian | 2018-08-23 01:24:29 -0400 | 
| commit | 7e312258b13c5fc9c80079fede0e41d479a8a327 (patch) | |
| tree | 6d3158b42c007a3b481e24d31806b7d03cd7d2b0 /stdlib/test | |
| parent | bc251026c21590da76085bc0bc9abeaa5ec242b6 (diff) | |
No more escaping of back-slash.
Diffstat (limited to 'stdlib/test')
| -rw-r--r-- | stdlib/test/test/lux/data/text/regex.lux | 102 | 
1 files changed, 51 insertions, 51 deletions
diff --git a/stdlib/test/test/lux/data/text/regex.lux b/stdlib/test/test/lux/data/text/regex.lux index 7c54d8385..3398f4685 100644 --- a/stdlib/test/test/lux/data/text/regex.lux +++ b/stdlib/test/test/lux/data/text/regex.lux @@ -53,8 +53,8 @@    (test "Can parse character literals."          (and (should-pass (&.regex "a") "a")               (should-fail (&.regex "a") ".") -             (should-pass (&.regex "\\.") ".") -             (should-fail (&.regex "\\.") "a")))) +             (should-pass (&.regex "\.") ".") +             (should-fail (&.regex "\.") "a"))))  (context: "Regular Expressions [System character classes]"    ($_ seq @@ -62,79 +62,79 @@              (should-pass (&.regex ".") "a"))        (test "Can parse digits." -            (and (should-pass (&.regex "\\d") "0") -                 (should-fail (&.regex "\\d") "m"))) +            (and (should-pass (&.regex "\d") "0") +                 (should-fail (&.regex "\d") "m")))        (test "Can parse non digits." -            (and (should-pass (&.regex "\\D") "m") -                 (should-fail (&.regex "\\D") "0"))) +            (and (should-pass (&.regex "\D") "m") +                 (should-fail (&.regex "\D") "0")))        (test "Can parse white-space." -            (and (should-pass (&.regex "\\s") " ") -                 (should-fail (&.regex "\\s") "m"))) +            (and (should-pass (&.regex "\s") " ") +                 (should-fail (&.regex "\s") "m")))        (test "Can parse non white-space." -            (and (should-pass (&.regex "\\S") "m") -                 (should-fail (&.regex "\\S") " "))) +            (and (should-pass (&.regex "\S") "m") +                 (should-fail (&.regex "\S") " ")))        (test "Can parse word characters." -            (and (should-pass (&.regex "\\w") "_") -                 (should-fail (&.regex "\\w") "^"))) +            (and (should-pass (&.regex "\w") "_") +                 (should-fail (&.regex "\w") "^")))        (test "Can parse non word characters." -            (and (should-pass (&.regex "\\W") ".") -                 (should-fail (&.regex "\\W") "a"))) +            (and (should-pass (&.regex "\W") ".") +                 (should-fail (&.regex "\W") "a")))        ))  (context: "Regular Expressions [Special system character classes : Part 1]"    ($_ seq        (test "Can parse using special character classes." -            (and (and (should-pass (&.regex "\\p{Lower}") "m") -                      (should-fail (&.regex "\\p{Lower}") "M")) +            (and (and (should-pass (&.regex "\p{Lower}") "m") +                      (should-fail (&.regex "\p{Lower}") "M")) -                 (and (should-pass (&.regex "\\p{Upper}") "M") -                      (should-fail (&.regex "\\p{Upper}") "m")) +                 (and (should-pass (&.regex "\p{Upper}") "M") +                      (should-fail (&.regex "\p{Upper}") "m")) -                 (and (should-pass (&.regex "\\p{Alpha}") "M") -                      (should-fail (&.regex "\\p{Alpha}") "0")) +                 (and (should-pass (&.regex "\p{Alpha}") "M") +                      (should-fail (&.regex "\p{Alpha}") "0")) -                 (and (should-pass (&.regex "\\p{Digit}") "1") -                      (should-fail (&.regex "\\p{Digit}") "n")) +                 (and (should-pass (&.regex "\p{Digit}") "1") +                      (should-fail (&.regex "\p{Digit}") "n")) -                 (and (should-pass (&.regex "\\p{Alnum}") "1") -                      (should-fail (&.regex "\\p{Alnum}") ".")) +                 (and (should-pass (&.regex "\p{Alnum}") "1") +                      (should-fail (&.regex "\p{Alnum}") ".")) -                 (and (should-pass (&.regex "\\p{Space}") " ") -                      (should-fail (&.regex "\\p{Space}") ".")) +                 (and (should-pass (&.regex "\p{Space}") " ") +                      (should-fail (&.regex "\p{Space}") "."))                   ))        ))  (context: "Regular Expressions [Special system character classes : Part 2]"    ($_ seq        (test "Can parse using special character classes." -            (and (and (should-pass (&.regex "\\p{HexDigit}") "a") -                      (should-fail (&.regex "\\p{HexDigit}") ".")) +            (and (and (should-pass (&.regex "\p{HexDigit}") "a") +                      (should-fail (&.regex "\p{HexDigit}") ".")) -                 (and (should-pass (&.regex "\\p{OctDigit}") "6") -                      (should-fail (&.regex "\\p{OctDigit}") ".")) +                 (and (should-pass (&.regex "\p{OctDigit}") "6") +                      (should-fail (&.regex "\p{OctDigit}") ".")) -                 (and (should-pass (&.regex "\\p{Blank}") text.tab) -                      (should-fail (&.regex "\\p{Blank}") ".")) +                 (and (should-pass (&.regex "\p{Blank}") text.tab) +                      (should-fail (&.regex "\p{Blank}") ".")) -                 (and (should-pass (&.regex "\\p{ASCII}") text.tab) -                      (should-fail (&.regex "\\p{ASCII}") (text.from-code (hex "1234")))) +                 (and (should-pass (&.regex "\p{ASCII}") text.tab) +                      (should-fail (&.regex "\p{ASCII}") (text.from-code (hex "1234")))) -                 (and (should-pass (&.regex "\\p{Contrl}") (text.from-code (hex "12"))) -                      (should-fail (&.regex "\\p{Contrl}") "a")) +                 (and (should-pass (&.regex "\p{Contrl}") (text.from-code (hex "12"))) +                      (should-fail (&.regex "\p{Contrl}") "a")) -                 (and (should-pass (&.regex "\\p{Punct}") "@") -                      (should-fail (&.regex "\\p{Punct}") "a")) +                 (and (should-pass (&.regex "\p{Punct}") "@") +                      (should-fail (&.regex "\p{Punct}") "a")) -                 (and (should-pass (&.regex "\\p{Graph}") "@") -                      (should-fail (&.regex "\\p{Graph}") " ")) +                 (and (should-pass (&.regex "\p{Graph}") "@") +                      (should-fail (&.regex "\p{Graph}") " ")) -                 (and (should-pass (&.regex "\\p{Print}") (text.from-code (hex "20"))) -                      (should-fail (&.regex "\\p{Print}") (text.from-code (hex "1234")))) +                 (and (should-pass (&.regex "\p{Print}") (text.from-code (hex "20"))) +                      (should-fail (&.regex "\p{Print}") (text.from-code (hex "1234"))))                   ))        )) @@ -191,9 +191,9 @@        ))  (context: "Regular Expressions [Reference]" -  (let [number (&.regex "\\d+")] +  (let [number (&.regex "\d+")]      (test "Can build complex regexs by combining simpler ones." -          (should-check ["809-345-6789" "809" "345" "6789"] (&.regex "(\\@<number>)-(\\@<number>)-(\\@<number>)") "809-345-6789")))) +          (should-check ["809-345-6789" "809" "345" "6789"] (&.regex "(\@<number>)-(\@<number>)-(\@<number>)") "809-345-6789"))))  (context: "Regular Expressions [Fuzzy Quantifiers]"    ($_ seq @@ -240,14 +240,14 @@        (test "Can extract groups of sub-matches specified in a pattern."              (and (should-check ["abc" "b"] (&.regex "a(.)c") "abc")                   (should-check ["abbbbbc" "bbbbb"] (&.regex "a(b+)c") "abbbbbc") -                 (should-check ["809-345-6789" "809" "345" "6789"] (&.regex "(\\d{3})-(\\d{3})-(\\d{4})") "809-345-6789") -                 (should-check ["809-345-6789" "809" "6789"] (&.regex "(\\d{3})-(?:\\d{3})-(\\d{4})") "809-345-6789") -                 (should-check ["809-809-6789" "809" "6789"] (&.regex "(\\d{3})-\\0-(\\d{4})") "809-809-6789") -                 (should-check ["809-809-6789" "809" "6789"] (&.regex "(?<code>\\d{3})-\\k<code>-(\\d{4})") "809-809-6789") -                 (should-check ["809-809-6789-6789" "809" "6789"] (&.regex "(?<code>\\d{3})-\\k<code>-(\\d{4})-\\0") "809-809-6789-6789"))) +                 (should-check ["809-345-6789" "809" "345" "6789"] (&.regex "(\d{3})-(\d{3})-(\d{4})") "809-345-6789") +                 (should-check ["809-345-6789" "809" "6789"] (&.regex "(\d{3})-(?:\d{3})-(\d{4})") "809-345-6789") +                 (should-check ["809-809-6789" "809" "6789"] (&.regex "(\d{3})-\0-(\d{4})") "809-809-6789") +                 (should-check ["809-809-6789" "809" "6789"] (&.regex "(?<code>\d{3})-\k<code>-(\d{4})") "809-809-6789") +                 (should-check ["809-809-6789-6789" "809" "6789"] (&.regex "(?<code>\d{3})-\k<code>-(\d{4})-\0") "809-809-6789-6789")))        (test "Can specify groups within groups." -            (should-check ["809-345-6789" "809" ["345-6789" "345" "6789"]] (&.regex "(\\d{3})-((\\d{3})-(\\d{4}))") "809-345-6789")) +            (should-check ["809-345-6789" "809" ["345-6789" "345" "6789"]] (&.regex "(\d{3})-((\d{3})-(\d{4}))") "809-345-6789"))        ))  (context: "Regular Expressions [Alternation]" @@ -263,7 +263,7 @@                   (should-fail (&.regex "a(.)(.)|b(.)(.)") "cde")                   (should-check ["809-345-6789" (0 ["809" "345-6789" "345" "6789"])] -                               (&.regex "(\\d{3})-((\\d{3})-(\\d{4}))|b(.)d") +                               (&.regex "(\d{3})-((\d{3})-(\d{4}))|b(.)d")                                 "809-345-6789")))        ))  | 
