[前][次][番号順一覧][スレッド一覧]

ruby-changes:58707

From: Nobuyoshi <ko1@a...>
Date: Mon, 11 Nov 2019 12:58:06 +0900 (JST)
Subject: [ruby-changes:58707] 6eaac7cfac (master): Elaborated EOF char message a little

https://git.ruby-lang.org/ruby.git/commit/?id=6eaac7cfac

From 6eaac7cfac668d6669be694fd7b723c4982ed218 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Mon, 11 Nov 2019 12:57:40 +0900
Subject: Elaborated EOF char message a little


diff --git a/parse.y b/parse.y
index 039abc4..0eeb975 100644
--- a/parse.y
+++ b/parse.y
@@ -6209,7 +6209,7 @@ lex_goto_eol(struct parser_params *p) https://github.com/ruby/ruby/blob/trunk/parse.y#L6209
     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 17a0c8a..07d4151 100644
--- a/test/ruby/test_parse.rb
+++ b/test/ruby/test_parse.rb
@@ -722,7 +722,7 @@ x = __ENCODING__ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_parse.rb#L722
 
   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 d0748e7..dc8a618 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -944,9 +944,9 @@ eom https://github.com/ruby/ruby/blob/trunk/test/ruby/test_syntax.rb#L944
   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
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]