<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/test/error_highlight/test_error_highlight.rb, branch v3_3_11</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>[ruby/error_highlight] Support the new message format of NameError in Ruby 3.3</title>
<updated>2023-02-19T10:29:56+00:00</updated>
<author>
<name>Yusuke Endoh</name>
<email>mame@ruby-lang.org</email>
</author>
<published>2023-02-18T11:16:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=29f88b9feadee1417010dc6cd4f8e49c8c19720a'/>
<id>29f88b9feadee1417010dc6cd4f8e49c8c19720a</id>
<content type='text'>
https://bugs.ruby-lang.org/issues/18285
https://github.com/ruby/ruby/pull/6950

https://github.com/ruby/error_highlight/commit/a7c2da052e
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://bugs.ruby-lang.org/issues/18285
https://github.com/ruby/ruby/pull/6950

https://github.com/ruby/error_highlight/commit/a7c2da052e
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/error_highlight] Identify which node in `Foo::Bar::Baz` causes a NameError</title>
<updated>2023-01-13T08:25:09+00:00</updated>
<author>
<name>Yusuke Endoh</name>
<email>mame@ruby-lang.org</email>
</author>
<published>2023-01-13T08:02:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=94d6d6d93fa40b5f8dcdda6aa0e4b300ee61085c'/>
<id>94d6d6d93fa40b5f8dcdda6aa0e4b300ee61085c</id>
<content type='text'>
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
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/error_highlight] Enable tests for TypeError and ArgumentError</title>
<updated>2022-11-14T06:22:35+00:00</updated>
<author>
<name>Yusuke Endoh</name>
<email>mame@ruby-lang.org</email>
</author>
<published>2022-11-14T06:19:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=81c494d81009290706967095912a1f4791e2d5ee'/>
<id>81c494d81009290706967095912a1f4791e2d5ee</id>
<content type='text'>
These tests were unintentionally disabled by `if false`

https://github.com/ruby/error_highlight/commit/fa6d00d80d
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
These tests were unintentionally disabled by `if false`

https://github.com/ruby/error_highlight/commit/fa6d00d80d
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/error_highlight] Support nodes in `spot`</title>
<updated>2022-10-31T04:58:38+00:00</updated>
<author>
<name>eileencodes</name>
<email>eileencodes@gmail.com</email>
</author>
<published>2022-10-19T17:50:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=350d0aa023223f560d812ef61396a2c5359f09a6'/>
<id>350d0aa023223f560d812ef61396a2c5359f09a6</id>
<content type='text'>
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 &lt;tenderlove@ruby-lang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &lt;tenderlove@ruby-lang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/error_highlight] Make backtrace_location keyword work</title>
<updated>2022-08-10T12:19:10+00:00</updated>
<author>
<name>Yusuke Endoh</name>
<email>mame@ruby-lang.org</email>
</author>
<published>2022-08-10T12:17:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=3a58009066049f9af09ea3171cecab88ba0d9f1c'/>
<id>3a58009066049f9af09ea3171cecab88ba0d9f1c</id>
<content type='text'>
We had to keep backtrace_location before opts is overwritten.

https://github.com/ruby/error_highlight/commit/2735e4681a
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We had to keep backtrace_location before opts is overwritten.

https://github.com/ruby/error_highlight/commit/2735e4681a
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/error_highlight] Make ErrorHighlight.spot accept Exception (https://github.com/ruby/error_highlight/pull/25)</title>
<updated>2022-08-10T09:37:13+00:00</updated>
<author>
<name>Yusuke Endoh</name>
<email>mame@ruby-lang.org</email>
</author>
<published>2022-08-10T09:36:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=99e7fa5b3718d61d61427c67d244ec50b9eb8578'/>
<id>99e7fa5b3718d61d61427c67d244ec50b9eb8578</id>
<content type='text'>
... 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
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
... 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
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/error_highlight] Use Exception#detailed_message instead of overriding #message (https://github.com/ruby/error_highlight/pull/24)</title>
<updated>2022-06-07T08:40:19+00:00</updated>
<author>
<name>Yusuke Endoh</name>
<email>mame@ruby-lang.org</email>
</author>
<published>2022-06-07T08:40:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=f075be3dcb4b82b89496d1820002bf3d80f653ef'/>
<id>f075be3dcb4b82b89496d1820002bf3d80f653ef</id>
<content type='text'>
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
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/error_highlight] Add a test to check if it is robust against a spoofed filename</title>
<updated>2022-01-04T14:18:37+00:00</updated>
<author>
<name>Yusuke Endoh</name>
<email>mame@ruby-lang.org</email>
</author>
<published>2022-01-04T14:18:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=e9a4cc02b491fc8a2936f51b9f94ddcd77dd67f7'/>
<id>e9a4cc02b491fc8a2936f51b9f94ddcd77dd67f7</id>
<content type='text'>
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
 =&gt; 2:   binding.irb
    3: end

irb(Dummy):001:0&gt; 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
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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
 =&gt; 2:   binding.irb
    3: end

irb(Dummy):001:0&gt; 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
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/error_highlight] Fix the spurious TypeError.</title>
<updated>2022-01-04T14:09:01+00:00</updated>
<author>
<name>Christian Boos</name>
<email>cboos@bct-technology.com</email>
</author>
<published>2021-12-29T22:10:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=11b1ebe606a82bcdcb4ff5568f0302c5470d0048'/>
<id>11b1ebe606a82bcdcb4ff5568f0302c5470d0048</id>
<content type='text'>
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
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/error_highlight] Reproduce the error seen when calling .to_s in embedded Ruby</title>
<updated>2022-01-04T14:09:00+00:00</updated>
<author>
<name>Christian Boos</name>
<email>cboos@bct-technology.com</email>
</author>
<published>2021-12-29T22:03:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=e22218b510ec6befb385a6dda92d4a178607ebc7'/>
<id>e22218b510ec6befb385a6dda92d4a178607ebc7</id>
<content type='text'>
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
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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
</pre>
</div>
</content>
</entry>
</feed>
