Commit bfdb842 1 parent 0ef077b commit bfdb842 Copy full SHA for bfdb842
File tree 2 files changed +15
-2
lines changed
main/scala/wolfendale/scalacheck/regexp
test/scala/wolfendale/scalacheck/regexp
2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -98,8 +98,9 @@ object GenParser extends RegexParsers with PackratParsers {
98
98
val wordBoundary : Parser [CharacterClass .Term ] = " \\ b" ^^^ CharacterClass .WordBoundary
99
99
100
100
lazy val char : Parser [CharacterClass .Term ] = {
101
- val meta = " \\ " | " ]"
102
- ((" \\ " ~> meta) | " [^\\ ]\\\\ ]" .r) ^^ CharacterClass .Literal
101
+ val normalChars = " [^\\ ]\\\\ ]" .r
102
+ val meta = " \\ " | " ]" | " -"
103
+ ((" \\ " ~> meta) | normalChars | " \\ " ~> normalChars) ^^ CharacterClass .Literal
103
104
}
104
105
105
106
lazy val characterClassTerm : Parser [CharacterClass .Term ] =
Original file line number Diff line number Diff line change @@ -34,5 +34,17 @@ class RegexpGenSpec extends WordSpec with MustMatchers with PropertyChecks {
34
34
str must fullyMatch regex r
35
35
}
36
36
}
37
+
38
+ " create a valid generator from `^[a-zA-Z &`\\ -\\ '\\ .]{1,35}$`" in {
39
+
40
+ val r = " ^[a-zA-Z &`\\ -\\ '\\ .]{1,35}$"
41
+ val gen = RegexpGen .from(r)
42
+
43
+ forAll(gen) {
44
+ str =>
45
+ println(str)
46
+ str must fullyMatch regex r
47
+ }
48
+ }
37
49
}
38
50
}
You can’t perform that action at this time.
0 commit comments