minitest 5.11.3 → 5.22.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/History.rdoc +280 -4
- data/Manifest.txt +4 -0
- data/README.rdoc +104 -17
- data/Rakefile +5 -16
- data/lib/hoe/minitest.rb +0 -4
- data/lib/minitest/assertions.rb +209 -42
- data/lib/minitest/benchmark.rb +7 -7
- data/lib/minitest/compress.rb +94 -0
- data/lib/minitest/expectations.rb +72 -35
- data/lib/minitest/mock.rb +123 -34
- data/lib/minitest/pride_plugin.rb +8 -11
- data/lib/minitest/spec.rb +27 -9
- data/lib/minitest/test.rb +48 -19
- data/lib/minitest/test_task.rb +301 -0
- data/lib/minitest/unit.rb +5 -8
- data/lib/minitest.rb +247 -69
- data/test/minitest/metametameta.rb +52 -12
- data/test/minitest/test_minitest_assertions.rb +1721 -0
- data/test/minitest/test_minitest_benchmark.rb +2 -2
- data/test/minitest/test_minitest_mock.rb +289 -17
- data/test/minitest/test_minitest_reporter.rb +160 -19
- data/test/minitest/test_minitest_spec.rb +314 -155
- data/test/minitest/test_minitest_test.rb +429 -1196
- data/test/minitest/test_minitest_test_task.rb +48 -0
- data.tar.gz.sig +0 -0
- metadata +38 -23
- metadata.gz.sig +0 -0
| @@ -6,8 +6,28 @@ class Minitest::Test | |
| 6 6 | 
             
              def clean s
         | 
| 7 7 | 
             
                s.gsub(/^ {6}/, "")
         | 
| 8 8 | 
             
              end
         | 
| 9 | 
            +
             | 
| 10 | 
            +
              def with_empty_backtrace_filter
         | 
| 11 | 
            +
                with_backtrace_filter Minitest::BacktraceFilter.new %r%.% do
         | 
| 12 | 
            +
                  yield
         | 
| 13 | 
            +
                end
         | 
| 14 | 
            +
              end
         | 
| 15 | 
            +
             | 
| 16 | 
            +
              def with_backtrace_filter filter
         | 
| 17 | 
            +
                original = Minitest.backtrace_filter
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                Minitest::Test.io_lock.synchronize do # try not to trounce in parallel
         | 
| 20 | 
            +
                  begin
         | 
| 21 | 
            +
                    Minitest.backtrace_filter = filter
         | 
| 22 | 
            +
                    yield
         | 
| 23 | 
            +
                  ensure
         | 
| 24 | 
            +
                    Minitest.backtrace_filter = original
         | 
| 25 | 
            +
                  end
         | 
| 26 | 
            +
                end
         | 
| 27 | 
            +
              end
         | 
| 9 28 | 
             
            end
         | 
| 10 29 |  | 
| 30 | 
            +
             | 
| 11 31 | 
             
            class FakeNamedTest < Minitest::Test
         | 
| 12 32 | 
             
              @@count = 0
         | 
| 13 33 |  | 
| @@ -19,9 +39,20 @@ class FakeNamedTest < Minitest::Test | |
| 19 39 | 
             
              end
         | 
| 20 40 | 
             
            end
         | 
| 21 41 |  | 
| 42 | 
            +
            module MyModule; end
         | 
| 43 | 
            +
            class AnError < StandardError; include MyModule; end
         | 
| 44 | 
            +
             | 
| 22 45 | 
             
            class MetaMetaMetaTestCase < Minitest::Test
         | 
| 23 46 | 
             
              attr_accessor :reporter, :output, :tu
         | 
| 24 47 |  | 
| 48 | 
            +
              def with_stderr err
         | 
| 49 | 
            +
                old = $stderr
         | 
| 50 | 
            +
                $stderr = err
         | 
| 51 | 
            +
                yield
         | 
| 52 | 
            +
              ensure
         | 
| 53 | 
            +
                $stderr = old
         | 
| 54 | 
            +
              end
         | 
| 55 | 
            +
             | 
| 25 56 | 
             
              def run_tu_with_fresh_reporter flags = %w[--seed 42]
         | 
| 26 57 | 
             
                options = Minitest.process_args flags
         | 
| 27 58 |  | 
| @@ -31,18 +62,20 @@ class MetaMetaMetaTestCase < Minitest::Test | |
| 31 62 | 
             
                reporter << Minitest::SummaryReporter.new(@output, options)
         | 
| 32 63 | 
             
                reporter << Minitest::ProgressReporter.new(@output, options)
         | 
| 33 64 |  | 
| 34 | 
            -
                 | 
| 65 | 
            +
                with_stderr @output do
         | 
| 66 | 
            +
                  reporter.start
         | 
| 35 67 |  | 
| 36 | 
            -
             | 
| 68 | 
            +
                  yield(reporter) if block_given?
         | 
| 37 69 |  | 
| 38 | 
            -
             | 
| 39 | 
            -
             | 
| 40 | 
            -
             | 
| 70 | 
            +
                  @tus ||= [@tu]
         | 
| 71 | 
            +
                  @tus.each do |tu|
         | 
| 72 | 
            +
                    Minitest::Runnable.runnables.delete tu
         | 
| 41 73 |  | 
| 42 | 
            -
             | 
| 43 | 
            -
             | 
| 74 | 
            +
                    tu.run reporter, options
         | 
| 75 | 
            +
                  end
         | 
| 44 76 |  | 
| 45 | 
            -
             | 
| 77 | 
            +
                  reporter.report
         | 
| 78 | 
            +
                end
         | 
| 46 79 | 
             
              end
         | 
| 47 80 |  | 
| 48 81 | 
             
              def first_reporter
         | 
| @@ -73,14 +106,21 @@ class MetaMetaMetaTestCase < Minitest::Test | |
| 73 106 | 
             
                output.gsub!(/0x[A-Fa-f0-9]+/, "0xXXX")
         | 
| 74 107 | 
             
                output.gsub!(/ +$/, "")
         | 
| 75 108 |  | 
| 109 | 
            +
                file = ->(s) { s.start_with?("/") ? "FULLFILE" : "FILE" }
         | 
| 110 | 
            +
             | 
| 76 111 | 
             
                if windows? then
         | 
| 77 112 | 
             
                  output.gsub!(/\[(?:[A-Za-z]:)?[^\]:]+:\d+\]/, "[FILE:LINE]")
         | 
| 78 | 
            -
                  output.gsub!(/^(\s+)(?:[A-Za-z]:)?[^:]+:\d+:in/, '\1FILE:LINE:in')
         | 
| 113 | 
            +
                  output.gsub!(/^(\s+)(?:[A-Za-z]:)?[^:]+:\d+:in [`']/, '\1FILE:LINE:in \'')
         | 
| 79 114 | 
             
                else
         | 
| 80 | 
            -
                  output.gsub!(/\[[^\]:] | 
| 81 | 
            -
                  output.gsub!(/^(\s+)[^:] | 
| 115 | 
            +
                  output.gsub!(/\[([^\]:]+):\d+\]/)         {     "[#{file[$1]}:LINE]"   }
         | 
| 116 | 
            +
                  output.gsub!(/^(\s+)([^:]+):\d+:in [`']/) { "#{$1}#{file[$2]}:LINE:in '" }
         | 
| 82 117 | 
             
                end
         | 
| 83 118 |  | 
| 119 | 
            +
                output.gsub!(/in [`']block in (?:([^']+)[#.])?/, "in 'block in")
         | 
| 120 | 
            +
                output.gsub!(/in [`'](?:([^']+)[#.])?/, "in '")
         | 
| 121 | 
            +
             | 
| 122 | 
            +
                output.gsub!(/( at )[^:]+:\d+/) { "#{$1}[#{file[$2]}:LINE]" } # eval?
         | 
| 123 | 
            +
             | 
| 84 124 | 
             
                output
         | 
| 85 125 | 
             
              end
         | 
| 86 126 |  | 
| @@ -95,7 +135,7 @@ class MetaMetaMetaTestCase < Minitest::Test | |
| 95 135 |  | 
| 96 136 | 
             
              def setup
         | 
| 97 137 | 
             
                super
         | 
| 98 | 
            -
                 | 
| 138 | 
            +
                Minitest.seed = 42
         | 
| 99 139 | 
             
                Minitest::Test.reset
         | 
| 100 140 | 
             
                @tu = nil
         | 
| 101 141 | 
             
              end
         |