summaryrefslogtreecommitdiff
path: root/test/did_you_mean/spell_checking/test_variable_name_check.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/did_you_mean/spell_checking/test_variable_name_check.rb')
-rw-r--r--test/did_you_mean/spell_checking/test_variable_name_check.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/did_you_mean/spell_checking/test_variable_name_check.rb b/test/did_you_mean/spell_checking/test_variable_name_check.rb
index 9d8b86eb5b..0350b62660 100644
--- a/test/did_you_mean/spell_checking/test_variable_name_check.rb
+++ b/test/did_you_mean/spell_checking/test_variable_name_check.rb
@@ -137,4 +137,16 @@ class VariableNameCheckTest < Test::Unit::TestCase
error = assert_raise(NameError){ foo }
assert_empty error.corrections
end
+
+ def test_exclude_duplicates_with_same_name
+ error = assert_raise(NameError) do
+ eval(<<~RUBY, binding, __FILE__, __LINE__)
+ bar = 1
+ def bar;end
+ zar
+ RUBY
+ end
+
+ assert_correction [:bar], error.corrections
+ end
end