Commit Graph

17 Commits

Author SHA1 Message Date
Ryan Davis 2d64718cae Renamed Minitest::SEED to Minitest.seed
+ Calling `srand Minitest.seed` before all shuffles to ensure determinism.

This defends against other tests/libraries calling srand themselves
and messing up minitest's seeded ordering.

[git-p4: depot-paths = "//src/minitest/dev/": change = 13428]
2022-06-06 00:12:08 -08:00
Ryan Davis 65664a151d + Minitest.filter_backtrace returns original backtrace if filter comes back empty.
+ Minitest::BacktraceFilter now returns entire backtrace if $MT_DEBUG set in env.

This should fix https://github.com/seattlerb/minitest/issues/837 and
bypasses the need for a release of
https://github.com/rails/rails/pull/39304.

[git-p4: depot-paths = "//src/minitest/dev/": change = 12653]
2020-05-15 15:45:30 -08:00
Ryan Davis fe71663910 Reworked some of metametameta to be more flexible.
[git-p4: depot-paths = "//src/minitest/dev/": change = 12355]
2019-10-20 02:11:43 -08:00
Ryan Davis 87f33d7dac Split tests out into test_minitest_assertions.rb
Added test/minitest/test_minitest_assertions.rb

[git-p4: depot-paths = "//src/minitest/dev/": change = 12114]
2019-06-09 20:07:33 -08:00
Ryan Davis 00433fc0a4 ! Added Minitest::Result and Minitest::Result.from(runnable).
! Changed Minitest::Test to subclass Result and refactored methods up.
+ Minitest.run_one_method now checks for instance of Result, not exact same class.
+ Minitest::Test.run returns a Result version of self, not self.
+ Removed Runnable.marshal_dump/load.
+ ProgressReporter#prerecord now explicitly prints klass.name. Allows for fakers.
Moved Runnable.inherited hook to the bottom of minitest.rb

[git-p4: depot-paths = "//src/minitest/dev/": change = 11473]
2017-12-14 14:58:15 -08:00
Ryan Davis c6ba2afd90 - Write aggregated_results directly to the IO object to avoid mixed encoding errors. (tenderlove)
[git-p4: depot-paths = "//src/minitest/dev/": change = 11209]
2017-01-13 15:22:45 -08:00
Ryan Davis 174a860e6c Added FakeNamedTest to metametameta and switched to it. Helps w/ error messages.
[git-p4: depot-paths = "//src/minitest/dev/": change = 10935]
2016-11-14 17:42:59 -08:00
Ryan Davis e8d8c2a256 For "fun", I defined a rubocop config that best represents "Seattle Style". 14 issues later (https://github.com/bbatsov/rubocop/issues/created_by/zenspider) I wound up with the following:
Update all old single quoted strings to double quoted.
Get rid of some Really::Old::Coding::Styles().
Update for minor consistency issues.
Found and fixed some odd indentation issues
Marked more named args as optional by prefixing with _
Switched all %x array thingies to use square brackets
Swiched from Hash#has_key? to #key? because it is deprecated.
and probably more.

Was it worth my time? Probably not, but it was an interesting experiment.

[git-p4: depot-paths = "//src/minitest/dev/": change = 9952]
2015-01-26 20:30:19 -08:00
Ryan Davis ab412f8693 Refactored duplication out of my tests. yay metametameta!
[git-p4: depot-paths = "//src/minitest/dev/": change = 9574]
2014-07-10 18:16:49 -08:00
Ryan Davis 34760e3b26 + Use a Queue for scheduling parallel tests. (tenderlove)
[git-p4: depot-paths = "//src/minitest/dev/": change = 9032]
2013-11-15 13:36:21 -08:00
Ryan Davis 3d316c7f1a + Removed Reporter#run_and_report... cleaner, but doesn't "fit" in the API.
+ Added AbstractReporter, defining required Reporter API to quack properly.
+ Refactored Reporter into ProgressReporter and SummaryReporter.
+ Added doco for writing reporters.

[git-p4: depot-paths = "//src/minitest/dev/": change = 8634]
2013-05-29 21:58:22 -08:00
Ryan Davis 9a57c520ce Oh god... here we go.
Minitest 5:

Deaths in the family:

! MiniTest.runner is dead. No more manager objects.
! MiniTest::Unit#record is dead. Use a Reporter instance instead.
! MiniTest::Unit._run_* is dead. Runnable things are responsible for their own runs.
! MiniTest::Unit.output is dead. No more centralized IO.

Major (oft incompatible) changes:

! Renamed MiniTest to Minitest. Your pinkies will thank me.
! Removed MiniTest::Unit entirely. No more manager objects.
! Added Minitest::Runnable. Everything minitest can run subclasses this.
! Renamed MiniTest::Unit::TestCase to Minitest::Test (subclassing Runnable).
! Added Minitest::Benchmark.
  ! Your benchmarks need to move to their own subclass.
  ! Benchmarks using the spec DSL have to have "Bench" somewhere in their describe.
! MiniTest::Unit.after_tests moved to Minitest.after_tests
! MiniTest::Unit.autorun is now Minitest.autorun. Just require minitest/autorun pls.
! Removed ParallelEach#grep since it isn't used anywhere.

Minor moves:

+ Moved Assertions module to minitest/assertions.rb
+ Moved Expectations module to minitest/expectations.rb
+ Moved Test to minitest/test.rb
+ Moved everything else in minitest/unit.rb to minitest.rb
+ minitest/unit.rb is now just a small (user-test only) compatibility layer.

Additions:

+ Added a plugin system that can extend command-line options.
+ Added Minitest.extensions.
+ Added Minitest.reporter (only available during startup).
+ Added Minitest.run(args). This is the very top of any Minitest run.
+ Added Minitest::Reporter. Everything minitest can report goes through here.
  + Minitest.reporter is a composite so you can add your own.
+ Added Minitest::CompositeReporter. Much easier to extend with your own reporters.
+ Added UnexpectedError, an Assertion subclass, to wrap up errors.
+ Minitest::Test#run is now freakin' beautiful. 47 -> 17 loc

Other:

+ Removed Object.infect_with_assertions (it was already dead code).
+ Runnables are responsible for knowing their result_code (eg "." or "F").

[git-p4: depot-paths = "//src/minitest/dev/": change = 8451]
2013-04-24 17:38:14 -08:00
Ryan Davis c9b683bc0f ! _run_suites now runs suites in parallel if they opt-in.
! Added support for :parallel test_order to run test cases in parallel.
! Added minitest/hell - run all your tests through the ringer!
+ Added TestCase#synchronize
+ Added TestCase.parallelize_me!
Wrapped up or rearranged minitest tests to handle being run in parallel as much as possible.

[git-p4: depot-paths = "//src/minitest/dev/": change = 7861]
2012-10-24 18:59:04 -08:00
Ryan Davis f80e9cf670 Added with_output to metametameta to synchronize all output
[git-p4: depot-paths = "//src/minitest/dev/": change = 7859]
2012-10-24 15:52:09 -08:00
Ryan Davis 146fa6808f Added TestCase#clean(s) to strip leading whitespace to make tests read better.
assert_report now requires expected arg, adds optional flags arg
assert_report now calls tc.run w/ flags.
assert_report strips hex values from output so we can test no-name testcases.
assert_report tacks a header onto the expected output so tests are cleaner.
Removed a bunch of stupid parens from the tests.
Removed ATestCase from everywhere. So lame.
Removed test_class_inherited since it is also tested by test_class_test_suites
All in all, tests are down 56 lines yet entirely equivalent.

[git-p4: depot-paths = "//src/minitest/dev/": change = 7649]
2012-07-18 15:45:26 -08:00
Ryan Davis fb8c1c6d51 - Fixed verbose test that only fails when run in verbose mode. mmmm irony.
[git-p4: depot-paths = "//src/minitest/dev/": change = 7595]
2012-06-25 12:43:11 -08:00
Ryan Davis 963e11c3de OMG MY WORKOUTS MAKE ME DUMB
[git-p4: depot-paths = "//src/minitest/dev/": change = 7430]
2012-05-08 14:46:02 -08:00