From c57880e68d142e518e231b8e76d595ddd403676d Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Wed, 14 Feb 2024 17:30:04 +0900 Subject: Show the invalid source encoding in messages --- test/ruby/test_parse.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb index edf61db325..325519fd80 100644 --- a/test/ruby/test_parse.rb +++ b/test/ruby/test_parse.rb @@ -797,6 +797,20 @@ x = __ENCODING__ x = __ENCODING__ END end + + e = assert_raise(ArgumentError) do + eval <<-END, nil, __FILE__, __LINE__+1 +# coding: foo + END + end + assert_include(e.message, "# coding: foo\n ^~~") + + e = assert_raise(ArgumentError) do + eval <<-END, nil, __FILE__, __LINE__+1 +# coding = foo + END + end + assert_include(e.message, "# coding = foo\n ^~~") end def test_utf8_bom -- cgit v1.2.3