Skip to content

Commit

Permalink
Run tests with Prism 0.25
Browse files Browse the repository at this point in the history
Run tests with Prism 0.25 and fixes the following build errors:

```console
$ bundle exec rake
(snip)

==> Failures

  1) RuboCop::Cop::Performance::RedundantMatch behaves like require no parentheses registers an offense and corrects when argument is `yield`
     Failure/Error:
       expect_offense(<<~RUBY, arg: arg)
         something if /regex/.match(%{arg})
                      ^^^^^^^^^^^^^^^{arg}^ Use `=~` in places where the `MatchData` returned by `#match` will not be used.
       RUBY

     RuntimeError:
       Error parsing example code: (string):1:28: error: Invalid yield
       (string):1: something if /regex/.match(yield)
       (string):1:                            ^~~~~
     Shared Example Group: "require no parentheses" called from ./spec/rubocop/cop/performance/redundant_match_spec.rb:162
     # ./spec/rubocop/cop/performance/redundant_match_spec.rb:148:in `block (3 levels) in <top (required)>'

  2) RuboCop::Cop::Performance::RedundantMatch behaves like require parentheses registers an offense and corrects when argument is `yield a`
     Failure/Error:
       expect_offense(<<~RUBY, arg: arg)
         something if /regex/.match(%{arg})
                      ^^^^^^^^^^^^^^^{arg}^ Use `=~` in places where the `MatchData` returned by `#match` will not be used.
       RUBY

     RuntimeError:
       Error parsing example code: (string):1:28: error: Invalid yield
       (string):1: something if /regex/.match(yield a)
       (string):1:                            ^~~~~~~
     Shared Example Group: "require parentheses" called from ./spec/rubocop/cop/performance/redundant_match_spec.rb:142
     # ./spec/rubocop/cop/performance/redundant_match_spec.rb:126:in `block (3 levels) in <top (required)>'

rake aborted!
```
  • Loading branch information
koic committed Apr 8, 2024
1 parent 1840272 commit 6d72c73
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions spec/rubocop/cop/performance/redundant_match_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,11 @@ def method(str)
it_behaves_like 'require parentheses', 'a || b'
it_behaves_like 'require parentheses', 'a..b'
it_behaves_like 'require parentheses', 'method a'
it_behaves_like 'require parentheses', 'yield a'

context 'when Ruby <= 3.2', :ruby32, unsupported_on: :prism do # rubocop:disable RSpec/RepeatedExampleGroupDescription
it_behaves_like 'require parentheses', 'yield a'
end

it_behaves_like 'require parentheses', 'super a'
it_behaves_like 'require parentheses', 'a == b'

Expand All @@ -159,7 +163,11 @@ def method(str)
it_behaves_like 'require no parentheses', 'if a then b else c end'
it_behaves_like 'require no parentheses', 'method(a)'
it_behaves_like 'require no parentheses', 'method'
it_behaves_like 'require no parentheses', 'yield'

context 'when Ruby <= 3.2', :ruby32, unsupported_on: :prism do # rubocop:disable RSpec/RepeatedExampleGroupDescription
it_behaves_like 'require no parentheses', 'yield'
end

it_behaves_like 'require no parentheses', 'super'
it_behaves_like 'require no parentheses', 'a.==(b)'

Expand Down

0 comments on commit 6d72c73

Please sign in to comment.