summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-11-11 12:57:40 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-11-11 12:57:40 +0900
commit6eaac7cfac668d6669be694fd7b723c4982ed218 (patch)
tree5973f0d43139e452174a60f9e98e047e747e4eca
parent390293525a8c8564c62f7691414194705a193b40 (diff)
Elaborated EOF char message a little
-rw-r--r--parse.y2
-rw-r--r--test/ruby/test_parse.rb2
-rw-r--r--test/ruby/test_syntax.rb6
3 files changed, 5 insertions, 5 deletions
diff --git a/parse.y b/parse.y
index 039abc48d7..0eeb9756ff 100644
--- a/parse.y
+++ b/parse.y
@@ -6209,7 +6209,7 @@ lex_goto_eol(struct parser_params *p)
for (; pcur < pend; pcur++) {
const char *eof = eof_char(*pcur);
if (eof) {
- rb_warning1("encountered %s in comment, just ignored in this version", WARN_S(eof));
+ rb_warning1("encountered EOF char(%s) in comment, just ignored in this version", WARN_S(eof));
break;
}
}
diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb
index 17a0c8a077..07d4151e5a 100644
--- a/test/ruby/test_parse.rb
+++ b/test/ruby/test_parse.rb
@@ -722,7 +722,7 @@ x = __ENCODING__
def test_embedded_rd_warning
[["\0", "\\0"], ["\C-d", "^D"], ["\C-z", "^Z"]].each do |eof, mesg|
- mesg = /encountered #{Regexp.quote(mesg)}/
+ mesg = /encountered EOF char\(#{Regexp.quote(mesg)}\)/
assert_warning(mesg) {eval("=begin\n#{eof}\n=end")}
assert_warning(mesg) {eval("=begin#{eof}\n=end")}
assert_warning(mesg) {eval("=begin\n=end#{eof}\n")}
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb
index d0748e7028..dc8a618c4e 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -944,9 +944,9 @@ eom
end
def test_warning_for_eof_in_comment
- assert_warning(/encountered \\0/) {eval("#\0")}
- assert_warning(/encountered \^D/) {eval("#\C-d")}
- assert_warning(/encountered \^Z/) {eval("#\C-z")}
+ assert_warning(/encountered EOF char\(\\0\)/) {eval("#\0")}
+ assert_warning(/encountered EOF char\(\^D\)/) {eval("#\C-d")}
+ assert_warning(/encountered EOF char\(\^Z\)/) {eval("#\C-z")}
end
def test_unexpected_fraction