diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index ad2e14587..1b579c0fc 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -12,6 +12,7 @@ jobs: strategy: matrix: container_tag: + - master-nightly-focal - 3.0-focal - 2.7-bionic job: @@ -26,12 +27,18 @@ jobs: run: | apt-get update apt-get install -y libdb-dev - - name: Install + - name: Install bundler run: | ruby -v gem install bundler + - name: bundle config set with + run: | + echo "NO_MINITEST=true" >> $GITHUB_ENV + bundle config set --local without 'minitest' + if: "contains(matrix.container_tag, 'master-nightly')" + - name: bin/setup + run: | bin/setup - name: Run test run: | bundle exec rake ${{ matrix.job }} - if: "!(matrix.job == 'stdlib_test' && contains(matrix.container_tag, '2.6'))" diff --git a/Gemfile b/Gemfile index 7bd0776ff..7f6332df2 100644 --- a/Gemfile +++ b/Gemfile @@ -5,12 +5,12 @@ gemspec # Development dependencies gem "rake" -gem "minitest" +gem "test-unit" +gem "test-unit-rr" gem "rspec" gem "racc" gem "rubocop" gem "rubocop-rubycw" -gem "minitest-reporters" gem "json" gem "json-schema" gem 'stackprof' @@ -23,3 +23,7 @@ gem "rbs-amber", path: "test/assets/test-gem" group :ide, optional: true do gem "ruby-debug-ide" end + +group :minitest do + gem "minitest" +end diff --git a/Rakefile b/Rakefile index 65d9429e9..c8ddbae16 100644 --- a/Rakefile +++ b/Rakefile @@ -115,7 +115,7 @@ namespace :generate do require_relative "test_helper" <%- unless class_methods.empty? -%> - class <%= klass %>SingletonTest < Minitest::Test + class <%= klass %>SingletonTest < Test::Unit::TestCase include TypeAssertions # library "pathname", "set", "securerandom" # Declare library signatures to load @@ -133,7 +133,7 @@ namespace :generate do <%- end -%> <%- unless instance_methods.empty? -%> - class <%= klass %>Test < Minitest::Test + class <%= klass %>Test < Test::Unit::TestCase include TypeAssertions # library "pathname", "set", "securerandom" # Declare library signatures to load diff --git a/bin/test_runner.rb b/bin/test_runner.rb index 273b99b5e..78ae4b97f 100755 --- a/bin/test_runner.rb +++ b/bin/test_runner.rb @@ -4,13 +4,12 @@ require "set" -IS_RUBY_27 = Gem::Version.new(RUBY_VERSION).yield_self do |ruby_version| - Gem::Version.new('2.7.0') <= ruby_version && - ruby_version <= Gem::Version.new('2.8.0') +IS_LATEST_RUBY = Gem::Version.new(RUBY_VERSION).yield_self do |ruby_version| + Gem::Version.new('3.0.0') <= ruby_version && ruby_version < Gem::Version.new('3.1.0') end -unless IS_RUBY_27 - STDERR.puts "⚠️⚠️⚠️⚠️ stdlib test assumes Ruby 2.7 but RUBY_VERSION==#{RUBY_VERSION} ⚠️⚠️⚠️⚠️" +unless IS_LATEST_RUBY + STDERR.puts "⚠️⚠️⚠️⚠️ stdlib test assumes Ruby 3.0 but RUBY_VERSION==#{RUBY_VERSION} ⚠️⚠️⚠️⚠️" end KNOWN_FAILS = %w(dbm).map do |lib| diff --git a/goodcheck.yml b/goodcheck.yml index 51c8c61d7..0ae77471e 100644 --- a/goodcheck.yml +++ b/goodcheck.yml @@ -71,7 +71,7 @@ rules: end pass: - | - class IntegerTest < Minitest::Test + class IntegerTest < Test::Unit::TestCase include TypeAssertions testing "Integer" diff --git a/lib/rbs/test/setup_helper.rb b/lib/rbs/test/setup_helper.rb index fd5edcabc..ed3c8ee03 100644 --- a/lib/rbs/test/setup_helper.rb +++ b/lib/rbs/test/setup_helper.rb @@ -38,7 +38,6 @@ def to_double_class(double_suite) nil end end - end end end diff --git a/test/assets/test1/hello.rb b/test/assets/test1/hello.rb index e6d5f8a3f..7e1e8c0c9 100644 --- a/test/assets/test1/hello.rb +++ b/test/assets/test1/hello.rb @@ -39,7 +39,7 @@ def initialize(name:, email:) end end -class Kaigi::ConferenceTest < Minitest::Test +class Kaigi::ConferenceTest < Test::Unit::TestCase def test_1 conference = Kaigi::Conference.new diff --git a/test/rbs/ancestor_builder_test.rb b/test/rbs/ancestor_builder_test.rb index 6510ee18f..59a8eb9f8 100644 --- a/test/rbs/ancestor_builder_test.rb +++ b/test/rbs/ancestor_builder_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class RBS::AncestorBuilderTest < Minitest::Test +class RBS::AncestorBuilderTest < Test::Unit::TestCase include TestHelper AST = RBS::AST diff --git a/test/rbs/buffer_test.rb b/test/rbs/buffer_test.rb index a3c6d4cf5..58a36b5f7 100644 --- a/test/rbs/buffer_test.rb +++ b/test/rbs/buffer_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class RBS::BufferTest < Minitest::Test +class RBS::BufferTest < Test::Unit::TestCase Buffer = RBS::Buffer def test_buffer diff --git a/test/rbs/cli_test.rb b/test/rbs/cli_test.rb index fb09c4be8..daa7ac7a0 100644 --- a/test/rbs/cli_test.rb +++ b/test/rbs/cli_test.rb @@ -2,7 +2,7 @@ require "stringio" require "rbs/cli" -class RBS::CliTest < Minitest::Test +class RBS::CliTest < Test::Unit::TestCase include TestHelper CLI = RBS::CLI @@ -208,7 +208,7 @@ def test_paths end def test_paths_with_gem - skip unless has_gem?("rbs-amber") + omit unless has_gem?("rbs-amber") with_cli do |cli| cli.run(%w(-r rbs-amber paths)) @@ -223,14 +223,14 @@ def test_vendor with_cli do |cli| cli.run(%w(vendor --vendor-dir=dir1)) - assert_operator Pathname(d) + "dir1/core", :directory? + assert_predicate Pathname(d) + "dir1/core", :directory? end end end end def test_vendor_gem - skip unless has_gem?("rbs-amber") + omit unless has_gem?("rbs-amber") Dir.mktmpdir do |d| Dir.chdir(d) do diff --git a/test/rbs/comment_test.rb b/test/rbs/comment_test.rb index 0433f3f15..bb37dd408 100644 --- a/test/rbs/comment_test.rb +++ b/test/rbs/comment_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class RBS::CommentTest < Minitest::Test +class RBS::CommentTest < Test::Unit::TestCase include TestHelper def test_concat diff --git a/test/rbs/constant_table_test.rb b/test/rbs/constant_table_test.rb index 47242e35e..a9e6692a0 100644 --- a/test/rbs/constant_table_test.rb +++ b/test/rbs/constant_table_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class RBS::ConstantTableTest < Minitest::Test +class RBS::ConstantTableTest < Test::Unit::TestCase include TestHelper ConstantTable = RBS::ConstantTable diff --git a/test/rbs/definition_builder_test.rb b/test/rbs/definition_builder_test.rb index 8ad678571..b86faf27d 100644 --- a/test/rbs/definition_builder_test.rb +++ b/test/rbs/definition_builder_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class RBS::DefinitionBuilderTest < Minitest::Test +class RBS::DefinitionBuilderTest < Test::Unit::TestCase include TestHelper AST = RBS::AST diff --git a/test/rbs/environment_loader_test.rb b/test/rbs/environment_loader_test.rb index b8372967c..cdc83a7de 100644 --- a/test/rbs/environment_loader_test.rb +++ b/test/rbs/environment_loader_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class RBS::EnvironmentLoaderTest < Minitest::Test +class RBS::EnvironmentLoaderTest < Test::Unit::TestCase include TestHelper Environment = RBS::Environment @@ -133,7 +133,7 @@ def test_loading_twice end def test_loading_from_gem - skip unless has_gem?("rbs-amber") + omit unless has_gem?("rbs-amber") mktmpdir do |path| repo = RBS::Repository.new() @@ -149,7 +149,7 @@ def test_loading_from_gem end def test_loading_from_gem_without_rbs - skip unless has_gem?("minitest") + omit if skip_minitest? mktmpdir do |path| repo = RBS::Repository.new() diff --git a/test/rbs/environment_test.rb b/test/rbs/environment_test.rb index 62cef6039..a68212461 100644 --- a/test/rbs/environment_test.rb +++ b/test/rbs/environment_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class RBS::EnvironmentTest < Minitest::Test +class RBS::EnvironmentTest < Test::Unit::TestCase include TestHelper Environment = RBS::Environment diff --git a/test/rbs/environment_walker_test.rb b/test/rbs/environment_walker_test.rb index 6a4003cb5..096dbdbf0 100644 --- a/test/rbs/environment_walker_test.rb +++ b/test/rbs/environment_walker_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class RBS::EnvironmentWalkerTest < Minitest::Test +class RBS::EnvironmentWalkerTest < Test::Unit::TestCase include TestHelper Environment = RBS::Environment diff --git a/test/rbs/factory_test.rb b/test/rbs/factory_test.rb index 000444b7d..e67acfa89 100644 --- a/test/rbs/factory_test.rb +++ b/test/rbs/factory_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class RBS::FactoryTest < Minitest::Test +class RBS::FactoryTest < Test::Unit::TestCase include TestHelper def test_type_name diff --git a/test/rbs/location_test.rb b/test/rbs/location_test.rb index f314d1bfd..ae395879c 100644 --- a/test/rbs/location_test.rb +++ b/test/rbs/location_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class RBS::LocationTest < Minitest::Test +class RBS::LocationTest < Test::Unit::TestCase Buffer = RBS::Buffer Location = RBS::Location diff --git a/test/rbs/method_builder_test.rb b/test/rbs/method_builder_test.rb index af5382580..12cfd32f2 100644 --- a/test/rbs/method_builder_test.rb +++ b/test/rbs/method_builder_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class RBS::MethodBuilderTest < Minitest::Test +class RBS::MethodBuilderTest < Test::Unit::TestCase include TestHelper AST = RBS::AST diff --git a/test/rbs/method_type_parsing_test.rb b/test/rbs/method_type_parsing_test.rb index fa6fe897e..eef39a850 100644 --- a/test/rbs/method_type_parsing_test.rb +++ b/test/rbs/method_type_parsing_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class RBS::MethodTypeParsingTest < Minitest::Test +class RBS::MethodTypeParsingTest < Test::Unit::TestCase Parser = RBS::Parser Buffer = RBS::Buffer Types = RBS::Types diff --git a/test/rbs/rb_prototype_test.rb b/test/rbs/rb_prototype_test.rb index 602090576..b978f3acb 100644 --- a/test/rbs/rb_prototype_test.rb +++ b/test/rbs/rb_prototype_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class RBS::RbPrototypeTest < Minitest::Test +class RBS::RbPrototypeTest < Test::Unit::TestCase RB = RBS::Prototype::RB include TestHelper diff --git a/test/rbs/rbi_prototype_test.rb b/test/rbs/rbi_prototype_test.rb index f9b43cc52..d5c2e62bf 100644 --- a/test/rbs/rbi_prototype_test.rb +++ b/test/rbs/rbi_prototype_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class RBS::RbiPrototypeTest < Minitest::Test +class RBS::RbiPrototypeTest < Test::Unit::TestCase RBI = RBS::Prototype::RBI include TestHelper diff --git a/test/rbs/repository_test.rb b/test/rbs/repository_test.rb index 477177012..664c473dc 100644 --- a/test/rbs/repository_test.rb +++ b/test/rbs/repository_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class RBS::RepositoryTest < Minitest::Test +class RBS::RepositoryTest < Test::Unit::TestCase Repository = RBS::Repository def dir diff --git a/test/rbs/runtime_prototype_test.rb b/test/rbs/runtime_prototype_test.rb index 641ebf067..e3501bffb 100644 --- a/test/rbs/runtime_prototype_test.rb +++ b/test/rbs/runtime_prototype_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class RBS::RuntimePrototypeTest < Minitest::Test +class RBS::RuntimePrototypeTest < Test::Unit::TestCase Runtime = RBS::Prototype::Runtime DefinitionBuilder = RBS::DefinitionBuilder diff --git a/test/rbs/schema_test.rb b/test/rbs/schema_test.rb index 451b3d3cf..82480edf3 100644 --- a/test/rbs/schema_test.rb +++ b/test/rbs/schema_test.rb @@ -1,7 +1,7 @@ require "test_helper" require "json_validator" -class RBS::SchemaTest < Minitest::Test +class RBS::SchemaTest < Test::Unit::TestCase include TestHelper def test_location_schema diff --git a/test/rbs/signature_parsing_test.rb b/test/rbs/signature_parsing_test.rb index 18818ffca..0ce309039 100644 --- a/test/rbs/signature_parsing_test.rb +++ b/test/rbs/signature_parsing_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class RBS::SignatureParsingTest < Minitest::Test +class RBS::SignatureParsingTest < Test::Unit::TestCase Parser = RBS::Parser Buffer = RBS::Buffer Types = RBS::Types @@ -1079,12 +1079,12 @@ def to_i: () -> Integer EOF decls[0].members[0].tap do |member| assert_instance_of Members::MethodDefinition, member - assert_operator member, :overload? + assert_predicate member, :overload? end decls[0].members[1].tap do |member| assert_instance_of Members::MethodDefinition, member - refute_operator member, :overload? + refute_predicate member, :overload? end end end @@ -1098,7 +1098,7 @@ module Steep EOF decls[0].members[0].tap do |member| assert_instance_of Members::MethodDefinition, member - assert_operator member, :overload? + assert_predicate member, :overload? end end end diff --git a/test/rbs/test/hook_test.rb b/test/rbs/test/hook_test.rb index 29461781f..a783d0fbc 100644 --- a/test/rbs/test/hook_test.rb +++ b/test/rbs/test/hook_test.rb @@ -5,7 +5,7 @@ return unless Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.7.0') -class RBS::Test::HookTest < Minitest::Test +class RBS::Test::HookTest < Test::Unit::TestCase class Example def hello(x, y) raise "Aborting" if y == 0 @@ -54,7 +54,7 @@ def test_hook_operator traces[0].tap do |t| assert_instance_of RBS::Test::CallTrace, t assert_equal :+, t.method_name - assert_operator t.method_call, :return? + assert_predicate t.method_call, :return? assert_equal [30], t.method_call.arguments assert_equal :plus, t.method_call.return_value end @@ -79,7 +79,7 @@ def test_hook_no_block_no_exn traces[0].tap do |t| assert_instance_of RBS::Test::CallTrace, t assert_equal :hello, t.method_name - assert_operator t.method_call, :return? + assert_predicate t.method_call, :return? assert_equal [1,2], t.method_call.arguments assert_equal 3, t.method_call.return_value end @@ -107,7 +107,7 @@ def test_hook_no_block_exn assert_instance_of RBS::Test::CallTrace, t assert_equal :hello, t.method_name assert_equal [1, 0], t.method_call.arguments - assert_operator t.method_call, :exception? + assert_predicate t.method_call, :exception? assert_instance_of RuntimeError, t.method_call.exception assert_equal "Aborting", t.method_call.exception.message end @@ -136,7 +136,7 @@ def test_hook_with_block assert_equal :world, t.method_name - assert_operator t.method_call, :return? + assert_predicate t.method_call, :return? assert_equal [1,2], t.method_call.arguments assert_equal :world, t.method_call.return_value @@ -205,10 +205,10 @@ def test_hook_singleton_method assert_equal :foo, t.method_name - assert_operator t.method_call, :return? + assert_predicate t.method_call, :return? assert_equal [{ x: "x", hello: :world }], t.method_call.arguments assert_equal "x", t.method_call.return_value - assert_operator t, :block_given + assert_predicate t, :block_given assert_empty t.block_calls end end diff --git a/test/rbs/test/runtime_test_test.rb b/test/rbs/test/runtime_test_test.rb index 0ad54f39e..616adb071 100644 --- a/test/rbs/test/runtime_test_test.rb +++ b/test/rbs/test/runtime_test_test.rb @@ -4,13 +4,13 @@ return unless Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.7.0') -class RBS::Test::RuntimeTestTest < Minitest::Test +class RBS::Test::RuntimeTestTest < Test::Unit::TestCase include TestHelper def test_runtime_success output = assert_test_success() assert_match "Setting up hooks for ::Hello", output - refute_match "No type checker was installed!", output + refute_match /#{Regexp.escape("No type checker was installed!")}/, output end def test_runtime_test_with_sample_size @@ -100,8 +100,8 @@ def test_test_target def test_no_test_install output = assert_test_success(other_env: { "RBS_TEST_TARGET" => "NO_SUCH_CLASS" }) - refute_match "Setting up hooks for ::Hello", output - assert_match "No type checker was installed!", output + refute_match /#{Regexp.escape("Setting up hooks for ::Hello")}/, output + assert_match /#{Regexp.escape("No type checker was installed!")}/, output end def test_name_override @@ -136,7 +136,7 @@ def world: () -> void end def test_minitest - skip unless has_gem?("minitest") + omit if skip_minitest? assert_test_success(other_env: { 'RBS_TEST_TARGET' => 'Foo', 'RBS_TEST_DOUBLE_SUITE' => 'minitest' }, rbs_content: < 'Foo', "RBS_TEST_DOUBLE_SUITE" => 'rspec' }, rbs_content: < { double('foo') } -class RBS::Test::TypeCheckTest < Minitest::Test +class RBS::Test::TypeCheckTest < Test::Unit::TestCase include TestHelper include RBS @@ -392,9 +392,11 @@ def test_typecheck_args end def test_is_double - skip unless has_gem?("rspec") + omit unless has_gem?("rspec") + omit if skip_minitest? require "rspec/mocks/standalone" + require "minitest/mock" SignatureManager.new do |manager| manager.build do |env| diff --git a/test/rbs/type_name_resolver_test.rb b/test/rbs/type_name_resolver_test.rb index edd428a8e..b49fc6ec1 100644 --- a/test/rbs/type_name_resolver_test.rb +++ b/test/rbs/type_name_resolver_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class RBS::DefinitionBuilderTest < Minitest::Test +class RBS::DefinitionBuilderTest < Test::Unit::TestCase include TestHelper include RBS diff --git a/test/rbs/type_parsing_test.rb b/test/rbs/type_parsing_test.rb index f4170982a..d0dd51e26 100644 --- a/test/rbs/type_parsing_test.rb +++ b/test/rbs/type_parsing_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class RBS::TypeParsingTest < Minitest::Test +class RBS::TypeParsingTest < Test::Unit::TestCase include TestHelper Parser = RBS::Parser diff --git a/test/rbs/types_test.rb b/test/rbs/types_test.rb index f84d23f42..6f8f34409 100644 --- a/test/rbs/types_test.rb +++ b/test/rbs/types_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class RBS::TypesTest < Minitest::Test +class RBS::TypesTest < Test::Unit::TestCase Types = RBS::Types include TestHelper diff --git a/test/rbs/variance_calculator_test.rb b/test/rbs/variance_calculator_test.rb index bd8b8c83c..443a21b2c 100644 --- a/test/rbs/variance_calculator_test.rb +++ b/test/rbs/variance_calculator_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class RBS::VarianceCalculatorTest < Minitest::Test +class RBS::VarianceCalculatorTest < Test::Unit::TestCase include TestHelper DefinitionBuilder = RBS::DefinitionBuilder diff --git a/test/rbs/vendorer_test.rb b/test/rbs/vendorer_test.rb index 5e5686e8b..ae4dce4e6 100644 --- a/test/rbs/vendorer_test.rb +++ b/test/rbs/vendorer_test.rb @@ -1,7 +1,7 @@ require "test_helper" require "open3" -class RBS::VendorerTest < Minitest::Test +class RBS::VendorerTest < Test::Unit::TestCase include TestHelper Environment = RBS::Environment diff --git a/test/rbs/writer_test.rb b/test/rbs/writer_test.rb index d59fb9627..3b6b80993 100644 --- a/test/rbs/writer_test.rb +++ b/test/rbs/writer_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class RBS::WriterTest < Minitest::Test +class RBS::WriterTest < Test::Unit::TestCase include TestHelper Parser = RBS::Parser diff --git a/test/stdlib/Array_test.rb b/test/stdlib/Array_test.rb index 824a63aa6..006711c3e 100644 --- a/test/stdlib/Array_test.rb +++ b/test/stdlib/Array_test.rb @@ -1,6 +1,6 @@ require_relative "test_helper" -class ArraySingletonTest < Minitest::Test +class ArraySingletonTest < Test::Unit::TestCase include TypeAssertions testing "singleton(::Array)" @@ -35,7 +35,7 @@ def test_try_connvert end end -class ArrayInstanceTest < Minitest::Test +class ArrayInstanceTest < Test::Unit::TestCase include TypeAssertions testing "::Array[::Integer]" diff --git a/test/stdlib/BigDecimal_test.rb b/test/stdlib/BigDecimal_test.rb index 28be6d877..01d817188 100644 --- a/test/stdlib/BigDecimal_test.rb +++ b/test/stdlib/BigDecimal_test.rb @@ -1,7 +1,7 @@ require_relative "test_helper" require "bigdecimal" -class BigDecimalSingletonTest < Minitest::Test +class BigDecimalSingletonTest < Test::Unit::TestCase include TypeAssertions library "bigdecimal" testing "singleton(::BigDecimal)" @@ -53,7 +53,7 @@ def test_save_rounding_mode end end -class BigDecimalTest < Minitest::Test +class BigDecimalTest < Test::Unit::TestCase include TypeAssertions library "bigdecimal" testing "::BigDecimal" diff --git a/test/stdlib/BigMath_test.rb b/test/stdlib/BigMath_test.rb index 3b30854be..fe5e67735 100644 --- a/test/stdlib/BigMath_test.rb +++ b/test/stdlib/BigMath_test.rb @@ -2,7 +2,7 @@ require "bigdecimal" require "bigdecimal/math" -class BigMathSingletonTest < Minitest::Test +class BigMathSingletonTest < Test::Unit::TestCase include TypeAssertions library "bigdecimal", "bigdecimal-math" testing "singleton(::BigMath)" @@ -48,7 +48,7 @@ def test_sqrt end end -class BigMathTest < Minitest::Test +class BigMathTest < Test::Unit::TestCase include TypeAssertions library "bigdecimal", "bigdecimal-math" testing "::BigMath" diff --git a/test/stdlib/Comparable_test.rb b/test/stdlib/Comparable_test.rb index 45fc2c972..b3dc796d2 100644 --- a/test/stdlib/Comparable_test.rb +++ b/test/stdlib/Comparable_test.rb @@ -1,6 +1,6 @@ require_relative "test_helper" -class ComparableTest < Minitest::Test +class ComparableTest < Test::Unit::TestCase include TypeAssertions class Test diff --git a/test/stdlib/DBM_test.rb b/test/stdlib/DBM_test.rb index c7bc42aed..a323b07f1 100644 --- a/test/stdlib/DBM_test.rb +++ b/test/stdlib/DBM_test.rb @@ -1,7 +1,7 @@ require_relative "test_helper" require "dbm" -class DBMSingletonTest < Minitest::Test +class DBMSingletonTest < Test::Unit::TestCase include TypeAssertions library "dbm" testing "singleton(::DBM)" @@ -18,7 +18,7 @@ def test_open end end -class DBMTest < Minitest::Test +class DBMTest < Test::Unit::TestCase include TypeAssertions library "dbm" testing "::DBM" diff --git a/test/stdlib/DateTime_test.rb b/test/stdlib/DateTime_test.rb index d1e973c56..129800441 100644 --- a/test/stdlib/DateTime_test.rb +++ b/test/stdlib/DateTime_test.rb @@ -1,7 +1,7 @@ require_relative "test_helper" require "date" -class DateTimeSingletonTest < Minitest::Test +class DateTimeSingletonTest < Test::Unit::TestCase include TypeAssertions library "date" @@ -190,7 +190,7 @@ def test_now end end -class DateTimeTest < Minitest::Test +class DateTimeTest < Test::Unit::TestCase include TypeAssertions library "date" diff --git a/test/stdlib/Date_test.rb b/test/stdlib/Date_test.rb index f1fa9dca2..934b41a67 100644 --- a/test/stdlib/Date_test.rb +++ b/test/stdlib/Date_test.rb @@ -1,7 +1,7 @@ require_relative "test_helper" require "date" -class DateSingletonTest < Minitest::Test +class DateSingletonTest < Test::Unit::TestCase include TypeAssertions library "date" @@ -238,7 +238,7 @@ def test_xmlschema end end -class DateTest < Minitest::Test +class DateTest < Test::Unit::TestCase include TypeAssertions library "date" diff --git a/test/stdlib/Dir_test.rb b/test/stdlib/Dir_test.rb index 900c1d338..6eb6229af 100644 --- a/test/stdlib/Dir_test.rb +++ b/test/stdlib/Dir_test.rb @@ -1,6 +1,6 @@ require_relative "test_helper" -class DirSingletonTest < Minitest::Test +class DirSingletonTest < Test::Unit::TestCase include TypeAssertions testing "singleton(::Dir)" @@ -158,7 +158,7 @@ def test_pwd end end -class DirInstanceTest < Minitest::Test +class DirInstanceTest < Test::Unit::TestCase include TypeAssertions testing "::Dir" diff --git a/test/stdlib/Enumerable_test.rb b/test/stdlib/Enumerable_test.rb index 10cf0c009..96e2862c2 100644 --- a/test/stdlib/Enumerable_test.rb +++ b/test/stdlib/Enumerable_test.rb @@ -120,7 +120,7 @@ def each end end -class EnumerableTest2 < Minitest::Test +class EnumerableTest2 < Test::Unit::TestCase include TypeAssertions class TestEnumerable diff --git a/test/stdlib/Enumerator_test.rb b/test/stdlib/Enumerator_test.rb index f3d1695e8..0d407fa0b 100644 --- a/test/stdlib/Enumerator_test.rb +++ b/test/stdlib/Enumerator_test.rb @@ -1,6 +1,6 @@ require_relative "test_helper" -class EnumeratorTest < Minitest::Test +class EnumeratorTest < Test::Unit::TestCase include TypeAssertions testing "::Enumerator[::Integer, Array[::Integer]]" @@ -14,7 +14,7 @@ def test_map end end -class EnumeratorYielderTest < Minitest::Test +class EnumeratorYielderTest < Test::Unit::TestCase include TypeAssertions testing "::Enumerator::Yielder" diff --git a/test/stdlib/Fiber_test.rb b/test/stdlib/Fiber_test.rb index b2e8e3d83..e038816f4 100644 --- a/test/stdlib/Fiber_test.rb +++ b/test/stdlib/Fiber_test.rb @@ -1,6 +1,6 @@ require_relative "test_helper" -class FiberSingletonTest < Minitest::Test +class FiberSingletonTest < Test::Unit::TestCase include TypeAssertions testing "singleton(::Fiber)" @@ -28,7 +28,7 @@ def test_yield end end -class FiberTest < Minitest::Test +class FiberTest < Test::Unit::TestCase include TypeAssertions testing "::Fiber" @@ -73,7 +73,7 @@ def test_raise require 'fiber' -class FiberSingletonExtTest < Minitest::Test +class FiberSingletonExtTest < Test::Unit::TestCase include TypeAssertions library 'fiber' @@ -85,7 +85,7 @@ def test_current end end -class FiberExtTest < Minitest::Test +class FiberExtTest < Test::Unit::TestCase include TypeAssertions library 'fiber' diff --git a/test/stdlib/File_test.rb b/test/stdlib/File_test.rb index 7c788e6ba..b4e886d38 100644 --- a/test/stdlib/File_test.rb +++ b/test/stdlib/File_test.rb @@ -1,7 +1,7 @@ require_relative "test_helper" require "socket" -class FileSingletonTest < Minitest::Test +class FileSingletonTest < Test::Unit::TestCase include TypeAssertions testing "singleton(::File)" @@ -831,7 +831,7 @@ def test_zero? end end -class FileInstanceTest < Minitest::Test +class FileInstanceTest < Test::Unit::TestCase include TypeAssertions testing "::File" diff --git a/test/stdlib/Forwardable_test.rb b/test/stdlib/Forwardable_test.rb index 861b2e625..a25422ef1 100644 --- a/test/stdlib/Forwardable_test.rb +++ b/test/stdlib/Forwardable_test.rb @@ -1,7 +1,7 @@ require_relative "test_helper" require "forwardable" -class ForwardableTest < Minitest::Test +class ForwardableTest < Test::Unit::TestCase include TypeAssertions library "forwardable" @@ -64,7 +64,7 @@ def test_def_delegator end end -class SingleForwardableTest < Minitest::Test +class SingleForwardableTest < Test::Unit::TestCase include TypeAssertions library "forwardable" diff --git a/test/stdlib/IO_test.rb b/test/stdlib/IO_test.rb index 49474bfc7..747bdb233 100644 --- a/test/stdlib/IO_test.rb +++ b/test/stdlib/IO_test.rb @@ -1,6 +1,6 @@ require_relative "test_helper" -class IOSingletonTest < Minitest::Test +class IOSingletonTest < Test::Unit::TestCase include TypeAssertions testing "singleton(::IO)" @@ -87,7 +87,7 @@ def test_copy_stream end end -class IOInstanceTest < Minitest::Test +class IOInstanceTest < Test::Unit::TestCase include TypeAssertions testing "::IO" diff --git a/test/stdlib/Logger_test.rb b/test/stdlib/Logger_test.rb index d81d30baf..f144586a8 100644 --- a/test/stdlib/Logger_test.rb +++ b/test/stdlib/Logger_test.rb @@ -3,7 +3,7 @@ require 'logger' require 'stringio' -class LoggerSingletonTest < Minitest::Test +class LoggerSingletonTest < Test::Unit::TestCase include TypeAssertions library 'logger' @@ -27,7 +27,7 @@ def test_new end end -class LoggerTest < Minitest::Test +class LoggerTest < Test::Unit::TestCase include TypeAssertions library 'logger' diff --git a/test/stdlib/Module_test.rb b/test/stdlib/Module_test.rb index 7d477f0bd..4585f22c3 100644 --- a/test/stdlib/Module_test.rb +++ b/test/stdlib/Module_test.rb @@ -1,6 +1,6 @@ require_relative "test_helper" -class ModuleSingletonTest < Minitest::Test +class ModuleSingletonTest < Test::Unit::TestCase include TypeAssertions testing "singleton(::Module)" @@ -11,7 +11,7 @@ def test_used_modules end end -class ModuleInstanceTest < Minitest::Test +class ModuleInstanceTest < Test::Unit::TestCase include TypeAssertions testing "::Module" diff --git a/test/stdlib/Monitor_test.rb b/test/stdlib/Monitor_test.rb index fc4208fc9..c6ecdc132 100644 --- a/test/stdlib/Monitor_test.rb +++ b/test/stdlib/Monitor_test.rb @@ -1,7 +1,7 @@ require_relative "test_helper" require 'monitor' -class MonitorInstanceTest < Minitest::Test +class MonitorInstanceTest < Test::Unit::TestCase include TypeAssertions library 'monitor' @@ -38,7 +38,7 @@ def test_try_enter end end -class MonitorMixinInstanceTest < Minitest::Test +class MonitorMixinInstanceTest < Test::Unit::TestCase include TypeAssertions library 'monitor' @@ -92,7 +92,7 @@ def test_new_cond end end -class MonitorMixinConditionVariableInstanceTest < Minitest::Test +class MonitorMixinConditionVariableInstanceTest < Test::Unit::TestCase include TypeAssertions library 'monitor' diff --git a/test/stdlib/Mutex_m_test.rb b/test/stdlib/Mutex_m_test.rb index 7a5710da0..9826f6f87 100644 --- a/test/stdlib/Mutex_m_test.rb +++ b/test/stdlib/Mutex_m_test.rb @@ -1,7 +1,7 @@ require_relative "test_helper" require 'mutex_m' -class Mutex_mInstanceTest < Minitest::Test +class Mutex_mInstanceTest < Test::Unit::TestCase include TypeAssertions library 'mutex_m' diff --git a/test/stdlib/ObjectSpace_test.rb b/test/stdlib/ObjectSpace_test.rb index 0e76457b9..7f5738783 100644 --- a/test/stdlib/ObjectSpace_test.rb +++ b/test/stdlib/ObjectSpace_test.rb @@ -1,6 +1,6 @@ require_relative "test_helper" -class ObjectSpaceTest < Minitest::Test +class ObjectSpaceTest < Test::Unit::TestCase include TypeAssertions testing "singleton(::ObjectSpace)" diff --git a/test/stdlib/PStore_test.rb b/test/stdlib/PStore_test.rb index dcf651b75..fe43c7139 100644 --- a/test/stdlib/PStore_test.rb +++ b/test/stdlib/PStore_test.rb @@ -1,7 +1,7 @@ require_relative "test_helper" require "pstore" -class PStoreSingletonTest < Minitest::Test +class PStoreSingletonTest < Test::Unit::TestCase include TypeAssertions library "pstore" testing "singleton(::PStore)" diff --git a/test/stdlib/PTY_test.rb b/test/stdlib/PTY_test.rb index 9a6af143f..942584465 100644 --- a/test/stdlib/PTY_test.rb +++ b/test/stdlib/PTY_test.rb @@ -1,7 +1,7 @@ require_relative "test_helper" require "pty" -class PTYSingletonTest < Minitest::Test +class PTYSingletonTest < Test::Unit::TestCase include TypeAssertions library "pty" diff --git a/test/stdlib/Pathname_test.rb b/test/stdlib/Pathname_test.rb index 3ef9d0631..6ea0cd6a2 100644 --- a/test/stdlib/Pathname_test.rb +++ b/test/stdlib/Pathname_test.rb @@ -1,7 +1,7 @@ require_relative "test_helper" require 'pathname' -class PathnameSingletonTest < Minitest::Test +class PathnameSingletonTest < Test::Unit::TestCase include TypeAssertions library 'pathname' testing 'singleton(::Pathname)' @@ -37,7 +37,7 @@ def test_initialize end end -class PathnameInstanceTest < Minitest::Test +class PathnameInstanceTest < Test::Unit::TestCase include TypeAssertions library 'pathname' testing '::Pathname' diff --git a/test/stdlib/String_test.rb b/test/stdlib/String_test.rb index eea0f8e2d..c7fa6e1b8 100644 --- a/test/stdlib/String_test.rb +++ b/test/stdlib/String_test.rb @@ -1,6 +1,6 @@ require_relative "test_helper" -class StringSingletonTest < Minitest::Test +class StringSingletonTest < Test::Unit::TestCase include TypeAssertions testing "singleton(::String)" @@ -34,7 +34,7 @@ def test_try_convert end end -class StringInstanceTest < Minitest::Test +class StringInstanceTest < Test::Unit::TestCase include TypeAssertions testing "::String" diff --git a/test/stdlib/Symbol_test.rb b/test/stdlib/Symbol_test.rb index d98029970..5003a99fe 100644 --- a/test/stdlib/Symbol_test.rb +++ b/test/stdlib/Symbol_test.rb @@ -1,6 +1,6 @@ require_relative "test_helper" -class SymbolSingletonTest < Minitest::Test +class SymbolSingletonTest < Test::Unit::TestCase include TypeAssertions testing "singleton(::Symbol)" @@ -11,7 +11,7 @@ def test_all_symbols end end -class SymbolInstanceTest < Minitest::Test +class SymbolInstanceTest < Test::Unit::TestCase include TypeAssertions testing "::Symbol" diff --git a/test/stdlib/TSort_test.rb b/test/stdlib/TSort_test.rb index 728782b23..5c18a9c10 100644 --- a/test/stdlib/TSort_test.rb +++ b/test/stdlib/TSort_test.rb @@ -2,7 +2,7 @@ require "tsort" -class TSortSingletonTest < Minitest::Test +class TSortSingletonTest < Test::Unit::TestCase include TypeAssertions library 'tsort' @@ -79,7 +79,7 @@ def test_tsort_each end end -class TSortInstanceTest < Minitest::Test +class TSortInstanceTest < Test::Unit::TestCase include TypeAssertions library 'tsort' diff --git a/test/stdlib/TimeExtension_test.rb b/test/stdlib/TimeExtension_test.rb index 49123ce0f..29139096e 100644 --- a/test/stdlib/TimeExtension_test.rb +++ b/test/stdlib/TimeExtension_test.rb @@ -1,7 +1,7 @@ require_relative "test_helper" require "time" -class TimeExtensionSingletonTest < Minitest::Test +class TimeExtensionSingletonTest < Test::Unit::TestCase include TypeAssertions library "time" @@ -82,7 +82,7 @@ def test_iso8601 end end -class TimeExtensionInstanceTest < Minitest::Test +class TimeExtensionInstanceTest < Test::Unit::TestCase include TypeAssertions library "time" diff --git a/test/stdlib/URI_test.rb b/test/stdlib/URI_test.rb index 86335d37b..e8c70024a 100644 --- a/test/stdlib/URI_test.rb +++ b/test/stdlib/URI_test.rb @@ -1,7 +1,7 @@ require_relative "test_helper" require "uri" -class URISingletonTest < Minitest::Test +class URISingletonTest < Test::Unit::TestCase include TypeAssertions library "uri" diff --git a/test/stdlib/Zlib_test.rb b/test/stdlib/Zlib_test.rb index 428ad3540..0484b49e0 100644 --- a/test/stdlib/Zlib_test.rb +++ b/test/stdlib/Zlib_test.rb @@ -1,7 +1,7 @@ require_relative "test_helper" require "zlib" -class ZlibSingletonTest < Minitest::Test +class ZlibSingletonTest < Test::Unit::TestCase include TypeAssertions library "zlib" diff --git a/test/stdlib/json/JSON_test.rb b/test/stdlib/json/JSON_test.rb index d55786918..20943da14 100644 --- a/test/stdlib/json/JSON_test.rb +++ b/test/stdlib/json/JSON_test.rb @@ -1,7 +1,7 @@ require_relative "../test_helper" require "json" -class JSONSingletonTest < Minitest::Test +class JSONSingletonTest < Test::Unit::TestCase include TypeAssertions library "json" @@ -153,7 +153,7 @@ def test_unparse end end -class JSONInstanceTest < Minitest::Test +class JSONInstanceTest < Test::Unit::TestCase include TypeAssertions class MyJSON diff --git a/test/stdlib/singleton_test.rb b/test/stdlib/singleton_test.rb index 8129fd207..55ecb411e 100644 --- a/test/stdlib/singleton_test.rb +++ b/test/stdlib/singleton_test.rb @@ -1,7 +1,7 @@ require_relative './test_helper' require 'singleton' -class SingletonSingletonTest < Minitest::Test +class SingletonSingletonTest < Test::Unit::TestCase include TypeAssertions library 'singleton' testing 'singleton(::Singleton)' diff --git a/test/stdlib/test_helper.rb b/test/stdlib/test_helper.rb index 508465fb5..80afed2c9 100644 --- a/test/stdlib/test_helper.rb +++ b/test/stdlib/test_helper.rb @@ -1,12 +1,9 @@ require "rbs" require "rbs/test" -require "minitest/autorun" - -begin - require 'minitest/reporters' - Minitest::Reporters.use! [Minitest::Reporters::DefaultReporter.new] -rescue LoadError -end +require "test/unit" +require "tmpdir" +require "stringio" +require "tempfile" module Spy def self.wrap(object, method_name) @@ -394,7 +391,7 @@ def [](str) end end -class StdlibTest < Minitest::Test +class StdlibTest < Test::Unit::TestCase RBS.logger_level = ENV["RBS_TEST_LOGLEVEL"] || "info" loader = RBS::EnvironmentLoader.new diff --git a/test/stdlib/uri/file_test.rb b/test/stdlib/uri/file_test.rb index 5e3710eb7..ec7fb3b4b 100644 --- a/test/stdlib/uri/file_test.rb +++ b/test/stdlib/uri/file_test.rb @@ -1,7 +1,7 @@ require_relative '../test_helper' require 'uri' -class URIFileSingletonTest < Minitest::Test +class URIFileSingletonTest < Test::Unit::TestCase include TypeAssertions library 'uri' testing 'singleton(::URI::File)' @@ -19,7 +19,7 @@ def test_build end end -class URIFileInstanceTest < Minitest::Test +class URIFileInstanceTest < Test::Unit::TestCase include TypeAssertions library 'uri' testing '::URI::File' diff --git a/test/stdlib/uri/generic_test.rb b/test/stdlib/uri/generic_test.rb index c3d156046..40b9c2981 100644 --- a/test/stdlib/uri/generic_test.rb +++ b/test/stdlib/uri/generic_test.rb @@ -1,7 +1,7 @@ require_relative '../test_helper' require 'uri' -class URIGenericSingletonTest < Minitest::Test +class URIGenericSingletonTest < Test::Unit::TestCase include TypeAssertions library 'uri' testing 'singleton(::URI::Generic)' @@ -82,7 +82,7 @@ def test_use_proxy? end end -class URIGenericInstanceTest < Minitest::Test +class URIGenericInstanceTest < Test::Unit::TestCase include TypeAssertions library 'uri' testing '::URI::Generic' diff --git a/test/stdlib/uri/http_test.rb b/test/stdlib/uri/http_test.rb index 091c045ce..4326e6a07 100644 --- a/test/stdlib/uri/http_test.rb +++ b/test/stdlib/uri/http_test.rb @@ -1,7 +1,7 @@ require_relative '../test_helper' require 'uri' -class URIHTTPSingletonTest < Minitest::Test +class URIHTTPSingletonTest < Test::Unit::TestCase include TypeAssertions library 'uri' testing 'singleton(::URI::HTTP)' @@ -31,7 +31,7 @@ def test_build end end -class URIHTTPInstanceTest < Minitest::Test +class URIHTTPInstanceTest < Test::Unit::TestCase include TypeAssertions library 'uri' testing '::URI::HTTP' diff --git a/test/stdlib/uri/ldap_test.rb b/test/stdlib/uri/ldap_test.rb index 4f069cfc0..42520a342 100644 --- a/test/stdlib/uri/ldap_test.rb +++ b/test/stdlib/uri/ldap_test.rb @@ -1,7 +1,7 @@ require_relative '../test_helper' require 'uri' -class URILDAPSingletonTest < Minitest::Test +class URILDAPSingletonTest < Test::Unit::TestCase include TypeAssertions library 'uri' testing 'singleton(::URI::LDAP)' @@ -45,7 +45,7 @@ def test_new end end -class URILDAPInstanceTest < Minitest::Test +class URILDAPInstanceTest < Test::Unit::TestCase include TypeAssertions library 'uri' testing '::URI::LDAP' diff --git a/test/test_helper.rb b/test/test_helper.rb index 41c2ee2cc..55bc999fe 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -3,12 +3,8 @@ require "tmpdir" require "stringio" require "open3" - -begin - require 'minitest/reporters' - Minitest::Reporters.use! [Minitest::Reporters::DefaultReporter.new] -rescue LoadError -end +require "test/unit" +require "test/unit/rr" begin require "amber" @@ -26,6 +22,10 @@ def has_gem?(*gems) false end + def skip_minitest? + ENV.key?("NO_MINITEST") + end + def parse_type(string, variables: Set.new) RBS::Parser.parse_type(string, variables: variables) end @@ -42,13 +42,13 @@ def type_name(string) end def silence_errors - RBS.logger.stub :error, nil do + stub(RBS.logger).error do yield end end def silence_warnings - RBS.logger.stub :warn, nil do + stub(RBS.logger).warn do yield end end @@ -173,7 +173,7 @@ def assert_any!(collection, size: nil) items.each do |item| begin yield item - rescue Minitest::Assertion + rescue Test::Unit::AssertionFailedError next else # Pass test @@ -205,5 +205,3 @@ def assert_sampling_check(builder, sample_size, array) assert_empty(sample - array) end end - -require "minitest/autorun" diff --git a/test/validator_test.rb b/test/validator_test.rb index b14682f72..6aeb5d175 100644 --- a/test/validator_test.rb +++ b/test/validator_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class ValidatorTest < Minitest::Test +class ValidatorTest < Test::Unit::TestCase include TestHelper Environment = RBS::Environment