      @opt.parse!(%w"--enable-foo")
      assert_equal(true, @foo)
 diff --git a/test/optparse/test_bash_completion.rb b/test/optparse/test_bash_completion.rb
-index 513e986f66..0bb6023bc4 100644
+index 513e986f66..8f6ff6f93a 100644
 --- a/test/optparse/test_bash_completion.rb
 +++ b/test/optparse/test_bash_completion.rb
-@@ -1,10 +1,8 @@
--# frozen_string_literal: false
-+# frozen_string_literal: true
- require 'test/unit'
- require 'optparse'
+@@ -1,9 +1,6 @@
+-# frozen_string_literal: false
+-require 'test/unit'
+-require 'optparse'
++# frozen_string_literal: true
++require_relative 'optparse_setup'
  
 -class TestOptionParser < Test::Unit::TestCase
 -end
--class TestOptionParser::BashCompletion < Test::Unit::TestCase
-+class TestOptionParserBashCompletion < Test::Unit::TestCase
+ class TestOptionParser::BashCompletion < Test::Unit::TestCase
    def setup
      @opt = OptionParser.new
-     @opt.define("-z", "zzz") {}
 diff --git a/test/optparse/test_cclass.rb b/test/optparse/test_cclass.rb
 index ac46f46bb2..7abe3e1d14 100644
 --- a/test/optparse/test_cclass.rb

diff --git a/test/optparse/test_acceptable.rb b/test/optparse/test_acceptable.rb
index 5c3fbdb10c..802482302d 100644
--- a/test/optparse/test_acceptable.rb

     flags = []
     @opt.def_option("-[a-z]") {|x| flags << x}
diff --git a/test/optparse/test_getopts.rb b/test/optparse/test_getopts.rb
index 3711e6f269..41627597cf 100644
--- a/test/optparse/test_getopts.rb
+++ b/test/optparse/test_getopts.rb
@@ -1,9 +1,6 @@
-# frozen_string_literal: false
-require 'test/unit'
-require 'optparse'
+# frozen_string_literal: true
+require_relative 'optparse_setup'
 
-class TestOptionParser < Test::Unit::TestCase
-end
 class TestOptionParser::Getopts < Test::Unit::TestCase
   def setup
     @opt = OptionParser.new
diff --git a/test/optparse/test_kwargs.rb b/test/optparse/test_kwargs.rb
index 78d7e2ee9c..555caa991a 100644
--- a/test/optparse/test_kwargs.rb
