-
Notifications
You must be signed in to change notification settings - Fork 48
fix: support named captures #44
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
Changes from 3 commits
16a4b46
a3a7de3
aecf835
f9e9510
cd5c2c5
d8178c0
1e1bf0f
666f22b
7380bda
83d1655
617c3f9
83f042e
aecf844
30fb1b4
f63639c
aa60ea8
a139d4d
4ed10e4
171a940
af71c09
5b11f73
5def9c2
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 | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -763,6 +763,14 @@ def test_fixed_anchor_false | |||||||||
| assert_equal(false, StringScanner.new("a", fixed_anchor: nil).fixed_anchor?) | ||||||||||
| assert_equal(false, StringScanner.new("a", fixed_anchor: false).fixed_anchor?) | ||||||||||
| end | ||||||||||
|
|
||||||||||
| def test_named_captures | ||||||||||
|
ericgpks marked this conversation as resolved.
|
||||||||||
| s = "foobarbaz" | ||||||||||
| re = /(?<f>foo)(?<r>bar)(?<z>baz)/ | ||||||||||
| scan = StringScanner.new(s) | ||||||||||
| scan.match? re | ||||||||||
|
Member
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. We can use
Suggested change
Contributor
Author
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. Is it to be
Member
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. In general, no. But we can't use So we should use
Contributor
Author
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. I think that
Member
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. Wow! I thought that it returns a boolean value because its name ends with You're right. We should use
Contributor
Author
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. I fixed this test.
ericgpks marked this conversation as resolved.
Outdated
|
||||||||||
| assert_equal({"f"=>"foo", "r"=>"bar", "z"=>"baz"}, scan.named_captures) | ||||||||||
|
ericgpks marked this conversation as resolved.
Outdated
|
||||||||||
| end | ||||||||||
| end | ||||||||||
|
|
||||||||||
| class TestStringScannerFixedAnchor < TestStringScanner | ||||||||||
|
|
||||||||||
Uh oh!
There was an error while loading. Please reload this page.