File tree Expand file tree Collapse file tree 6 files changed +47
-2
lines changed Expand file tree Collapse file tree 6 files changed +47
-2
lines changed Original file line number Diff line number Diff line change 1
1
## HEAD (unreleased)
2
2
3
+ ## 1.0.4
4
+
5
+ - Fix rendering a file without a newline ending (https://github.com/ruby/syntax_suggest/pull/182 )
6
+
3
7
## 1.0.3
4
8
5
9
- Output improvement: Handle methods with only newlines or comments in them (https://github.com/ruby/syntax_suggest/pull/179 )
Original file line number Diff line number Diff line change 1
1
PATH
2
2
remote: .
3
3
specs:
4
- syntax_suggest (1.0.3 )
4
+ syntax_suggest (1.0.4 )
5
5
6
6
GEM
7
7
remote: https://rubygems.org/
Original file line number Diff line number Diff line change @@ -186,6 +186,7 @@ Because `syntax_suggest` is a default gem you can get conflicts when working on
186
186
187
187
There are some binstubs that already have this done for you. Instead of running ` bundle exec rake ` you can run ` bin/rake ` . Binstubs provided:
188
188
189
+ - ` bin/bundle `
189
190
- ` bin/rake `
190
191
- ` bin/rspec `
191
192
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # Make sure syntax_suggest default gem is not loaded first
5
+ RUBYOPT=" ${RUBYOPT-} --disable=syntax_suggest"
6
+ RUBYOPT=" $RUBYOPT " bundle " $@ "
Original file line number Diff line number Diff line change 1
1
# frozen_string_literal: true
2
2
3
3
module SyntaxSuggest
4
- VERSION = "1.0.3 "
4
+ VERSION = "1.0.4 "
5
5
end
Original file line number Diff line number Diff line change
1
+ require_relative "../spec_helper"
2
+
3
+ module SyntaxSuggest
4
+ RSpec . describe "Core extension" do
5
+ it "SyntaxError monkepatch ensures there is a newline to the end of the file" do
6
+ skip if Gem ::Version . new ( RUBY_VERSION ) < Gem ::Version . new ( "3.2" )
7
+
8
+ Dir . mktmpdir do |dir |
9
+ tmpdir = Pathname ( dir )
10
+ file = tmpdir . join ( "file.rb" )
11
+ file . write ( <<~'EOM' . strip )
12
+ print 'no newline
13
+ EOM
14
+
15
+ core_ext_file = lib_dir . join ( "syntax_suggest" ) . join ( "core_ext" )
16
+ require_relative core_ext_file
17
+
18
+ original_message = "blerg"
19
+ error = SyntaxError . new ( original_message )
20
+ def error . set_tmp_path_for_testing = ( path )
21
+ @tmp_path_for_testing = path
22
+ end
23
+ error . set_tmp_path_for_testing = file
24
+ def error . path
25
+ @tmp_path_for_testing
26
+ end
27
+
28
+ detailed = error . detailed_message ( highlight : false , syntax_suggest : true )
29
+ expect ( detailed ) . to include ( "'no newline\n #{ original_message } " )
30
+ expect ( detailed ) . to_not include ( "print 'no newline#{ original_message } " )
31
+ end
32
+ end
33
+ end
34
+ end
You can’t perform that action at this time.
0 commit comments