test-unit 2.0.8 → 2.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/Manifest.txt +2 -0
- data/lib/test/unit/util/output.rb +31 -0
- data/lib/test/unit/version.rb +1 -1
- data/test/util/test-output.rb +11 -0
- metadata +4 -2
data/History.txt
CHANGED
data/Manifest.txt
CHANGED
@@ -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
|
data/lib/test/unit/version.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 2
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 2.0.
|
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
|