summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorImir Kiyamov <makketagg@gmail.com>2022-05-20 16:32:11 +0300
committergit <svn-admin@ruby-lang.org>2022-09-01 19:47:39 +0900
commitf67ab7f30c837ce4b9c2ae39d7c189413fac6dff (patch)
tree0302a3623cb8d61667b9b17f616820c0ad03c04f /test
parent55b1600987413949fe39507f703d2f51dab56eb6 (diff)
[ruby/did_you_mean] Fixed correction duplicates in VariableNameChecker
https://github.com/ruby/did_you_mean/commit/c3fc412f6f
Diffstat (limited to 'test')
-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