diff --git a/test/cli_test.rb b/test/cli_test.rb index 201ab653c..62d23385a 100644 --- a/test/cli_test.rb +++ b/test/cli_test.rb @@ -46,7 +46,7 @@ def test_jobs_count stdout, status = sh(*steep, command, *args) assert_predicate status, :success?, stdout - assert_match /No type error detected\./, stdout + assert_match(/No type error detected\./, stdout) end end sub_test.call("check", %w(-j 1)) @@ -83,7 +83,7 @@ def test_steep_command_option end assert_predicate status, :success?, stdout - assert_match /No type error detected\./, stdout + assert_match(/No type error detected\./, stdout) end end @@ -102,7 +102,7 @@ def test_check_success stdout, status = sh(*steep, "check") assert_predicate status, :success?, stdout - assert_match /No type error detected\./, stdout + assert_match(/No type error detected\./, stdout) end end @@ -121,7 +121,7 @@ def test_check_failure stdout, status = sh(*steep, "check") refute_predicate status, :success?, stdout - assert_match /Detected 1 problem from 1 file/, stdout + assert_match(/Detected 1 problem from 1 file/, stdout) end end @@ -253,10 +253,10 @@ def test_check_failure_severity_level stdout, status = sh(*steep, "check", "--severity-level=warning") refute_predicate status, :success?, stdout - assert_match /Detected 1 problem from 1 file/, stdout + assert_match(/Detected 1 problem from 1 file/, stdout) - assert_match /Ruby::NoMethod/, stdout - refute_match /Ruby::UnresolvedOverloading/, stdout + assert_match(/Ruby::NoMethod/, stdout) + refute_match(/Ruby::UnresolvedOverloading/, stdout) end end @@ -274,11 +274,11 @@ def test_check_expectations_success stdout, status = sh(*steep, "check", "--save-expectation=foo.yml") assert_predicate status, :success? - assert_match /Saved expectations in foo\.yml\.\.\./, stdout + assert_match(/Saved expectations in foo\.yml\.\.\./, stdout) stdout, status = sh(*steep, "check", "--with-expectation=foo.yml") assert_predicate status, :success? - assert_match /Expectations satisfied:/, stdout + assert_match(/Expectations satisfied:/, stdout) end end @@ -299,7 +299,7 @@ def test_check_expectations_lineno_changed stdout, status = sh(*steep, "check", "--save-expectation=foo.yml") assert_predicate status, :success?, stdout - assert_match /Saved expectations in foo\.yml\.\.\./, stdout + assert_match(/Saved expectations in foo\.yml\.\.\./, stdout) (current_dir + "foo.rb").write(<<-EOF) 1 + "2" @@ -308,10 +308,10 @@ def test_check_expectations_lineno_changed stdout, status = sh(*steep, "check", "--with-expectation=foo.yml") refute_predicate status, :success?, stdout - assert_match /Expectations unsatisfied:/, stdout - assert_match /0 expected diagnostics/, stdout - assert_match /1 unexpected diagnostic/, stdout - assert_match /1 missing diagnostic/, stdout + assert_match(/Expectations unsatisfied:/, stdout) + assert_match(/0 expected diagnostics/, stdout) + assert_match(/1 unexpected diagnostic/, stdout) + assert_match(/1 missing diagnostic/, stdout) end end @@ -329,7 +329,7 @@ def test_check_expectations_fail stdout, status = sh(*steep, "check", "--save-expectation=foo.yml") assert_predicate status, :success?, stdout - assert_match /Saved expectations in foo\.yml\.\.\./, stdout + assert_match(/Saved expectations in foo\.yml\.\.\./, stdout) (current_dir + "foo.rb").write(<<-EOF) 1 + 2 @@ -338,10 +338,10 @@ def test_check_expectations_fail stdout, status = sh(*steep, "check", "--with-expectation=foo.yml") refute_predicate status, :success?, stdout - assert_match /Expectations unsatisfied:/, stdout - assert_match /0 expected diagnostics/, stdout - assert_match /0 unexpected diagnostics/, stdout - assert_match /1 missing diagnostic/, stdout + assert_match(/Expectations unsatisfied:/, stdout) + assert_match(/0 expected diagnostics/, stdout) + assert_match(/0 unexpected diagnostics/, stdout) + assert_match(/1 missing diagnostic/, stdout) end end @@ -363,7 +363,7 @@ def test_check_expectations_fail2 stdout, status = sh(*steep, "check", "--save-expectation") assert_predicate status, :success?, stdout - assert_match /Saved expectations in steep_expectations\.yml\.\.\./, stdout + assert_match(/Saved expectations in steep_expectations\.yml\.\.\./, stdout) (current_dir + "foo.rb").write(<<-EOF) 1 + 2 @@ -372,16 +372,16 @@ def test_check_expectations_fail2 stdout, status = sh(*steep, "check", "--with-expectation", "foo.rb") refute_predicate status, :success?, stdout - assert_match /Expectations unsatisfied:/, stdout - assert_match /0 expected diagnostics/, stdout - assert_match /0 unexpected diagnostics/, stdout - assert_match /1 missing diagnostic/, stdout + assert_match(/Expectations unsatisfied:/, stdout) + assert_match(/0 expected diagnostics/, stdout) + assert_match(/0 unexpected diagnostics/, stdout) + assert_match(/1 missing diagnostic/, stdout) stdout, status = sh(*steep, "check", "--with-expectation", "bar.rb") assert_predicate status, :success?, stdout - assert_match /Expectations satisfied:/, stdout - assert_match /1 expected diagnostic/, stdout + assert_match(/Expectations satisfied:/, stdout) + assert_match(/1 expected diagnostic/, stdout) end end @@ -420,7 +420,7 @@ def test_check_broken stdout, status = sh(*steep, "check") refute_predicate status, :success?, stdout - assert_match /Syntax error: cannot start a declaration, token=/, stdout.force_encoding(Encoding::ASCII_8BIT) + assert_match(/Syntax error: cannot start a declaration, token=/, stdout.force_encoding(Encoding::ASCII_8BIT)) end end @@ -448,9 +448,9 @@ def test_check_no_steepfile stdout, stderr, status = sh3(*steep, 'check') assert_predicate status, :success?, stdout - assert_match /current directory/, stderr - assert_match /steep init/, stderr - assert_match /No type error detected\./, stdout + assert_match(/current directory/, stderr) + assert_match(/steep init/, stderr) + assert_match(/No type error detected\./, stdout) end end @@ -788,14 +788,14 @@ def test_ci_jobs_setup_message ["check", "checkfile", "stats"].each do |command| _, stderr, status = sh3(*steep, command, "foo.rb") assert_predicate status, :success? - assert_match /CI environment is detected but no `--jobs` option is given./, stderr + assert_match(/CI environment is detected but no `--jobs` option is given./, stderr) end ["check", "checkfile", "stats"].each do |command| _, stderr, status = sh3(*steep, command, "--jobs=1", "foo.rb") assert_predicate status, :success? - refute_match /CI environment is detected but no `--jobs` option is given./, stderr + refute_match(/CI environment is detected but no `--jobs` option is given./, stderr) end end end diff --git a/test/driver_helper_test.rb b/test/driver_helper_test.rb index 71a882b29..4c54665e6 100644 --- a/test/driver_helper_test.rb +++ b/test/driver_helper_test.rb @@ -38,7 +38,7 @@ def test_load_config_successful__no_collection_file__no_configuration RUBY Test.new.load_config(path: path) - refute_match /rbs collection install/, Steep.log_output.string + refute_match(/rbs collection install/, Steep.log_output.string) end end @@ -52,7 +52,7 @@ def test_load_config_successful__collection_disabled RUBY Test.new.load_config(path: path) - refute_match /rbs collection install/, Steep.log_output.string + refute_match(/rbs collection install/, Steep.log_output.string) end end @@ -66,7 +66,7 @@ def test_load_config_error__collection_file_missing RUBY Test.new.load_config(path: path) - assert_match /rbs-collection configuration is missing/, Steep.log_output.string + assert_match(/rbs-collection configuration is missing/, Steep.log_output.string) end end @@ -81,7 +81,7 @@ def test_load_config_error__lock_file_missing current_dir.join("test.yaml").write("[]") Test.new.load_config(path: path) - assert_match /rbs collection install/, Steep.log_output.string + assert_match(/rbs collection install/, Steep.log_output.string) end end @@ -97,8 +97,8 @@ def test_load_config_error__lock_file_is_broken current_dir.join("test.lock.yaml").write("[") Test.new.load_config(path: path) - assert_match /rbs-collection setup is broken:/, Steep.log_output.string - assert_match /syntax error/, Steep.log_output.string + assert_match(/rbs-collection setup is broken:/, Steep.log_output.string) + assert_match(/syntax error/, Steep.log_output.string) end end @@ -138,7 +138,7 @@ def test_load_config__install_from_lockfile Test.new.load_config(path: path) - assert_match /Installing RBS files for collection: /, Steep.log_output.string + assert_match(/Installing RBS files for collection: /, Steep.log_output.string) end end @@ -180,7 +180,7 @@ def test_load_config__install_from_lockfile__disabled test.disable_install_collection = true test.load_config(path: path) - assert_match /rbs collection install/, Steep.log_output.string + assert_match(/rbs collection install/, Steep.log_output.string) end end @@ -221,7 +221,7 @@ def test_load_config__install_from_lockfile__failure test = Test.new test.load_config(path: path) - assert_match /Failed to set up RBS collection:/, Steep.log_output.string + assert_match(/Failed to set up RBS collection:/, Steep.log_output.string) end end end diff --git a/test/subtyping_test.rb b/test/subtyping_test.rb index 19c39e775..7873334c6 100644 --- a/test/subtyping_test.rb +++ b/test/subtyping_test.rb @@ -1064,7 +1064,7 @@ def f: (String) -> String assert_fail_check checker, "::_A", "::_C" do |result| assert_instance_of Failure::UnsatisfiedConstraints, result.error - assert_match /X\(\d+\)/, result.error.var.to_s + assert_match(/X\(\d+\)/, result.error.var.to_s) assert_equal parse_type("::String", checker: checker), result.error.sub_type assert_equal parse_type("::Numeric & ::String", checker: checker), result.error.super_type end diff --git a/test/type_construction_test.rb b/test/type_construction_test.rb index 75fcfd416..f33ab72b1 100644 --- a/test/type_construction_test.rb +++ b/test/type_construction_test.rb @@ -7049,7 +7049,7 @@ class Method assert_typing_error typing, size: 1 do |errors| assert_any!(errors) do |error| assert_instance_of Diagnostic::Ruby::BlockTypeMismatch, error - assert /^\^\(::Integer\) -> X\(\d+\)$/ =~ error.expected.to_s + assert (/^\^\(::Integer\) -> X\(\d+\)$/ =~ error.expected.to_s) assert_equal parse_type("^(::String) -> ::String"), error.actual end end