Skip to content

Commit

Permalink
Remove an example which is a syntax error in Ruby's parser
Browse files Browse the repository at this point in the history
This code generates a syntax error as follows:
```ruby
❯ ruby -e '[1].each { put _1; [1].each { put _1 } }'
-e: -e:1: syntax error found (SyntaxError)
> 1 | ... _1 } }
    |     ^~ numbered parameter is already used in outer block
```

When numbered parameters are used in nested blocks, it is not possible to use numbered parameters in multiple different hierarchies.

While it was considered to split these up, we discussed below.
#2014 (comment)
  • Loading branch information
ydah committed Dec 25, 2024
1 parent 5d768fe commit 8cfe4c5
Showing 1 changed file with 0 additions and 29 deletions.
29 changes: 0 additions & 29 deletions spec/rubocop/cop/rspec/pending_without_reason_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -300,35 +300,6 @@
end
RUBY
end

context 'with a numblock' do
it 'registers offense' do
expect_offense(<<~RUBY)
RSpec.describe Foo do
pending
^^^^^^^ Give the reason for pending.
skip
^^^^ Give the reason for skip.
_1
context 'when something' do
_1
pending
^^^^^^^ Give the reason for pending.
skip
^^^^ Give the reason for skip.
it 'does something' do
_1
skip
^^^^ Give the reason for skip.
pending
^^^^^^^ Give the reason for pending.
_1
end
end
end
RUBY
end
end
end

context 'when pending/skip inside conditional' do
Expand Down

0 comments on commit 8cfe4c5

Please sign in to comment.