Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .rspec
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
--color
--format progress
--warnings
--order random
Expand Down
8 changes: 8 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,11 @@
source 'https://rubygems.org'

gemspec

gem 'mutant', '~> 0.14.2'
gem 'mutant-rspec', '~> 0.14.2'
gem 'rspec', '>= 3.13', '< 5'
gem 'rspec-core', '>= 3.13', '< 5'
gem 'rspec-its', '~> 2.0'
gem 'rubocop', '~> 1.7'
gem 'rubocop-packaging', '~> 0.5'
126 changes: 85 additions & 41 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,106 +2,150 @@ PATH
remote: .
specs:
unparser (0.8.1)
diff-lcs (~> 1.6)
diff-lcs (>= 1.6, < 3)
parser (>= 3.3.0)
prism (>= 1.5.1)

GEM
remote: https://rubygems.org/
specs:
ast (2.4.3)
date (3.4.1)
date (3.5.1)
diff-lcs (1.6.2)
erb (5.0.1)
io-console (0.8.0)
irb (1.15.2)
erb (6.0.1)
io-console (0.8.2)
irb (1.17.0)
pp (>= 0.6.0)
prism (>= 1.3.0)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
json (2.12.2)
json (2.18.1)
language_server-protocol (3.17.0.5)
lint_roller (1.1.0)
mutant (0.13.2)
mutant (0.14.2)
diff-lcs (~> 1.3)
irb (~> 1.15.2)
irb (~> 1.15)
parser (~> 3.3.0)
regexp_parser (~> 2.10)
sorbet-runtime (~> 0.5.0)
sorbet-runtime (~> 0.6.0)
unparser (~> 0.8.0)
mutant-rspec (0.13.2)
mutant (= 0.13.2)
mutant-rspec (0.14.2)
mutant (= 0.14.2)
rspec-core (>= 3.8.0, < 4.0.0)
parallel (1.27.0)
parser (3.3.8.0)
parser (3.3.10.2)
ast (~> 2.4.1)
racc
pp (0.6.2)
pp (0.6.3)
prettyprint
prettyprint (0.2.0)
prism (1.5.1)
psych (5.2.6)
prism (1.9.0)
psych (5.3.1)
date
stringio
racc (1.8.1)
rainbow (3.1.1)
rdoc (6.14.1)
rdoc (7.2.0)
erb
psych (>= 4.0.0)
regexp_parser (2.10.0)
reline (0.6.1)
tsort
regexp_parser (2.11.3)
reline (0.6.3)
io-console (~> 0.5)
rspec (3.13.1)
rspec (3.13.2)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.4)
rspec-core (3.13.6)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.5)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-its (1.3.1)
rspec-core (>= 3.0.0)
rspec-expectations (>= 3.0.0)
rspec-mocks (3.13.5)
rspec-its (2.0.0)
rspec-core (>= 3.13.0)
rspec-expectations (>= 3.13.0)
rspec-mocks (3.13.7)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.4)
rubocop (1.76.2)
rspec-support (3.13.7)
rubocop (1.84.2)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.45.1, < 2.0)
rubocop-ast (>= 1.49.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.45.1)
rubocop-ast (1.49.0)
parser (>= 3.3.7.2)
prism (~> 1.4)
prism (~> 1.7)
rubocop-packaging (0.6.0)
lint_roller (~> 1.1.0)
rubocop (>= 1.72.1, < 2.0)
ruby-progressbar (1.13.0)
sorbet-runtime (0.5.12194)
stringio (3.1.7)
unicode-display_width (3.1.4)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
sorbet-runtime (0.6.12957)
stringio (3.2.0)
tsort (0.2.0)
unicode-display_width (3.2.0)
unicode-emoji (~> 4.1)
unicode-emoji (4.2.0)

PLATFORMS
x86_64-linux
arm64-darwin-25
ruby

DEPENDENCIES
mutant (~> 0.13.2)
mutant-rspec (~> 0.13.0)
rspec (~> 3.13)
rspec-core (~> 3.13)
rspec-its (~> 1.3.0)
mutant (~> 0.14.2)
mutant-rspec (~> 0.14.2)
rspec (>= 3.13, < 5)
rspec-core (>= 3.13, < 5)
rspec-its (~> 2.0)
rubocop (~> 1.7)
rubocop-packaging (~> 0.5)
unparser!

CHECKSUMS
ast (2.4.3) sha256=954615157c1d6a382bc27d690d973195e79db7f55e9765ac7c481c60bdb4d383
date (3.5.1) sha256=750d06384d7b9c15d562c76291407d89e368dda4d4fff957eb94962d325a0dc0
diff-lcs (1.6.2) sha256=9ae0d2cba7d4df3075fe8cd8602a8604993efc0dfa934cff568969efb1909962
erb (6.0.1) sha256=28ecdd99c5472aebd5674d6061e3c6b0a45c049578b071e5a52c2a7f13c197e5
io-console (0.8.2) sha256=d6e3ae7a7cc7574f4b8893b4fca2162e57a825b223a177b7afa236c5ef9814cc
irb (1.17.0) sha256=168c4ddb93d8a361a045c41d92b2952c7a118fa73f23fe14e55609eb7a863aae
json (2.18.1) sha256=fe112755501b8d0466b5ada6cf50c8c3f41e897fa128ac5d263ec09eedc9f986
language_server-protocol (3.17.0.5) sha256=fd1e39a51a28bf3eec959379985a72e296e9f9acfce46f6a79d31ca8760803cc
lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87
mutant (0.14.2) sha256=ec3a03e65fb1cc639c02ae3444fc5e60bfd8da722a8f8d80492b0bc3fca1fba5
mutant-rspec (0.14.2) sha256=1dd8ee49a0ec517d4728d22d3cb5bc1f124f4944dde9f53859062688a7b4cec8
parallel (1.27.0) sha256=4ac151e1806b755fb4e2dc2332cbf0e54f2e24ba821ff2d3dcf86bf6dc4ae130
parser (3.3.10.2) sha256=6f60c84aa4bdcedb6d1a2434b738fe8a8136807b6adc8f7f53b97da9bc4e9357
pp (0.6.3) sha256=2951d514450b93ccfeb1df7d021cae0da16e0a7f95ee1e2273719669d0ab9df6
prettyprint (0.2.0) sha256=2bc9e15581a94742064a3cc8b0fb9d45aae3d03a1baa6ef80922627a0766f193
prism (1.9.0) sha256=7b530c6a9f92c24300014919c9dcbc055bf4cdf51ec30aed099b06cd6674ef85
psych (5.3.1) sha256=eb7a57cef10c9d70173ff74e739d843ac3b2c019a003de48447b2963d81b1974
racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f
rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a
rdoc (7.2.0) sha256=8650f76cd4009c3b54955eb5d7e3a075c60a57276766ebf36f9085e8c9f23192
regexp_parser (2.11.3) sha256=ca13f381a173b7a93450e53459075c9b76a10433caadcb2f1180f2c741fc55a4
reline (0.6.3) sha256=1198b04973565b36ec0f11542ab3f5cfeeec34823f4e54cebde90968092b1835
rspec (3.13.2) sha256=206284a08ad798e61f86d7ca3e376718d52c0bc944626b2349266f239f820587
rspec-core (3.13.6) sha256=a8823c6411667b60a8bca135364351dda34cd55e44ff94c4be4633b37d828b2d
rspec-expectations (3.13.5) sha256=33a4d3a1d95060aea4c94e9f237030a8f9eae5615e9bd85718fe3a09e4b58836
rspec-its (2.0.0) sha256=a88e8bc38149f2835e93533591ec4f5c829aacbfd41269a2e6f9f5b82f5260df
rspec-mocks (3.13.7) sha256=0979034e64b1d7a838aaaddf12bf065ea4dc40ef3d4c39f01f93ae2c66c62b1c
rspec-support (3.13.7) sha256=0640e5570872aafefd79867901deeeeb40b0c9875a36b983d85f54fb7381c47c
rubocop (1.84.2) sha256=5692cea54168f3dc8cb79a6fe95c5424b7ea893c707ad7a4307b0585e88dbf5f
rubocop-ast (1.49.0) sha256=49c3676d3123a0923d333e20c6c2dbaaae2d2287b475273fddee0c61da9f71fd
rubocop-packaging (0.6.0) sha256=fb92bd0fb48e6f8cdb1648d2249b0cd51c2497dcc87340132d22f01edbf558a7
ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33
sorbet-runtime (0.6.12957) sha256=691ccafeae2663236777ffc8a348266907fca3985b089f013d7ccd59bef19056
stringio (3.2.0) sha256=c37cb2e58b4ffbd33fe5cd948c05934af997b36e0b6ca6fdf43afa234cf222e1
tsort (0.2.0) sha256=9650a793f6859a43b6641671278f79cfead60ac714148aabe4e3f0060480089f
unicode-display_width (3.2.0) sha256=0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42
unicode-emoji (4.2.0) sha256=519e69150f75652e40bf736106cfbc8f0f73aa3fb6a65afe62fefa7f80b0f80f
unparser (0.8.1)

BUNDLED WITH
2.7.0
4.0.6
11 changes: 5 additions & 6 deletions bin/parser-prism-round-trip-test
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ b\nar

def excludes
%w[
character_literal
spanning_heredoc
heredocs_with_fake_newlines
heredocs_nested
].tap { _1 << 'endless_methods_command_call' unless Gem::Version.new(RUBY_VERSION) >= '3.5' } # https://github.com/ruby/prism/pull/3639
.tap { _1 << 'leading_logical' unless Gem::Version.new(RUBY_VERSION) >= '3.5' } # https://github.com/ruby/prism/pull/3337
.to_set { |file| "#{PARSER_PATH}/test/prism/fixtures-tmp/#{file}.txt" }
].flat_map { |file| Dir.glob("#{PARSER_PATH}/test/prism/fixtures-tmp/**/#{file}.txt") }
.to_set
end

private
Expand Down Expand Up @@ -105,7 +105,6 @@ Dir.chdir(PrismParser::PARSER_PATH) do
Kernel.system(*%w[git clean --force -d -X], exception: true)
end

ignores_cli_option = PrismParser.excludes.flat_map { |file| ['--ignore', file] }

PrismParser.prepare
exit Unparser::CLI.run([PrismParser.target_glob, *ignores_cli_option])
ignores_cli_option = PrismParser.excludes.flat_map { |file| ['--ignore', file] }
exit Unparser::CLI.run([PrismParser.target_glob, '--ignore-original-syntax-error', *ignores_cli_option])
3 changes: 2 additions & 1 deletion lib/unparser/emitter.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# frozen_string_literal: true

module Unparser
UnknownNodeError = Class.new(ArgumentError)
class UnknownNodeError < ArgumentError
end

# Emitter base class
class Emitter
Expand Down
3 changes: 2 additions & 1 deletion lib/unparser/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ module Unparser
# Original code before vendoring and reduction from: https://github.com/mbj/mutant/blob/main/lib/mutant/util.rb
module Util
# Error raised by `Util.one` if size is not exactly one
SizeError = Class.new(IndexError)
class SizeError < IndexError
end

# Return only element in array if it contains exactly one member
#
Expand Down
4 changes: 2 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

RSpec.shared_examples_for 'a command method' do
it 'returns self' do
should equal(object)
is_expected.to equal(object)
end
end

Expand All @@ -20,7 +20,7 @@
memoized = __memoized.instance_variable_get(:@memoized)

mutex.synchronize { memoized.delete(:subject) }
should equal(first)
is_expected.to equal(first)
end
end

Expand Down
6 changes: 3 additions & 3 deletions spec/unit/unparser/abstract_type_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
context 'called on a subclass' do
let(:object) { Class.new(abstract_type) }

it { should be_instance_of(object) }
it { is_expected.to be_instance_of(object) }
end

context 'called on the class' do
Expand Down Expand Up @@ -31,7 +31,7 @@
Object.class_eval { remove_const(:Subclass) }
end

it { should equal(object) }
it { is_expected.to equal(object) }

it 'creates an abstract method' do
expect { subject }.to change { subclass.method_defined?(:some_method) }
Expand Down Expand Up @@ -70,7 +70,7 @@
Object.class_eval { remove_const(:Subclass) }
end

it { should equal(object) }
it { is_expected.to equal(object) }

it 'creates an abstract method' do
expect { subject }.to change { subclass.respond_to?(:some_method) }
Expand Down
Loading