From e22218b510ec6befb385a6dda92d4a178607ebc7 Mon Sep 17 00:00:00 2001 From: Christian Boos Date: Wed, 29 Dec 2021 22:03:41 +0000 Subject: [ruby/error_highlight] Reproduce the error seen when calling .to_s in embedded Ruby The test fails with the following error: Error: test_simulate_funcallv_from_embedded_ruby(ErrorHighlightTest): TypeError: wrong argument type nil (expected method) https://github.com/ruby/error_highlight/commit/52943c9cd2 --- test/error_highlight/test_error_highlight.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test') diff --git a/test/error_highlight/test_error_highlight.rb b/test/error_highlight/test_error_highlight.rb index 08036bca54..222da0fc79 100644 --- a/test/error_highlight/test_error_highlight.rb +++ b/test/error_highlight/test_error_highlight.rb @@ -1194,4 +1194,20 @@ undefined method `time' for 1:Integer end end end + + def test_simulate_funcallv_from_embedded_ruby + assert_error_message(NoMethodError, <<~END) do +undefined method `foo' for nil:NilClass + + nil.foo + 1 + ^^^^ + END + + nil.foo + 1 + rescue NoMethodError => exc + def exc.backtrace_locations = [] + raise + end + end + end -- cgit v1.2.3