aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Boos <cboos@bct-technology.com>2021-12-29 22:03:41 +0000
committergit <svn-admin@ruby-lang.org>2022-01-04 23:09:00 +0900
commite22218b510ec6befb385a6dda92d4a178607ebc7 (patch)
treec8984af51a362a6bc0512f95f0cc26df35f821f4
parentb673e9a3040335b63cbf216e66b147f2b83828a9 (diff)
downloadruby-e22218b510ec6befb385a6dda92d4a178607ebc7.tar.gz
[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
-rw-r--r--test/error_highlight/test_error_highlight.rb16
1 files changed, 16 insertions, 0 deletions
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