test-unit 2.0.8 → 2.0.9

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.
@@ -1,3 +1,8 @@
1
+ === 2.0.9 / 2010-06-02
2
+
3
+ * 1 bug fixes
4
+ * fix a packaging miss.
5
+
1
6
  === 2.0.8 / 2010-06-02
2
7
 
3
8
  * 5 major enchancements
@@ -46,6 +46,7 @@ lib/test/unit/ui/testrunnerutilities.rb
46
46
  lib/test/unit/util/backtracefilter.rb
47
47
  lib/test/unit/util/method-owner-finder.rb
48
48
  lib/test/unit/util/observable.rb
49
+ lib/test/unit/util/output.rb
49
50
  lib/test/unit/util/procwrapper.rb
50
51
  lib/test/unit/version.rb
51
52
  sample/adder.rb
@@ -77,6 +78,7 @@ test/test_testsuite.rb
77
78
  test/testunit-test-util.rb
78
79
  test/ui/test_testrunmediator.rb
79
80
  test/util/test-method-owner-finder.rb
81
+ test/util/test-output.rb
80
82
  test/util/test_backtracefilter.rb
81
83
  test/util/test_observable.rb
82
84
  test/util/test_procwrapper.rb
@@ -0,0 +1,31 @@
1
+ module Test
2
+ module Unit
3
+ module Util
4
+ module Output
5
+ ##
6
+ # Returns output for standard output and standard
7
+ # error as string.
8
+ #
9
+ # Example:
10
+ # capture_output do
11
+ # puts("stdout")
12
+ # warn("stderr")
13
+ # end # -> ["stdout\n", "stderr\n"]
14
+ def capture_output
15
+ require 'stringio'
16
+
17
+ output = StringIO.new
18
+ error = StringIO.new
19
+ stdout_save, stderr_save = $stdout, $stderr
20
+ $stdout, $stderr = output, error
21
+ begin
22
+ yield
23
+ [output.string, error.string]
24
+ ensure
25
+ $stdout, $stderr = stdout_save, stderr_save
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -2,6 +2,6 @@
2
2
  # HACK: quick and dirty to get integrated into the new project - ryan
3
3
  module Test
4
4
  module Unit
5
- VERSION = '2.0.8'
5
+ VERSION = '2.0.9'
6
6
  end
7
7
  end
@@ -0,0 +1,11 @@
1
+ require 'test/unit'
2
+
3
+ class TestUnitOutput < Test::Unit::TestCase
4
+ def test_capture_output
5
+ assert_equal(["stdout\n", "stderr\n"],
6
+ capture_output do
7
+ puts("stdout")
8
+ warn("stderr")
9
+ end)
10
+ end
11
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 2
7
7
  - 0
8
- - 8
9
- version: 2.0.8
8
+ - 9
9
+ version: 2.0.9
10
10
  platform: ruby
11
11
  authors:
12
12
  - Kouhei Sutou
@@ -99,6 +99,7 @@ files:
99
99
  - lib/test/unit/util/backtracefilter.rb
100
100
  - lib/test/unit/util/method-owner-finder.rb
101
101
  - lib/test/unit/util/observable.rb
102
+ - lib/test/unit/util/output.rb
102
103
  - lib/test/unit/util/procwrapper.rb
103
104
  - lib/test/unit/version.rb
104
105
  - sample/adder.rb
@@ -130,6 +131,7 @@ files:
130
131
  - test/testunit-test-util.rb
131
132
  - test/ui/test_testrunmediator.rb
132
133
  - test/util/test-method-owner-finder.rb
134
+ - test/util/test-output.rb
133
135
  - test/util/test_backtracefilter.rb
134
136
  - test/util/test_observable.rb
135
137
  - test/util/test_procwrapper.rb