summaryrefslogtreecommitdiff
path: root/test/error_highlight
Commit message (Collapse)AuthorAgeFilesLines
* [ruby/error_highlight] Support the new message format of NameError in Ruby 3.3Yusuke Endoh2023-02-191-59/+73
| | | | | | | https://bugs.ruby-lang.org/issues/18285 https://github.com/ruby/ruby/pull/6950 https://github.com/ruby/error_highlight/commit/a7c2da052e
* [ruby/error_highlight] Identify which node in `Foo::Bar::Baz` causes a NameErrorYusuke Endoh2023-01-131-0/+48
| | | | | | | | | | | | | In Ruby 3.2 or later, a nested constant access like `Foo::Bar::Baz` is compiled to one instruction by the optimization https://github.com/ruby/ruby/pull/6187 We try to spot which sub-node caues a NameError in question based on the constant name. We will give up if the same constant name is accessed in a nested access (`Foo::Foo`). Fixes https://github.com/ruby/error_highlight/pull/31 https://github.com/ruby/error_highlight/commit/0a4db7da0a
* [ruby/error_highlight] Enable tests for TypeError and ArgumentErrorYusuke Endoh2022-11-141-16/+14
| | | | | | These tests were unintentionally disabled by `if false` https://github.com/ruby/error_highlight/commit/fa6d00d80d
* [ruby/error_highlight] Support nodes in `spot`eileencodes2022-10-311-0/+32
| | | | | | | | | | | | | | | Fixes a bug where `spot` was using the wrong local variable. We want to use error highlight with code that has been eval'd, specifically ERB templates. We can recover the compiled source code of the ERB template but we need an API to pass the node into error highlight's `spot`. Required Ruby PR: https://github.com/ruby/ruby/pull/6593 https://github.com/ruby/error_highlight/commit/0b1b650a59 Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
* [ruby/error_highlight] Make backtrace_location keyword workYusuke Endoh2022-08-101-0/+26
| | | | | | We had to keep backtrace_location before opts is overwritten. https://github.com/ruby/error_highlight/commit/2735e4681a
* [ruby/error_highlight] Make ErrorHighlight.spot accept Exception ↵Yusuke Endoh2022-08-101-1/+1
| | | | | | | | | (https://github.com/ruby/error_highlight/pull/25) ... and move things from core_ext.rb to base.rb. This will confine CRuby-dependent things to ErrorHighlight.spot. https://github.com/ruby/error_highlight/commit/22d1dd7824
* [ruby/error_highlight] Use Exception#detailed_message instead of overriding ↵Yusuke Endoh2022-06-071-3/+10
| | | | | | | | | #message (https://github.com/ruby/error_highlight/pull/24) See https://bugs.ruby-lang.org/issues/18564. Ref: https://github.com/ruby/did_you_mean/pull/177 https://github.com/ruby/error_highlight/commit/671b7c61b2
* [ruby/error_highlight] Add a test to check if it is robust against a spoofed ↵Yusuke Endoh2022-01-041-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | filename Previously, RubyVM::AST.of opened a wrong file if the iseq's file path is spoofed. ``` module Dummy binding.irb end ``` ``` $ ruby test.rb From: test.rb @ line 2 : 1: module Dummy => 2: binding.irb 3: end irb(Dummy):001:0> foo /home/mame/work/ruby/local/lib/ruby/3.1.0/error_highlight/base.rb:412:in `spot_colon2': undefined method `last_lineno' for nil:NilClass (NoMethodError) if nd_parent.last_lineno == @node.last_lineno ^^^^^^^^^^^^ ``` Found by @kateinoigakukun This issue is already fixed in the interpreter side. This change just adds a test for the case. https://github.com/ruby/error_highlight/commit/f3626b9032
* [ruby/error_highlight] Fix the spurious TypeError.Christian Boos2022-01-041-3/+0
| | | | | | | When we have no backtrace locations, we can't have the highlight, so just return the message. https://github.com/ruby/error_highlight/commit/9f5c639494
* [ruby/error_highlight] Reproduce the error seen when calling .to_s in ↵Christian Boos2022-01-041-0/+16
| | | | | | | | | | 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
* [ruby/error_highlight] Make the formatter mechanism support RactorYusuke Endoh2021-10-271-2/+2
| | | | | | | | | | Now the formatter configuration is per Ractor. DefaultFormatter is used if not set. DefaultFormatter#message_for is now a class method to allow sub-Ractors to call the method. https://github.com/ruby/error_highlight/commit/9fbaa8ab7c
* [ruby/error_highlight] Fixed the argument for DidYouMean.formatter=Yusuke Endoh2021-08-201-1/+1
| | | | | | | Looks like this bug was hidden by did_you_mean's rescuing any exceptions. https://github.com/ruby/error_highlight/commit/7a8f0b4796
* [ruby/error_highlight] Keep it work if paren exists after receiverMasataka Pocke Kuwabara2021-07-311-1/+161
| | | | https://github.com/ruby/error_highlight/commit/b79d679bbd
* Partly picking ↵Hiroshi SHIBATA2021-07-291-1/+1
| | | | https://github.com/ruby/error_highlight/commit/25ef7dbeda4f2cfcad1675f70319401ef4916f40#diff-1ce41a048bf2c08aa7bf25b741e9d3a4e08ea03f0d80bc6b8ee6d1c3c259704dR1022
* [ruby/error_highlight] Fix leaked tempfilesNobuyoshi Nakada2021-07-161-10/+12
| | | | https://github.com/ruby/error_highlight/commit/8b353a10a7
* [ruby/error_highlight] Set the binary mode for Tempfile creation in a testYusuke Endoh2021-07-131-1/+1
| | | | https://github.com/ruby/error_highlight/commit/8273d3b6f2
* [ruby/error_highlight] Support a file that has no final newlineYusuke Endoh2021-07-131-0/+16
| | | | https://github.com/ruby/error_highlight/commit/9d671284cb
* [ruby/error_highlight] Support hard tabsYusuke Endoh2021-07-131-0/+17
| | | | | | | | | | Now, the highlight line is created by replacing non-tab characters with spaces, and keeping all hard tabs as-is. This means the highlight line has the completely same indentation as the code snippet line. Fixes #7 https://github.com/ruby/error_highlight/commit/38f20fa542
* [ruby/error_highlight] Update a test for multibyte charactersYusuke Endoh2021-07-121-3/+0
| | | | https://github.com/ruby/error_highlight/commit/2fc70d7f8e
* [ruby/error_highlight] Experimentally support a custom formatterYusuke Endoh2021-06-301-0/+21
| | | | https://github.com/ruby/error_highlight/commit/f40a1de20e
* Rename error_squiggle to error_highlightYusuke Endoh2021-06-291-0/+984