aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2020-03-26 16:43:16 +0900
committeraycabta <aycabta@gmail.com>2020-03-26 17:41:21 +0900
commit22477128cd77e0d0dce7e78bc12f9cc8cccc1cb4 (patch)
treeb0c88a22f80a3f4609cf00bc3dcd0a251a7698b9 /test
parentffbb162f1a052054ce2864d2971e83da10f8aa78 (diff)
downloadruby-22477128cd77e0d0dce7e78bc12f9cc8cccc1cb4.tar.gz
[ruby/irb] Suppress crashing when EncodingError has occurred without lineno
https://github.com/ruby/irb/commit/13572d8cdc
Diffstat (limited to 'test')
-rw-r--r--test/irb/test_context.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/irb/test_context.rb b/test/irb/test_context.rb
index 8a6521bf69..d03cc30c78 100644
--- a/test/irb/test_context.rb
+++ b/test/irb/test_context.rb
@@ -63,6 +63,13 @@ module TestIRB
assert_not_match(/rescue _\.class/, e.message)
end
+ def test_evaluate_with_encoding_error_without_lineno
+ assert_raise_with_message(EncodingError, /invalid symbol/) {
+ @context.evaluate(%q[{"\xAE": 1}], 1)
+ # The backtrace of this invalid encoding hash doesn't contain lineno.
+ }
+ end
+
def test_evaluate_with_onigmo_warning
assert_warning("(irb):1: warning: character class has duplicated range: /[aa]/\n") do
@context.evaluate('/[aa]/', 1)