diff options
| author | yui-knk <spiketeika@gmail.com> | 2024-02-23 09:30:14 +0900 |
|---|---|---|
| committer | Yuichiro Kaneko <spiketeika@gmail.com> | 2024-02-23 11:12:08 +0900 |
| commit | 3ca6da24e397e550d589a69791be7697c0cb73c6 (patch) | |
| tree | ad7aceb13d9c0a7ff0b36267323c24c39fca19d2 /test/ruby | |
| parent | d5080f6e8b77364483ff6727b1065e45e180f05d (diff) | |
[Bug #20295] Fix SEGV when parsing invalid regexp
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_syntax.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb index d494820388..42108f955f 100644 --- a/test/ruby/test_syntax.rb +++ b/test/ruby/test_syntax.rb @@ -1034,6 +1034,14 @@ eom assert_not_match(/end-of-input/, e.message) end + def test_invalid_regexp + bug20295 = '[ruby-core:116913] [Bug #20295]' + + assert_syntax_error("/[/=~s", /premature end of char-class/, bug20295) + assert_syntax_error("/(?<>)/=~s", /group name is empty/, bug20295) + assert_syntax_error("/(?<a>[)/=~s", /premature end of char-class/, bug20295) + end + def test_lineno_operation_brace_block expected = __LINE__ + 1 actual = caller_lineno\ |
