activesambaldap 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/NEWS.en +6 -1
- data/NEWS.ja +6 -1
- data/README.en +3 -2
- data/README.ja +3 -2
- data/Rakefile +21 -2
- data/bin/asl-groupadd +0 -0
- data/bin/asl-groupadd.help +15 -0
- data/bin/asl-groupdel +0 -0
- data/bin/asl-groupdel.help +12 -0
- data/bin/asl-groupmod +0 -0
- data/bin/asl-groupmod.help +18 -0
- data/bin/asl-groupshow +0 -0
- data/bin/asl-groupshow.help +10 -0
- data/bin/asl-passwd +0 -0
- data/bin/asl-passwd.help +14 -0
- data/bin/asl-populate +0 -0
- data/bin/asl-populate.help +27 -0
- data/bin/asl-purge +0 -0
- data/bin/asl-purge.help +10 -0
- data/bin/asl-samba-computeradd +0 -0
- data/bin/asl-samba-computeradd.help +12 -0
- data/bin/asl-samba-groupadd +0 -0
- data/bin/asl-samba-groupadd.help +10 -0
- data/bin/asl-samba-groupdel +0 -0
- data/bin/asl-samba-groupdel.help +10 -0
- data/bin/asl-samba-groupmod +0 -0
- data/bin/asl-samba-groupmod.help +14 -0
- data/bin/asl-samba-useradd +0 -0
- data/bin/asl-samba-useradd.help +12 -0
- data/bin/asl-samba-userdel +0 -0
- data/bin/asl-samba-userdel.help +10 -0
- data/bin/asl-samba-usermod +0 -0
- data/bin/asl-samba-usermod.help +14 -0
- data/bin/asl-useradd +0 -0
- data/bin/asl-useradd.help +47 -0
- data/bin/asl-userdel +0 -0
- data/bin/asl-userdel.help +17 -0
- data/bin/asl-usermod +0 -0
- data/bin/asl-usermod.help +45 -0
- data/bin/asl-usershow +0 -0
- data/bin/asl-usershow.help +10 -0
- data/lib/active_samba_ldap.rb +9 -3
- data/lib/active_samba_ldap/account_entry.rb +1 -1
- data/lib/active_samba_ldap/group_entry.rb +3 -5
- data/lib/active_samba_ldap/reloadable.rb +2 -0
- data/lib/active_samba_ldap/samba_group_entry.rb +1 -1
- data/lib/active_samba_ldap/version.rb +1 -1
- data/misc/rd2html.rb +1 -1
- data/rails/plugin/active_samba_ldap/init.rb +15 -0
- data/test-unit/History.txt +32 -0
- data/test-unit/README.txt +32 -0
- data/test-unit/Rakefile +22 -0
- data/test-unit/bin/testrb +5 -0
- data/test-unit/lib/test/unit.rb +280 -0
- data/test-unit/lib/test/unit/assertionfailederror.rb +14 -0
- data/test-unit/lib/test/unit/assertions.rb +722 -0
- data/test-unit/lib/test/unit/attribute.rb +125 -0
- data/test-unit/lib/test/unit/autorunner.rb +250 -0
- data/test-unit/lib/test/unit/collector.rb +43 -0
- data/test-unit/lib/test/unit/collector/descendant.rb +23 -0
- data/test-unit/lib/test/unit/collector/dir.rb +108 -0
- data/test-unit/lib/test/unit/collector/load.rb +135 -0
- data/test-unit/lib/test/unit/collector/objectspace.rb +34 -0
- data/test-unit/lib/test/unit/color.rb +61 -0
- data/test-unit/lib/test/unit/diff.rb +524 -0
- data/test-unit/lib/test/unit/error.rb +124 -0
- data/test-unit/lib/test/unit/exceptionhandler.rb +39 -0
- data/test-unit/lib/test/unit/failure.rb +110 -0
- data/test-unit/lib/test/unit/fixture.rb +185 -0
- data/test-unit/lib/test/unit/notification.rb +116 -0
- data/test-unit/lib/test/unit/omission.rb +129 -0
- data/test-unit/lib/test/unit/pending.rb +130 -0
- data/test-unit/lib/test/unit/priority.rb +146 -0
- data/test-unit/lib/test/unit/runner/console.rb +46 -0
- data/test-unit/lib/test/unit/runner/emacs.rb +8 -0
- data/test-unit/lib/test/unit/testcase.rb +174 -0
- data/test-unit/lib/test/unit/testresult.rb +89 -0
- data/test-unit/lib/test/unit/testsuite.rb +110 -0
- data/test-unit/lib/test/unit/ui/console/outputlevel.rb +14 -0
- data/test-unit/lib/test/unit/ui/console/testrunner.rb +195 -0
- data/test-unit/lib/test/unit/ui/emacs/testrunner.rb +49 -0
- data/test-unit/lib/test/unit/ui/testrunner.rb +20 -0
- data/test-unit/lib/test/unit/ui/testrunnermediator.rb +77 -0
- data/test-unit/lib/test/unit/ui/testrunnerutilities.rb +41 -0
- data/test-unit/lib/test/unit/util/backtracefilter.rb +41 -0
- data/test-unit/lib/test/unit/util/observable.rb +90 -0
- data/test-unit/lib/test/unit/util/procwrapper.rb +48 -0
- data/test-unit/lib/test/unit/version.rb +7 -0
- data/test-unit/sample/adder.rb +13 -0
- data/test-unit/sample/subtracter.rb +12 -0
- data/test-unit/sample/tc_adder.rb +18 -0
- data/test-unit/sample/tc_subtracter.rb +18 -0
- data/test-unit/sample/ts_examples.rb +7 -0
- data/test-unit/test/collector/test_descendant.rb +135 -0
- data/test-unit/test/collector/test_dir.rb +406 -0
- data/test-unit/test/collector/test_load.rb +333 -0
- data/test-unit/test/collector/test_objectspace.rb +98 -0
- data/test-unit/test/run-test.rb +13 -0
- data/test-unit/test/test_assertions.rb +693 -0
- data/test-unit/test/test_attribute.rb +86 -0
- data/test-unit/test/test_color.rb +37 -0
- data/test-unit/test/test_diff.rb +477 -0
- data/test-unit/test/test_emacs_runner.rb +60 -0
- data/test-unit/test/test_error.rb +26 -0
- data/test-unit/test/test_failure.rb +33 -0
- data/test-unit/test/test_fixture.rb +275 -0
- data/test-unit/test/test_notification.rb +33 -0
- data/test-unit/test/test_omission.rb +81 -0
- data/test-unit/test/test_pending.rb +64 -0
- data/test-unit/test/test_priority.rb +89 -0
- data/test-unit/test/test_testcase.rb +411 -0
- data/test-unit/test/test_testresult.rb +113 -0
- data/test-unit/test/test_testsuite.rb +129 -0
- data/test-unit/test/testunit_test_util.rb +12 -0
- data/test-unit/test/ui/test_testrunmediator.rb +20 -0
- data/test-unit/test/util/test_backtracefilter.rb +41 -0
- data/test-unit/test/util/test_observable.rb +102 -0
- data/test-unit/test/util/test_procwrapper.rb +36 -0
- data/test/asl-test-utils.rb +0 -1
- data/test/run-test.rb +8 -12
- data/test/test_asl_groupmod.rb +3 -1
- data/test/test_asl_useradd.rb +3 -3
- data/test/test_samba_encrypt.rb +0 -1
- metadata +225 -88
- data/po/active-samba-ldap.pot +0 -459
- data/test/test-unit-ext.rb +0 -4
- data/test/test-unit-ext/always-show-result.rb +0 -28
- data/test/test-unit-ext/backtrace-filter.rb +0 -17
- data/test/test-unit-ext/long-display-for-emacs.rb +0 -25
- data/test/test-unit-ext/priority.rb +0 -186
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'test/unit/ui/emacs/testrunner'
|
3
|
+
|
4
|
+
class TestUnitEmacsRunner < Test::Unit::TestCase
|
5
|
+
def test_format_failure_with_a_location
|
6
|
+
runner = create_runner
|
7
|
+
test_name = "test_failure"
|
8
|
+
file = "/home/user/test_xxx.rb"
|
9
|
+
line = "3"
|
10
|
+
info = "in `xxx'"
|
11
|
+
location = "#{file}:#{line}: #{info}"
|
12
|
+
message = "FAIL!!!"
|
13
|
+
failure = Test::Unit::Failure.new(test_name, [location], message)
|
14
|
+
assert_equal(<<-EOM.chomp, runner.send(:format_fault, failure))
|
15
|
+
Failure:
|
16
|
+
#{test_name} [#{file}:#{line}]:
|
17
|
+
#{message}
|
18
|
+
EOM
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_format_failure_with_locations
|
22
|
+
runner = create_runner
|
23
|
+
test_name = "test_failure"
|
24
|
+
locations = ["/home/user/test_xxx.rb:3: in `xxx'",
|
25
|
+
"/home/user/yyy/test_yyy.rb:999: in `yyy'",
|
26
|
+
"/home/user/xyz/zzz.rb:29: in `zzz'"]
|
27
|
+
message = "Many backtrace!!!"
|
28
|
+
failure = Test::Unit::Failure.new(test_name, locations, message)
|
29
|
+
assert_equal(<<-EOM.chomp, runner.send(:format_fault, failure))
|
30
|
+
Failure:
|
31
|
+
#{test_name}
|
32
|
+
#{locations.join("\n")}:
|
33
|
+
#{message}
|
34
|
+
EOM
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_format_error
|
38
|
+
runner = create_runner
|
39
|
+
test_name = "test_error"
|
40
|
+
message = "Error Message!!!"
|
41
|
+
backtrace = ["/home/user/test_xxx.rb:3: in `xxx'",
|
42
|
+
"/home/user/yyy/test_yyy.rb:999: in `yyy'",
|
43
|
+
"/home/user/xyz/zzz.rb:29: in `zzz'"]
|
44
|
+
exception = RuntimeError.new(message)
|
45
|
+
exception.set_backtrace(backtrace)
|
46
|
+
error = Test::Unit::Error.new(test_name, exception)
|
47
|
+
assert_equal(<<-EOM.chomp, runner.send(:format_fault, error))
|
48
|
+
Error:
|
49
|
+
#{test_name}:
|
50
|
+
#{exception.class.name}: #{message}
|
51
|
+
#{backtrace.join("\n")}
|
52
|
+
EOM
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
def create_runner(suite=nil)
|
57
|
+
suite ||= Test::Unit::TestSuite.new
|
58
|
+
Test::Unit::UI::Emacs::TestRunner.new(suite)
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# Author:: Nathaniel Talbott.
|
2
|
+
# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
|
3
|
+
# License:: Ruby license.
|
4
|
+
|
5
|
+
require 'test/unit'
|
6
|
+
|
7
|
+
module Test
|
8
|
+
module Unit
|
9
|
+
class TC_Error < TestCase
|
10
|
+
TF_Exception = Struct.new('TF_Exception', :message, :backtrace)
|
11
|
+
def test_display
|
12
|
+
ex = TF_Exception.new("message1\nmessage2", ['line1', 'line2'])
|
13
|
+
e = Error.new("name", ex)
|
14
|
+
assert_equal("name: #{TF_Exception.name}: message1", e.short_display)
|
15
|
+
assert_equal(<<EOM.strip, e.long_display)
|
16
|
+
Error:
|
17
|
+
name:
|
18
|
+
Struct::TF_Exception: message1
|
19
|
+
message2
|
20
|
+
line1
|
21
|
+
line2
|
22
|
+
EOM
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Author:: Nathaniel Talbott.
|
2
|
+
# Copyright:: Copyright (c) 2003 Nathaniel Talbott. All rights reserved.
|
3
|
+
# License:: Ruby license.
|
4
|
+
|
5
|
+
require 'test/unit'
|
6
|
+
require 'test/unit/failure'
|
7
|
+
|
8
|
+
module Test::Unit
|
9
|
+
class TestFailure < TestCase
|
10
|
+
def test_display
|
11
|
+
f = Failure.new("name", [%q{location:1 in 'l'}], "message1\nmessage2")
|
12
|
+
assert_equal("name: message1", f.short_display)
|
13
|
+
assert_equal(<<EOM.strip, f.long_display)
|
14
|
+
Failure:
|
15
|
+
name [location:1]:
|
16
|
+
message1
|
17
|
+
message2
|
18
|
+
EOM
|
19
|
+
|
20
|
+
f = Failure.new("name", [%q{location1:2 in 'l1'}, 'location2:1', %q{location3:3 in 'l3'}], "message1\nmessage2")
|
21
|
+
assert_equal("name: message1", f.short_display)
|
22
|
+
assert_equal(<<EOM.strip, f.long_display)
|
23
|
+
Failure:
|
24
|
+
name
|
25
|
+
[location1:2 in 'l1'
|
26
|
+
location2:1
|
27
|
+
location3:3 in 'l3']:
|
28
|
+
message1
|
29
|
+
message2
|
30
|
+
EOM
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,275 @@
|
|
1
|
+
class TestUnitFixture < Test::Unit::TestCase
|
2
|
+
def test_setup_without_option
|
3
|
+
test_case = assert_setup([:setup,
|
4
|
+
:custom_setup_method0,
|
5
|
+
:custom_setup_method1,
|
6
|
+
:custom_setup_method3],
|
7
|
+
[])
|
8
|
+
assert_inherited_setup([:setup,
|
9
|
+
:custom_setup_method0,
|
10
|
+
:custom_setup_method1,
|
11
|
+
:custom_setup_method3],
|
12
|
+
test_case)
|
13
|
+
assert_inherited_setup([:setup], nil)
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_setup_with_before_option
|
17
|
+
test_case = assert_setup([:custom_setup_method3,
|
18
|
+
:custom_setup_method0,
|
19
|
+
:custom_setup_method1,
|
20
|
+
:setup],
|
21
|
+
[[{:before => :append}],
|
22
|
+
[{:before => :append}],
|
23
|
+
[{:before => :prepend}],
|
24
|
+
[{:before => :prepend}]])
|
25
|
+
assert_inherited_setup([:custom_setup_method3,
|
26
|
+
:custom_setup_method0,
|
27
|
+
:custom_setup_method1,
|
28
|
+
:setup],
|
29
|
+
test_case)
|
30
|
+
assert_inherited_setup([:setup], nil)
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_setup_with_after_option
|
34
|
+
test_case = assert_setup([:setup,
|
35
|
+
:custom_setup_method3,
|
36
|
+
:custom_setup_method0,
|
37
|
+
:custom_setup_method1],
|
38
|
+
[[{:after => :append}],
|
39
|
+
[{:after => :append}],
|
40
|
+
[{:after => :prepend}],
|
41
|
+
[{:after => :prepend}]])
|
42
|
+
assert_inherited_setup([:setup,
|
43
|
+
:custom_setup_method3,
|
44
|
+
:custom_setup_method0,
|
45
|
+
:custom_setup_method1],
|
46
|
+
test_case)
|
47
|
+
assert_inherited_setup([:setup], nil)
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_setup_with_invalid_option
|
51
|
+
assert_invalid_setup_option(:unknown => true)
|
52
|
+
assert_invalid_setup_option(:before => :unknown)
|
53
|
+
assert_invalid_setup_option(:after => :unknown)
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_teardown_without_option
|
57
|
+
test_case = assert_teardown([:custom_teardown_method3,
|
58
|
+
:custom_teardown_method1,
|
59
|
+
:custom_teardown_method0,
|
60
|
+
:teardown],
|
61
|
+
[])
|
62
|
+
assert_inherited_teardown([:custom_teardown_method3,
|
63
|
+
:custom_teardown_method1,
|
64
|
+
:custom_teardown_method0,
|
65
|
+
:teardown],
|
66
|
+
test_case)
|
67
|
+
assert_inherited_teardown([:teardown], nil)
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_teardown_with_before_option
|
71
|
+
test_case = assert_teardown([:custom_teardown_method3,
|
72
|
+
:custom_teardown_method0,
|
73
|
+
:custom_teardown_method1,
|
74
|
+
:teardown],
|
75
|
+
[[{:before => :append}],
|
76
|
+
[{:before => :append}],
|
77
|
+
[{:before => :prepend}],
|
78
|
+
[{:before => :prepend}]])
|
79
|
+
assert_inherited_teardown([:custom_teardown_method3,
|
80
|
+
:custom_teardown_method0,
|
81
|
+
:custom_teardown_method1,
|
82
|
+
:teardown],
|
83
|
+
test_case)
|
84
|
+
assert_inherited_teardown([:teardown], nil)
|
85
|
+
end
|
86
|
+
|
87
|
+
def test_teardown_with_after_option
|
88
|
+
test_case = assert_teardown([:teardown,
|
89
|
+
:custom_teardown_method3,
|
90
|
+
:custom_teardown_method0,
|
91
|
+
:custom_teardown_method1],
|
92
|
+
[[{:after => :append}],
|
93
|
+
[{:after => :append}],
|
94
|
+
[{:after => :prepend}],
|
95
|
+
[{:after => :prepend}]])
|
96
|
+
assert_inherited_teardown([:teardown,
|
97
|
+
:custom_teardown_method3,
|
98
|
+
:custom_teardown_method0,
|
99
|
+
:custom_teardown_method1],
|
100
|
+
test_case)
|
101
|
+
assert_inherited_teardown([:teardown], nil)
|
102
|
+
end
|
103
|
+
|
104
|
+
def test_teardown_with_invalid_option
|
105
|
+
assert_invalid_teardown_option(:unknown => true)
|
106
|
+
assert_invalid_teardown_option(:before => :unknown)
|
107
|
+
assert_invalid_teardown_option(:after => :unknown)
|
108
|
+
end
|
109
|
+
|
110
|
+
private
|
111
|
+
def assert_setup(expected, setup_options)
|
112
|
+
called = []
|
113
|
+
test_case = Class.new(Test::Unit::TestCase) do
|
114
|
+
@@called = called
|
115
|
+
def setup
|
116
|
+
@@called << :setup
|
117
|
+
end
|
118
|
+
|
119
|
+
setup(*(setup_options[0] || []))
|
120
|
+
def custom_setup_method0
|
121
|
+
@@called << :custom_setup_method0
|
122
|
+
end
|
123
|
+
|
124
|
+
def custom_setup_method1
|
125
|
+
@@called << :custom_setup_method1
|
126
|
+
end
|
127
|
+
setup(*[:custom_setup_method1, *(setup_options[1] || [])])
|
128
|
+
|
129
|
+
setup(*(setup_options[2] || []))
|
130
|
+
def custom_setup_method2
|
131
|
+
@@called << :custom_setup_method2
|
132
|
+
end
|
133
|
+
unregister_setup(:custom_setup_method2)
|
134
|
+
|
135
|
+
setup(*(setup_options[3] || []))
|
136
|
+
def custom_setup_method3
|
137
|
+
@@called << :custom_setup_method3
|
138
|
+
end
|
139
|
+
|
140
|
+
def test_nothing
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
test_case.new("test_nothing").run(Test::Unit::TestResult.new) {}
|
145
|
+
assert_equal(expected, called)
|
146
|
+
test_case
|
147
|
+
end
|
148
|
+
|
149
|
+
def assert_inherited_setup(expected, parent)
|
150
|
+
called = []
|
151
|
+
inherited_test_case = Class.new(parent || Test::Unit::TestCase) do
|
152
|
+
@@called = called
|
153
|
+
def setup
|
154
|
+
@@called << :setup
|
155
|
+
end
|
156
|
+
|
157
|
+
def custom_setup_method0
|
158
|
+
@@called << :custom_setup_method0
|
159
|
+
end
|
160
|
+
|
161
|
+
def custom_setup_method1
|
162
|
+
@@called << :custom_setup_method1
|
163
|
+
end
|
164
|
+
|
165
|
+
def custom_setup_method2
|
166
|
+
@@called << :custom_setup_method2
|
167
|
+
end
|
168
|
+
|
169
|
+
def custom_setup_method3
|
170
|
+
@@called << :custom_setup_method3
|
171
|
+
end
|
172
|
+
|
173
|
+
def test_nothing
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
inherited_test_case.new("test_nothing").run(Test::Unit::TestResult.new) {}
|
178
|
+
assert_equal(expected, called)
|
179
|
+
end
|
180
|
+
|
181
|
+
def assert_teardown(expected, teardown_options)
|
182
|
+
called = []
|
183
|
+
test_case = Class.new(Test::Unit::TestCase) do
|
184
|
+
@@called = called
|
185
|
+
def teardown
|
186
|
+
@@called << :teardown
|
187
|
+
end
|
188
|
+
|
189
|
+
teardown(*(teardown_options[0] || []))
|
190
|
+
def custom_teardown_method0
|
191
|
+
@@called << :custom_teardown_method0
|
192
|
+
end
|
193
|
+
|
194
|
+
def custom_teardown_method1
|
195
|
+
@@called << :custom_teardown_method1
|
196
|
+
end
|
197
|
+
teardown(*[:custom_teardown_method1, *(teardown_options[1] || [])])
|
198
|
+
|
199
|
+
teardown(*(teardown_options[2] || []))
|
200
|
+
def custom_teardown_method2
|
201
|
+
@@called << :custom_teardown_method2
|
202
|
+
end
|
203
|
+
unregister_teardown(:custom_teardown_method2)
|
204
|
+
|
205
|
+
teardown(*(teardown_options[3] || []))
|
206
|
+
def custom_teardown_method3
|
207
|
+
@@called << :custom_teardown_method3
|
208
|
+
end
|
209
|
+
|
210
|
+
def test_nothing
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
test_case.new("test_nothing").run(Test::Unit::TestResult.new) {}
|
215
|
+
assert_equal(expected, called)
|
216
|
+
test_case
|
217
|
+
end
|
218
|
+
|
219
|
+
def assert_inherited_teardown(expected, parent)
|
220
|
+
called = []
|
221
|
+
inherited_test_case = Class.new(parent || Test::Unit::TestCase) do
|
222
|
+
@@called = called
|
223
|
+
def teardown
|
224
|
+
@@called << :teardown
|
225
|
+
end
|
226
|
+
|
227
|
+
def custom_teardown_method0
|
228
|
+
@@called << :custom_teardown_method0
|
229
|
+
end
|
230
|
+
|
231
|
+
def custom_teardown_method1
|
232
|
+
@@called << :custom_teardown_method1
|
233
|
+
end
|
234
|
+
|
235
|
+
def custom_teardown_method2
|
236
|
+
@@called << :custom_teardown_method2
|
237
|
+
end
|
238
|
+
|
239
|
+
def custom_teardown_method3
|
240
|
+
@@called << :custom_teardown_method3
|
241
|
+
end
|
242
|
+
|
243
|
+
def test_nothing
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
inherited_test_case.new("test_nothing").run(Test::Unit::TestResult.new) {}
|
248
|
+
assert_equal(expected, called)
|
249
|
+
end
|
250
|
+
|
251
|
+
def assert_invalid_option(fixture_type, option)
|
252
|
+
exception = assert_raise(ArgumentError) do
|
253
|
+
Class.new(Test::Unit::TestCase) do
|
254
|
+
def test_nothing
|
255
|
+
end
|
256
|
+
|
257
|
+
send(fixture_type, option)
|
258
|
+
def fixture
|
259
|
+
end
|
260
|
+
end
|
261
|
+
end
|
262
|
+
assert_equal("must be {:before => :prepend}, {:before => :append}, " +
|
263
|
+
"{:after => :prepend} or {:after => :append}" +
|
264
|
+
": #{option.inspect}",
|
265
|
+
exception.message)
|
266
|
+
end
|
267
|
+
|
268
|
+
def assert_invalid_setup_option(option)
|
269
|
+
assert_invalid_option(:setup, option)
|
270
|
+
end
|
271
|
+
|
272
|
+
def assert_invalid_teardown_option(option)
|
273
|
+
assert_invalid_option(:teardown, option)
|
274
|
+
end
|
275
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'testunit_test_util'
|
3
|
+
|
4
|
+
class TestNotification < Test::Unit::TestCase
|
5
|
+
include TestUnitTestUtil
|
6
|
+
|
7
|
+
class TestCase < Test::Unit::TestCase
|
8
|
+
class << self
|
9
|
+
def suite
|
10
|
+
Test::Unit::TestSuite.new(name)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_notify
|
15
|
+
notify("1st notify")
|
16
|
+
notify("2nd notify. Reach here.")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_notify
|
21
|
+
result = run_test("test_notify")
|
22
|
+
assert_equal("1 tests, 0 assertions, 0 failures, 0 errors, 0 pendings, " \
|
23
|
+
"0 omissions, 2 notifications",
|
24
|
+
result.to_s)
|
25
|
+
assert_fault_messages(["1st notify", "2nd notify. Reach here."],
|
26
|
+
result.notifications)
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
def run_test(name)
|
31
|
+
super(TestCase, name)
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'testunit_test_util'
|
3
|
+
|
4
|
+
class TestUnitOmission < Test::Unit::TestCase
|
5
|
+
include TestUnitTestUtil
|
6
|
+
|
7
|
+
class TestCase < Test::Unit::TestCase
|
8
|
+
class << self
|
9
|
+
def suite
|
10
|
+
Test::Unit::TestSuite.new(name)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_omit
|
15
|
+
omit("1st omit")
|
16
|
+
omit("2nd omit. Should not be reached here.")
|
17
|
+
assert(true, "Should not be reached here too.")
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_omit_with_condition
|
21
|
+
omit_if(false, "Never omit.")
|
22
|
+
omit_unless(true, "Never omit too.")
|
23
|
+
omit_if(true, "Should omit.")
|
24
|
+
omit("The last omit. Should not be reached here.")
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_omit_with_block
|
28
|
+
omit("Omit block") do
|
29
|
+
flunk("Should not be reached here.")
|
30
|
+
end
|
31
|
+
assert(true, "Should be reached here.")
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_omit_with_block_and_condition
|
35
|
+
omit_if(false, "Never omit.") do
|
36
|
+
assert(true, "Should be reached here.")
|
37
|
+
end
|
38
|
+
omit_if(true, "Should omit.") do
|
39
|
+
flunk("Never reached here.")
|
40
|
+
end
|
41
|
+
assert(true, "Should be reached here too.")
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_omit
|
46
|
+
result = run_test("test_omit")
|
47
|
+
assert_equal("1 tests, 0 assertions, 0 failures, 0 errors, 0 pendings, " \
|
48
|
+
"1 omissions, 0 notifications",
|
49
|
+
result.to_s)
|
50
|
+
assert_fault_messages(["1st omit"], result.omissions)
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_omit_with_condition
|
54
|
+
result = run_test("test_omit_with_condition")
|
55
|
+
assert_equal("1 tests, 0 assertions, 0 failures, 0 errors, 0 pendings, " \
|
56
|
+
"1 omissions, 0 notifications",
|
57
|
+
result.to_s)
|
58
|
+
assert_fault_messages(["Should omit."], result.omissions)
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_omit_with_block
|
62
|
+
result = run_test("test_omit_with_block")
|
63
|
+
assert_equal("1 tests, 1 assertions, 0 failures, 0 errors, 0 pendings, " \
|
64
|
+
"1 omissions, 0 notifications",
|
65
|
+
result.to_s)
|
66
|
+
assert_fault_messages(["Omit block"], result.omissions)
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_omit_with_condition_and_block
|
70
|
+
result = run_test("test_omit_with_block_and_condition")
|
71
|
+
assert_equal("1 tests, 1 assertions, 0 failures, 0 errors, 0 pendings, " \
|
72
|
+
"1 omissions, 0 notifications",
|
73
|
+
result.to_s)
|
74
|
+
assert_fault_messages(["Should omit."], result.omissions)
|
75
|
+
end
|
76
|
+
|
77
|
+
private
|
78
|
+
def run_test(name)
|
79
|
+
super(TestCase, name)
|
80
|
+
end
|
81
|
+
end
|