aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/data/text/regex.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/test/lux/data/text/regex.lux')
-rw-r--r--stdlib/source/test/lux/data/text/regex.lux84
1 files changed, 42 insertions, 42 deletions
diff --git a/stdlib/source/test/lux/data/text/regex.lux b/stdlib/source/test/lux/data/text/regex.lux
index 661222696..7485c1d05 100644
--- a/stdlib/source/test/lux/data/text/regex.lux
+++ b/stdlib/source/test/lux/data/text/regex.lux
@@ -72,7 +72,7 @@
(def basics
Test
- (_.property "Can parse character literals."
+ (_.test "Can parse character literals."
(and (should_pass (/.regex "a") "a")
(should_fail (/.regex "a") ".")
(should_pass (/.regex "\.") ".")
@@ -81,30 +81,30 @@
(def system_character_classes
Test
(all _.and
- (_.property "Can parse anything."
+ (_.test "Can parse anything."
(should_pass (/.regex ".") "a"))
- (_.property "Can parse digits."
+ (_.test "Can parse digits."
(and (should_pass (/.regex "\d") "0")
(should_fail (/.regex "\d") "m")))
- (_.property "Can parse non digits."
+ (_.test "Can parse non digits."
(and (should_pass (/.regex "\D") "m")
(should_fail (/.regex "\D") "0")))
- (_.property "Can parse white-space."
+ (_.test "Can parse white-space."
(and (should_pass (/.regex "\s") " ")
(should_fail (/.regex "\s") "m")))
- (_.property "Can parse non white-space."
+ (_.test "Can parse non white-space."
(and (should_pass (/.regex "\S") "m")
(should_fail (/.regex "\S") " ")))
- (_.property "Can parse word characters."
+ (_.test "Can parse word characters."
(and (should_pass (/.regex "\w") "_")
(should_fail (/.regex "\w") "^")))
- (_.property "Can parse non word characters."
+ (_.test "Can parse non word characters."
(and (should_pass (/.regex "\W") ".")
(should_fail (/.regex "\W") "a")))
))
@@ -112,46 +112,46 @@
(def special_system_character_classes
Test
(all _.and
- (_.property "Lower-case."
+ (_.test "Lower-case."
(and (should_pass (/.regex "\p{Lower}") "m")
(should_fail (/.regex "\p{Lower}") "M")))
- (_.property "Upper-case."
+ (_.test "Upper-case."
(and (should_pass (/.regex "\p{Upper}") "M")
(should_fail (/.regex "\p{Upper}") "m")))
- (_.property "Alphabetic."
+ (_.test "Alphabetic."
(and (should_pass (/.regex "\p{Alpha}") "M")
(should_fail (/.regex "\p{Alpha}") "0")))
- (_.property "Numeric digits."
+ (_.test "Numeric digits."
(and (should_pass (/.regex "\p{Digit}") "1")
(should_fail (/.regex "\p{Digit}") "n")))
- (_.property "Alphanumeric."
+ (_.test "Alphanumeric."
(and (should_pass (/.regex "\p{Alnum}") "1")
(should_fail (/.regex "\p{Alnum}") ".")))
- (_.property "Whitespace."
+ (_.test "Whitespace."
(and (should_pass (/.regex "\p{Space}") " ")
(should_fail (/.regex "\p{Space}") ".")))
- (_.property "Hexadecimal."
+ (_.test "Hexadecimal."
(and (should_pass (/.regex "\p{HexDigit}") "a")
(should_fail (/.regex "\p{HexDigit}") ".")))
- (_.property "Octal."
+ (_.test "Octal."
(and (should_pass (/.regex "\p{OctDigit}") "6")
(should_fail (/.regex "\p{OctDigit}") ".")))
- (_.property "Blank."
+ (_.test "Blank."
(and (should_pass (/.regex "\p{Blank}") text.tab)
(should_fail (/.regex "\p{Blank}") ".")))
- (_.property "ASCII."
+ (_.test "ASCII."
(and (should_pass (/.regex "\p{ASCII}") text.tab)
(should_fail (/.regex "\p{ASCII}") (text.of_char (hex "1234")))))
- (_.property "Control characters."
+ (_.test "Control characters."
(and (should_pass (/.regex "\p{Contrl}") (text.of_char (hex "12")))
(should_fail (/.regex "\p{Contrl}") "a")))
- (_.property "Punctuation."
+ (_.test "Punctuation."
(and (should_pass (/.regex "\p{Punct}") "@")
(should_fail (/.regex "\p{Punct}") "a")))
- (_.property "Graph."
+ (_.test "Graph."
(and (should_pass (/.regex "\p{Graph}") "@")
(should_fail (/.regex "\p{Graph}") " ")))
- (_.property "Print."
+ (_.test "Print."
(and (should_pass (/.regex "\p{Print}") (text.of_char (hex "20")))
(should_fail (/.regex "\p{Print}") (text.of_char (hex "1234")))))
))
@@ -159,30 +159,30 @@
(def custom_character_classes
Test
(all _.and
- (_.property "Can parse using custom character classes."
+ (_.test "Can parse using custom character classes."
(and (should_pass (/.regex "[abc]") "a")
(should_fail (/.regex "[abc]") "m")))
- (_.property "Can parse using character ranges."
+ (_.test "Can parse using character ranges."
(and (should_pass (/.regex "[a-z]") "a")
(should_pass (/.regex "[a-z]") "m")
(should_pass (/.regex "[a-z]") "z")))
- (_.property "Can combine character ranges."
+ (_.test "Can combine character ranges."
(and (should_pass (/.regex "[a-zA-Z]") "a")
(should_pass (/.regex "[a-zA-Z]") "m")
(should_pass (/.regex "[a-zA-Z]") "z")
(should_pass (/.regex "[a-zA-Z]") "A")
(should_pass (/.regex "[a-zA-Z]") "M")
(should_pass (/.regex "[a-zA-Z]") "Z")))
- (_.property "Can negate custom character classes."
+ (_.test "Can negate custom character classes."
(and (should_fail (/.regex "[^abc]") "a")
(should_pass (/.regex "[^abc]") "m")))
- (_.property "Can negate character ranges.."
+ (_.test "Can negate character ranges.."
(and (should_fail (/.regex "[^a-z]") "a")
(should_pass (/.regex "[^a-z]") "0")))
- (_.property "Can parse negate combinations of character ranges."
+ (_.test "Can parse negate combinations of character ranges."
(and (should_fail (/.regex "[^a-zA-Z]") "a")
(should_pass (/.regex "[^a-zA-Z]") "0")))
- (_.property "Can make custom character classes more specific."
+ (_.test "Can make custom character classes more specific."
(and (let [RE (/.regex "[a-z&&[def]]")]
(and (should_fail RE "a")
(should_pass RE "d")))
@@ -198,7 +198,7 @@
(def references
Test
(let [number (/.regex "\d+")]
- (_.property "Can build complex regexs by combining simpler ones."
+ (_.test "Can build complex regexs by combining simpler ones."
(should_check ["809-345-6789" "809" "345" "6789"]
(/.regex "(\@<number>)-(\@<number>)-(\@<number>)")
"809-345-6789"))))
@@ -206,18 +206,18 @@
(def fuzzy_quantifiers
Test
(all _.and
- (_.property "Can sequentially combine patterns."
+ (_.test "Can sequentially combine patterns."
(text_should_pass "aa" (/.regex "aa") "aa"))
- (_.property "Can match patterns optionally."
+ (_.test "Can match patterns optionally."
(and (text_should_pass "a" (/.regex "a?") "a")
(text_should_pass "" (/.regex "a?") "")))
- (_.property "Can match a pattern 0 or more times."
+ (_.test "Can match a pattern 0 or more times."
(and (text_should_pass "aaa" (/.regex "a*") "aaa")
(text_should_pass "" (/.regex "a*") "")))
- (_.property "Can match a pattern 1 or more times."
+ (_.test "Can match a pattern 1 or more times."
(and (text_should_pass "aaa" (/.regex "a+") "aaa")
(text_should_pass "a" (/.regex "a+") "a")
(should_fail (/.regex "a+") "")))
@@ -226,21 +226,21 @@
(def crisp_quantifiers
Test
(all _.and
- (_.property "Can match a pattern N times."
+ (_.test "Can match a pattern N times."
(and (text_should_pass "aa" (/.regex "a{2}") "aa")
(text_should_pass "a" (/.regex "a{1}") "a")
(should_fail (/.regex "a{3}") "aa")))
- (_.property "Can match a pattern at-least N times."
+ (_.test "Can match a pattern at-least N times."
(and (text_should_pass "aa" (/.regex "a{1,}") "aa")
(text_should_pass "aa" (/.regex "a{2,}") "aa")
(should_fail (/.regex "a{3,}") "aa")))
- (_.property "Can match a pattern at-most N times."
+ (_.test "Can match a pattern at-most N times."
(and (text_should_pass "aa" (/.regex "a{,2}") "aa")
(text_should_pass "aa" (/.regex "a{,3}") "aa")))
- (_.property "Can match a pattern between N and M times."
+ (_.test "Can match a pattern between N and M times."
(and (text_should_pass "a" (/.regex "a{1,2}") "a")
(text_should_pass "aa" (/.regex "a{1,2}") "aa")))
))
@@ -248,7 +248,7 @@
(def groups
Test
(all _.and
- (_.property "Can extract groups of sub-matches specified in a pattern."
+ (_.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")
@@ -257,18 +257,18 @@
(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")))
- (_.property "Can specify groups within groups."
+ (_.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"))
))
(def alternation
Test
(all _.and
- (_.property "Can specify alternative patterns."
+ (_.test "Can specify alternative patterns."
(and (should_check ["a" {0 #0 []}] (/.regex "a|b") "a")
(should_check ["b" {0 #1 []}] (/.regex "a|b") "b")
(should_fail (/.regex "a|b") "c")))
- (_.property "Can have groups within alternations."
+ (_.test "Can have groups within alternations."
(and (should_check ["abc" {0 #0 ["b" "c"]}] (/.regex "a(.)(.)|b(.)(.)") "abc")
(should_check ["bcd" {0 #1 ["c" "d"]}] (/.regex "a(.)(.)|b(.)(.)") "bcd")
(should_fail (/.regex "a(.)(.)|b(.)(.)") "cde")