aboutsummaryrefslogtreecommitdiffstats
path: root/test/minitest/metametameta.rb
diff options
context:
space:
mode:
authorryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-05-04 21:46:01 +0000
committerryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-05-04 21:46:01 +0000
commit6af843b9cb99fb844bf866e71e9ee52be126080f (patch)
treeafee639e216cf32357c2d6e76de49f2549c6d5af /test/minitest/metametameta.rb
parent95d4b3ba4974fdb9f08900267964949e30b1c821 (diff)
downloadruby-6af843b9cb99fb844bf866e71e9ee52be126080f.tar.gz
Imported minitest 2.12.1 (r7323)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35541 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/minitest/metametameta.rb')
-rw-r--r--test/minitest/metametameta.rb49
1 files changed, 49 insertions, 0 deletions
diff --git a/test/minitest/metametameta.rb b/test/minitest/metametameta.rb
new file mode 100644
index 0000000000..4352cfee82
--- /dev/null
+++ b/test/minitest/metametameta.rb
@@ -0,0 +1,49 @@
+# encoding: utf-8
+######################################################################
+# This file is imported from the minitest project.
+# DO NOT make modifications in this repo. They _will_ be reverted!
+# File a patch instead and assign it to Ryan Davis.
+######################################################################
+
+require 'tempfile'
+require 'stringio'
+require 'minitest/autorun'
+
+class MetaMetaMetaTestCase < MiniTest::Unit::TestCase
+ def assert_report expected = nil
+ expected ||= <<-EOM.gsub(/^ {6}/, '')
+ Run options: --seed 42
+
+ # Running tests:
+
+ .
+
+ Finished tests in 0.00
+
+ 1 tests, 1 assertions, 0 failures, 0 errors, 0 skips
+ EOM
+
+ output = @output.string.dup
+ output.sub!(/Finished tests in .*/, "Finished tests in 0.00")
+ output.sub!(/Loaded suite .*/, 'Loaded suite blah')
+ output.gsub!(/\[[^\]:]+:\d+\]/, '[FILE:LINE]')
+ output.gsub!(/^(\s+)[^:]+:\d+:in/, '\1FILE:LINE:in')
+ assert_equal(expected, output)
+ end
+
+ def setup
+ super
+ srand 42
+ MiniTest::Unit::TestCase.reset
+ @tu = MiniTest::Unit.new
+ @output = StringIO.new("")
+ MiniTest::Unit.runner = nil # protect the outer runner from the inner tests
+ MiniTest::Unit.output = @output
+ end
+
+ def teardown
+ super
+ MiniTest::Unit.output = $stdout
+ Object.send :remove_const, :ATestCase if defined? ATestCase
+ end
+end