summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Koval <al3xander.koval@gmail.com>2023-12-09 13:58:39 +0100
committergit <svn-admin@ruby-lang.org>2023-12-10 03:06:36 +0000
commit04eb1b6f2630a07b3a4140e593a4973493a71b92 (patch)
tree93e541e4eb92bfa5dfaf6971bcb59ffa78c547da
parentf64357540eabad0f1bfaa6be60710d153325b064 (diff)
[ruby/prism] fix: escape newline
https://github.com/ruby/prism/commit/a28b427dcc
-rw-r--r--prism/diagnostic.c4
-rw-r--r--test/prism/errors_test.rb8
2 files changed, 6 insertions, 6 deletions
diff --git a/prism/diagnostic.c b/prism/diagnostic.c
index c537d373aa..eaf6112d18 100644
--- a/prism/diagnostic.c
+++ b/prism/diagnostic.c
@@ -94,10 +94,10 @@ static const char* const diagnostic_messages[PM_DIAGNOSTIC_ID_LEN] = {
[PM_ERR_CLASS_NAME] = "expected a constant name after `class`",
[PM_ERR_CLASS_SUPERCLASS] = "expected a superclass after `<`",
[PM_ERR_CLASS_TERM] = "expected an `end` to close the `class` statement",
- [PM_ERR_CLASS_UNEXPECTED_END] = "unexpected `end`, expecting ';' or '\n'",
+ [PM_ERR_CLASS_UNEXPECTED_END] = "unexpected `end`, expecting ';' or '\\n'",
[PM_ERR_CONDITIONAL_ELSIF_PREDICATE] = "expected a predicate expression for the `elsif` statement",
[PM_ERR_CONDITIONAL_IF_PREDICATE] = "expected a predicate expression for the `if` statement",
- [PM_ERR_CONDITIONAL_PREDICATE_TERM] = "expected `then` or `;` or '\n'",
+ [PM_ERR_CONDITIONAL_PREDICATE_TERM] = "expected `then` or `;` or '\\n'",
[PM_ERR_CONDITIONAL_TERM] = "expected an `end` to close the conditional clause",
[PM_ERR_CONDITIONAL_TERM_ELSE] = "expected an `end` to close the `else` clause",
[PM_ERR_CONDITIONAL_UNLESS_PREDICATE] = "expected a predicate expression for the `unless` statement",
diff --git a/test/prism/errors_test.rb b/test/prism/errors_test.rb
index 5c14bfa977..b0e2554338 100644
--- a/test/prism/errors_test.rb
+++ b/test/prism/errors_test.rb
@@ -1423,9 +1423,9 @@ module Prism
def test_conditional_predicate_closed
source = "if 0 0; elsif 0 0; end\nunless 0 0; end"
assert_errors expression(source), source, [
- ["expected `then` or `;` or '\n" + "'", 5..6],
- ["expected `then` or `;` or '\n" + "'", 16..17],
- ["expected `then` or `;` or '\n" + "'", 32..33],
+ ["expected `then` or `;` or '\\n" + "'", 5..6],
+ ["expected `then` or `;` or '\\n" + "'", 16..17],
+ ["expected `then` or `;` or '\\n" + "'", 32..33],
]
end
@@ -1463,7 +1463,7 @@ module Prism
def test_semicolon_after_inheritance_operator
source = "class Foo < Bar end"
assert_errors expression(source), source, [
- ["unexpected `end`, expecting ';' or '\n'", 15..15],
+ ["unexpected `end`, expecting ';' or '\\n'", 15..15],
]
end