Skip to content

Commit

Permalink
Write failing test to track standardrb/standard-performance#8
Browse files Browse the repository at this point in the history
  • Loading branch information
searls committed Jun 13, 2023
1 parent 95eeb20 commit a9d7392
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions test/fixture/cli/unsafecorrectable-bad.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
val = :true
puts val

# Should only be fixed unsafely
# https://github.com/standardrb/standard-performance/issues/8
h = {a: 1, b: 2, c: 3}.count { |k, v| v.odd? }
puts h
5 changes: 5 additions & 0 deletions test/fixture/cli/unsafecorrectable-good.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
val = true
puts val

# Should only be fixed unsafely
# https://github.com/standardrb/standard-performance/issues/8
h = {a: 1, b: 2, c: 3}.count { |k, v| v.odd? }
puts h
3 changes: 2 additions & 1 deletion test/standard/cli_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ def test_unsafely_fixable_is_not_fixed_unsafely
assert_equal <<~OUTPUT, fake_out.string
#{standard_greeting}
test/fixture/cli/unsafecorrectable-bad.rb:1:7: Lint/BooleanSymbol: Symbol with a boolean name - you probably meant to use `true`.
standard: Run `standardrb --fix-unsafely` to DANGEROUSLY fix one problem.
test/fixture/cli/unsafecorrectable-bad.rb:6:24: Performance/Count: Use `count` instead of `select...count`.
standard: Run `standardrb --fix-unsafely` to DANGEROUSLY fix 2 problems.
OUTPUT
end

Expand Down

0 comments on commit a9d7392

Please sign in to comment.