-
Notifications
You must be signed in to change notification settings - Fork 318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Fallback to Prim_Text_Helper.compile_regex; accept Regex in Text.parse_to_table #7297
Changes from 5 commits
ea3d769
46ee5c1
a842964
f2d5b50
00c19b3
88d7855
3f26a00
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,11 @@ spec = | |
Test.specify "should disallow empty patterns in `compile`" <| | ||
Regex.compile "" . should_fail_with Illegal_Argument | ||
|
||
Test.specify "passing a non-string should fail with a type error" <| | ||
Test.expect_panic_with (Regex.compile 12) Type_Error | ||
p = Regex.compile "[a-z]" | ||
Test.expect_panic_with (Regex.compile p) Type_Error | ||
Comment on lines
+38
to
+39
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given this behaviour (that I think is good), do we still need the I assume it should not be allowed to pass an already-compiled regex to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My understanding is that parseRegexPattern is for caching compiled regexes, so if you compile the same one multiple times, it uses the cache. This test is for passing a non-string to Regex.compile. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah sorry! I read that wrong apparently. |
||
|
||
Test.group "Escape" <| | ||
Test.specify "should escape an expression for use as a literal" <| | ||
Regex.escape "[a-z\d]+" . should_equal '\\[a-z\\d\\]\\+' | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will need to be rebased on my one for this to work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.