Skip to content

Commit aa24762

Browse files
committed
v1.0.4
1 parent 0e5e6a2 commit aa24762

File tree

6 files changed

+47
-2
lines changed

6 files changed

+47
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
## HEAD (unreleased)
22

3+
## 1.0.4
4+
5+
- Fix rendering a file without a newline ending (https://github.com/ruby/syntax_suggest/pull/182)
6+
37
## 1.0.3
48

59
- Output improvement: Handle methods with only newlines or comments in them (https://github.com/ruby/syntax_suggest/pull/179)

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
syntax_suggest (1.0.3)
4+
syntax_suggest (1.0.4)
55

66
GEM
77
remote: https://rubygems.org/

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ Because `syntax_suggest` is a default gem you can get conflicts when working on
186186

187187
There are some binstubs that already have this done for you. Instead of running `bundle exec rake` you can run `bin/rake`. Binstubs provided:
188188

189+
- `bin/bundle`
189190
- `bin/rake`
190191
- `bin/rspec`
191192

bin/bundle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
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 "$@"

lib/syntax_suggest/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module SyntaxSuggest
4-
VERSION = "1.0.3"
4+
VERSION = "1.0.4"
55
end

spec/unit/core_ext_spec.rb

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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

0 commit comments

Comments
 (0)