File tree Expand file tree Collapse file tree 4 files changed +13
-2
lines changed Expand file tree Collapse file tree 4 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 1
1
## HEAD (unreleased)
2
2
3
+ - Handle Ruby 3.3 new eval source location format (https://github.com/ruby/syntax_suggest/pull/200 ).
4
+
3
5
## 1.1.0
4
6
5
7
- Handle if/else with comment or empty line in branch (https://github.com/ruby/syntax_suggest/pull/193 )
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ module SyntaxSuggest
13
13
# # => "/tmp/scratch.rb"
14
14
#
15
15
class PathnameFromMessage
16
- EVAL_RE = /^\( eval\) :\d +/
16
+ EVAL_RE = /^\( eval.* \) :\d +/
17
17
STREAMING_RE = /^-:\d +/
18
18
attr_reader :name
19
19
Original file line number Diff line number Diff line change @@ -167,7 +167,7 @@ class Dog
167
167
out = `#{ ruby } -I#{ lib_dir } -rsyntax_suggest #{ script } 2>&1`
168
168
169
169
expect ( $?. success? ) . to be_falsey
170
- expect ( out ) . to include ( " (eval):1" )
170
+ expect ( out ) . to match ( / \ ( eval.* \ ) :1/ )
171
171
172
172
expect ( out ) . to_not include ( "SyntaxSuggest" )
173
173
expect ( out ) . to_not include ( "Could not find filename" )
Original file line number Diff line number Diff line change @@ -43,6 +43,15 @@ module SyntaxSuggest
43
43
expect ( file ) . to be_falsey
44
44
end
45
45
46
+ it "does not output error message on syntax error inside of an (eval at __FILE__:__LINE__)" do
47
+ message = "(eval at #{ __FILE__ } :#{ __LINE__ } ):1: invalid multibyte char (UTF-8) (SyntaxError)\n "
48
+ io = StringIO . new
49
+ file = PathnameFromMessage . new ( message , io : io ) . call . name
50
+
51
+ expect ( io . string ) . to eq ( "" )
52
+ expect ( file ) . to be_falsey
53
+ end
54
+
46
55
it "does not output error message on syntax error inside of streamed code" do
47
56
# An example of streamed code is: $ echo "def foo" | ruby
48
57
message = "-:1: syntax error, unexpected end-of-input\n "
You can’t perform that action at this time.
0 commit comments