summaryrefslogtreecommitdiff
path: root/test/did_you_mean
diff options
context:
space:
mode:
authorYuki Nishijima <yk.nishijima@gmail.com>2021-12-23 09:43:39 +0900
committerYuki Nishijima <yk.nishijima@gmail.com>2021-12-23 09:43:39 +0900
commitfeaf4fbc3fa16382fbd07158c448c7b5bdae78b5 (patch)
tree2da4e41253b6191c8c924b7afb21f55e578defe8 /test/did_you_mean
parentbed920f0731a1a89a0e5fc7a7428d21be3ffb8a0 (diff)
downloadruby-feaf4fbc3fa16382fbd07158c448c7b5bdae78b5.tar.gz
Remove test that activates Ractor unexpectedly
Diffstat (limited to 'test/did_you_mean')
-rw-r--r--test/did_you_mean/test_ractor_compatibility.rb102
1 files changed, 0 insertions, 102 deletions
diff --git a/test/did_you_mean/test_ractor_compatibility.rb b/test/did_you_mean/test_ractor_compatibility.rb
deleted file mode 100644
index 1a9e63997f..0000000000
--- a/test/did_you_mean/test_ractor_compatibility.rb
+++ /dev/null
@@ -1,102 +0,0 @@
-require_relative './helper'
-
-return if not DidYouMean::TestHelper.ractor_compatible?
-
-class RactorCompatibilityTest < Test::Unit::TestCase
- include DidYouMean::TestHelper
-
- class ::Book; end
- class FirstNameError < NameError; end
-
- def test_class_name_suggestion_works_in_ractor
- error = Ractor.new {
- begin
- Boook
- rescue NameError => e
- e.corrections # It is important to call the #corrections method within Ractor.
- e
- end
- }.take
-
- assert_correction "Book", error.corrections
- end
-
- def test_key_name_suggestion_works_in_ractor
- error = Ractor.new {
- begin
- hash = { "foo" => 1, bar: 2 }
-
- hash.fetch(:bax)
- rescue KeyError => e
- e.corrections # It is important to call the #corrections method within Ractor.
- e
- end
- }.take
-
- assert_correction ":bar", error.corrections
- assert_match "Did you mean? :bar", error.to_s
- end
-
- def test_method_name_suggestion_works_in_ractor
- error = Ractor.new {
- begin
- self.to__s
- rescue NoMethodError => e
- e.corrections # It is important to call the #corrections method within Ractor.
- e
- end
- }.take
-
- assert_correction :to_s, error.corrections
- assert_match "Did you mean? to_s", error.to_s
- end
-
- if defined?(::NoMatchingPatternKeyError)
- def test_pattern_key_name_suggestion_works_in_ractor
- error = Ractor.new {
- begin
- eval(<<~RUBY, binding, __FILE__, __LINE__)
- hash = {foo: 1, bar: 2, baz: 3}
- hash => {fooo:}
- fooo = 1 # suppress "unused variable: fooo" warning
- RUBY
- rescue NoMatchingPatternKeyError => e
- e.corrections # It is important to call the #corrections method within Ractor.
- e
- end
- }.take
-
- assert_correction ":foo", error.corrections
- assert_match "Did you mean? :foo", error.to_s
- end
- end
-
- def test_can_raise_other_name_error_in_ractor
- error = Ractor.new {
- begin
- raise FirstNameError, "Other name error"
- rescue FirstNameError => e
- e.corrections # It is important to call the #corrections method within Ractor.
- e
- end
- }.take
-
- assert_not_match(/Did you mean\?/, error.message)
- end
-
- def test_variable_name_suggestion_works_in_ractor
- error = Ractor.new {
- in_ractor = in_ractor = 1
-
- begin
- in_reactor
- rescue NameError => e
- e.corrections # It is important to call the #corrections method within Ractor.
- e
- end
- }.take
-
- assert_correction :in_ractor, error.corrections
- assert_match "Did you mean? in_ractor", error.to_s
- end
-end