Skip to content

Commit

Permalink
Match CRuby error message for unknown regexp options
Browse files Browse the repository at this point in the history
  • Loading branch information
kddnewton committed Jun 11, 2024
1 parent cd66c47 commit 73669b5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion templates/src/diagnostic.c.erb
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ static const pm_diagnostic_data_t diagnostic_messages[PM_DIAGNOSTIC_ID_MAX] = {
[PM_ERR_REGEXP_NON_ESCAPED_MBC] = { "/.../n has a non escaped non ASCII character in non ASCII-8BIT script: /%.*s/", PM_ERROR_LEVEL_SYNTAX },
[PM_ERR_REGEXP_INVALID_UNICODE_RANGE] = { "invalid Unicode range: /%.*s/", PM_ERROR_LEVEL_SYNTAX },
[PM_ERR_REGEXP_PARSE_ERROR] = { "%s", PM_ERROR_LEVEL_SYNTAX },
[PM_ERR_REGEXP_UNKNOWN_OPTIONS] = { "unknown regexp %s: %.*s", PM_ERROR_LEVEL_SYNTAX },
[PM_ERR_REGEXP_UNKNOWN_OPTIONS] = { "unknown regexp %s - %.*s", PM_ERROR_LEVEL_SYNTAX },
[PM_ERR_REGEXP_TERM] = { "unterminated regexp meets end of file; expected a closing delimiter", PM_ERROR_LEVEL_SYNTAX },
[PM_ERR_REGEXP_UTF8_CHAR_NON_UTF8_REGEXP] = { "UTF-8 character in non UTF-8 regexp: /%s/", PM_ERROR_LEVEL_SYNTAX },
[PM_ERR_RESCUE_EXPRESSION] = { "expected a rescued expression", PM_ERROR_LEVEL_SYNTAX },
Expand Down
4 changes: 2 additions & 2 deletions test/prism/errors_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2134,14 +2134,14 @@ def test_it_with_ordinary_parameter

def test_regular_expression_with_unknown_regexp_options
source = "/foo/AZaz"
errors = [["unknown regexp options: AZaz", 4..9]]
errors = [["unknown regexp options - AZaz", 4..9]]

assert_errors expression(source), source, errors
end

def test_interpolated_regular_expression_with_unknown_regexp_options
source = "/\#{foo}/AZaz"
errors = [["unknown regexp options: AZaz", 7..12]]
errors = [["unknown regexp options - AZaz", 7..12]]

assert_errors expression(source), source, errors
end
Expand Down

0 comments on commit 73669b5

Please sign in to comment.