activegroonga 0.0.7 → 1.0.0
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.
- data/README.ja.rdoc +4 -1
- data/README.rdoc +4 -1
- data/Rakefile +18 -4
- data/lib/active_groonga.rb +25 -52
- data/lib/active_groonga/base.rb +164 -1480
- data/lib/active_groonga/callbacks.rb +26 -7
- data/lib/active_groonga/database.rb +55 -0
- data/lib/active_groonga/{dirty.rb → error.rb} +20 -10
- data/lib/active_groonga/locale/en.yml +5 -0
- data/lib/active_groonga/migration.rb +44 -113
- data/lib/active_groonga/migrator.rb +172 -0
- data/lib/active_groonga/persistence.rb +172 -0
- data/lib/active_groonga/railtie.rb +66 -0
- data/lib/active_groonga/railties/configurable.rb +47 -0
- data/lib/active_groonga/railties/groonga.rake +167 -0
- data/lib/active_groonga/result_set.rb +89 -0
- data/lib/active_groonga/schema.rb +54 -188
- data/lib/active_groonga/validations.rb +54 -5
- data/lib/active_groonga/vector.rb +64 -0
- data/lib/active_groonga/version.rb +3 -3
- data/lib/{active_groonga/aggregations.rb → rails/generators/active_groonga.rb} +17 -10
- data/lib/rails/generators/active_groonga/migration/column.rb +101 -0
- data/lib/rails/generators/active_groonga/migration/migration_generator.rb +53 -0
- data/lib/rails/generators/active_groonga/migration/templates/migration.rb +29 -0
- data/lib/rails/generators/active_groonga/model/model_generator.rb +60 -0
- data/lib/rails/generators/active_groonga/model/templates/migration.rb +16 -0
- data/lib/rails/generators/active_groonga/model/templates/model.rb +2 -0
- data/lib/rails/generators/active_groonga/model/templates/module.rb +5 -0
- data/test-unit-notify/COPYING +502 -0
- data/test-unit-notify/Rakefile +47 -0
- data/test-unit-notify/lib/test/unit/notify.rb +127 -0
- data/test-unit/COPYING +56 -0
- data/test-unit/GPL +340 -0
- data/test-unit/PSFL +271 -0
- data/test-unit/Rakefile +18 -5
- data/test-unit/html/bar.svg +153 -0
- data/test-unit/html/developer.svg +469 -0
- data/test-unit/html/favicon.ico +0 -0
- data/test-unit/html/favicon.svg +82 -0
- data/test-unit/html/heading-mark.svg +393 -0
- data/test-unit/html/index.html +235 -13
- data/test-unit/html/index.html.ja +258 -15
- data/test-unit/html/install.svg +636 -0
- data/test-unit/html/logo.svg +483 -0
- data/test-unit/html/test-unit.css +339 -0
- data/test-unit/html/tutorial.svg +559 -0
- data/test-unit/lib/test/unit.rb +29 -43
- data/test-unit/lib/test/unit/assertionfailederror.rb +11 -0
- data/test-unit/lib/test/unit/assertions.rb +202 -20
- data/test-unit/lib/test/unit/autorunner.rb +51 -20
- data/test-unit/lib/test/unit/collector.rb +1 -8
- data/test-unit/lib/test/unit/collector/dir.rb +1 -1
- data/test-unit/lib/test/unit/collector/load.rb +16 -9
- data/test-unit/lib/test/unit/color-scheme.rb +19 -3
- data/test-unit/lib/test/unit/diff.rb +240 -38
- data/test-unit/lib/test/unit/error.rb +4 -0
- data/test-unit/lib/test/unit/failure.rb +31 -5
- data/test-unit/lib/test/unit/notification.rb +8 -4
- data/test-unit/lib/test/unit/omission.rb +51 -3
- data/test-unit/lib/test/unit/pending.rb +4 -0
- data/test-unit/lib/test/unit/priority.rb +2 -3
- data/test-unit/lib/test/unit/testcase.rb +65 -7
- data/test-unit/lib/test/unit/testresult.rb +34 -2
- data/test-unit/lib/test/unit/ui/console/testrunner.rb +197 -45
- data/test-unit/lib/test/unit/ui/emacs/testrunner.rb +14 -0
- data/test-unit/lib/test/unit/ui/tap/testrunner.rb +2 -12
- data/test-unit/lib/test/unit/ui/testrunner.rb +33 -0
- data/test-unit/lib/test/unit/util/backtracefilter.rb +1 -0
- data/test-unit/lib/test/unit/util/output.rb +31 -0
- data/test-unit/lib/test/unit/version.rb +1 -1
- data/test-unit/sample/{tc_adder.rb → test_adder.rb} +3 -1
- data/test-unit/sample/{tc_subtracter.rb → test_subtracter.rb} +3 -1
- data/test-unit/sample/test_user.rb +1 -0
- data/test-unit/test/collector/test-descendant.rb +2 -4
- data/test-unit/test/collector/test-load.rb +121 -8
- data/test-unit/test/collector/test_objectspace.rb +7 -5
- data/test-unit/test/run-test.rb +2 -0
- data/test-unit/test/test-color-scheme.rb +11 -2
- data/test-unit/test/test-diff.rb +48 -7
- data/test-unit/test/test-omission.rb +1 -1
- data/test-unit/test/test-testcase.rb +57 -20
- data/test-unit/test/test_assertions.rb +128 -13
- data/test-unit/test/ui/test_tap.rb +33 -0
- data/test-unit/test/util/test-output.rb +11 -0
- data/test/active-groonga-test-utils.rb +50 -36
- data/test/fixtures/site.rb +2 -0
- data/test/run-test.rb +36 -9
- data/test/test-associations.rb +5 -2
- data/test/test-base.rb +39 -31
- data/test/test-callbacks.rb +13 -3
- data/test/test-persistence.rb +53 -0
- data/{lib/active_groonga/observer.rb → test/test-result-set.rb} +14 -12
- data/test/test-schema.rb +85 -22
- data/{lib/active_groonga/rails_support.rb → test/test-validations.rb} +15 -13
- metadata +85 -52
- data/lib/active_groonga/associations.rb +0 -93
- data/lib/active_groonga/associations/belongs_to_association.rb +0 -25
- data/lib/active_groonga/attribute_methods.rb +0 -36
- data/lib/active_groonga/column.rb +0 -137
- data/lib/active_groonga/dynamic_record_expression_builder.rb +0 -40
- data/lib/active_groonga/reflection.rb +0 -30
- data/lib/active_groonga/schema_dumper.rb +0 -163
- data/lib/active_groonga/tasks.rb +0 -16
- data/lib/active_groonga/tasks/groonga.rake +0 -164
- data/lib/active_groonga/timestamp.rb +0 -30
- data/rails/README +0 -28
- data/rails/init.rb +0 -70
- data/rails_generators/index_table_groonga/USAGE +0 -23
- data/rails_generators/index_table_groonga/index_table_groonga_generator.rb +0 -44
- data/rails_generators/index_table_groonga/templates/migration.rb +0 -12
- data/rails_generators/migration_groonga/USAGE +0 -29
- data/rails_generators/migration_groonga/migration_groonga_generator.rb +0 -19
- data/rails_generators/migration_groonga/templates/migration.rb +0 -11
- data/rails_generators/model_groonga/USAGE +0 -28
- data/rails_generators/model_groonga/model_groonga_generator.rb +0 -45
- data/rails_generators/model_groonga/templates/fixtures.yml +0 -17
- data/rails_generators/model_groonga/templates/migration.rb +0 -16
- data/rails_generators/model_groonga/templates/model.rb +0 -2
- data/rails_generators/model_groonga/templates/unit_test.rb +0 -8
- data/test-unit/html/classic.html +0 -15
- data/test-unit/sample/ts_examples.rb +0 -7
- data/test/test-schema-dumper.rb +0 -48
|
@@ -22,6 +22,20 @@ module Test
|
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
+
def output_fault_backtrace(fault)
|
|
26
|
+
backtrace = fault.location
|
|
27
|
+
if backtrace.size == 1
|
|
28
|
+
output(fault.test_name +
|
|
29
|
+
backtrace[0].sub(/\A(.+:\d+).*/, ' [\\1]') +
|
|
30
|
+
":")
|
|
31
|
+
else
|
|
32
|
+
output(fault.test_name)
|
|
33
|
+
backtrace.each do |entry|
|
|
34
|
+
output(entry)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
25
39
|
def format_fault_failure(failure)
|
|
26
40
|
if failure.location.size == 1
|
|
27
41
|
location = failure.location[0]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#--
|
|
2
2
|
#
|
|
3
3
|
# Author:: Kouhei Sutou.
|
|
4
|
-
# Copyright:: Copyright (c) 2009 Kouhei Sutou <kou@clear-code.com>.
|
|
4
|
+
# Copyright:: Copyright (c) 2009-2010 Kouhei Sutou <kou@clear-code.com>.
|
|
5
5
|
# License:: Ruby license.
|
|
6
6
|
|
|
7
7
|
require 'test/unit/ui/testrunner'
|
|
@@ -24,8 +24,7 @@ module Test
|
|
|
24
24
|
|
|
25
25
|
# Begins the test run.
|
|
26
26
|
def start
|
|
27
|
-
|
|
28
|
-
result = start_mediator
|
|
27
|
+
result = super
|
|
29
28
|
def result.passed?
|
|
30
29
|
true # for prove commend :<
|
|
31
30
|
end
|
|
@@ -33,11 +32,6 @@ module Test
|
|
|
33
32
|
end
|
|
34
33
|
|
|
35
34
|
private
|
|
36
|
-
def setup_mediator
|
|
37
|
-
@mediator = TestRunnerMediator.new(@suite)
|
|
38
|
-
attach_to_mediator
|
|
39
|
-
end
|
|
40
|
-
|
|
41
35
|
def attach_to_mediator
|
|
42
36
|
@mediator.add_listener(TestResult::FAULT, &method(:add_fault))
|
|
43
37
|
@mediator.add_listener(TestRunnerMediator::STARTED, &method(:started))
|
|
@@ -46,10 +40,6 @@ module Test
|
|
|
46
40
|
@mediator.add_listener(TestCase::FINISHED, &method(:test_finished))
|
|
47
41
|
end
|
|
48
42
|
|
|
49
|
-
def start_mediator
|
|
50
|
-
@mediator.run_suite
|
|
51
|
-
end
|
|
52
|
-
|
|
53
43
|
def add_fault(fault)
|
|
54
44
|
puts("not ok #{@n_tests} - #{fault.short_display}")
|
|
55
45
|
fault.long_display.each_line do |line|
|
|
@@ -6,6 +6,7 @@ module Test
|
|
|
6
6
|
class TestRunner
|
|
7
7
|
extend TestRunnerUtilities
|
|
8
8
|
|
|
9
|
+
attr_reader :listeners
|
|
9
10
|
def initialize(suite, options={})
|
|
10
11
|
if suite.respond_to?(:suite)
|
|
11
12
|
@suite = suite.suite
|
|
@@ -13,6 +14,38 @@ module Test
|
|
|
13
14
|
@suite = suite
|
|
14
15
|
end
|
|
15
16
|
@options = options
|
|
17
|
+
@listeners = @options[:listeners] || []
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# Begins the test run.
|
|
21
|
+
def start
|
|
22
|
+
setup_mediator
|
|
23
|
+
attach_to_mediator
|
|
24
|
+
attach_listeners
|
|
25
|
+
start_mediator
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
private
|
|
29
|
+
def setup_mediator
|
|
30
|
+
@mediator = TestRunnerMediator.new(@suite)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def attach_listeners
|
|
34
|
+
@listeners.each do |listener|
|
|
35
|
+
listener.attach_to_mediator(@mediator)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def start_mediator
|
|
40
|
+
@mediator.run_suite
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def diff_target_string?(string)
|
|
44
|
+
Assertions::AssertionMessage.diff_target_string?(string)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def prepare_for_diff(from, to)
|
|
48
|
+
Assertions::AssertionMessage.prepare_for_diff(from, to)
|
|
16
49
|
end
|
|
17
50
|
end
|
|
18
51
|
end
|
|
@@ -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
|
|
@@ -5,13 +5,15 @@
|
|
|
5
5
|
require 'test/unit'
|
|
6
6
|
require 'adder'
|
|
7
7
|
|
|
8
|
-
class
|
|
8
|
+
class TestAdder < Test::Unit::TestCase
|
|
9
9
|
def setup
|
|
10
10
|
@adder = Adder.new(5)
|
|
11
11
|
end
|
|
12
|
+
|
|
12
13
|
def test_add
|
|
13
14
|
assert_equal(7, @adder.add(2), "Should have added correctly")
|
|
14
15
|
end
|
|
16
|
+
|
|
15
17
|
def teardown
|
|
16
18
|
@adder = nil
|
|
17
19
|
end
|
|
@@ -5,13 +5,15 @@
|
|
|
5
5
|
require 'test/unit'
|
|
6
6
|
require 'subtracter'
|
|
7
7
|
|
|
8
|
-
class
|
|
8
|
+
class TestSubtracter < Test::Unit::TestCase
|
|
9
9
|
def setup
|
|
10
10
|
@subtracter = Subtracter.new(5)
|
|
11
11
|
end
|
|
12
|
+
|
|
12
13
|
def test_subtract
|
|
13
14
|
assert_equal(3, @subtracter.subtract(2), "Should have subtracted correctly")
|
|
14
15
|
end
|
|
16
|
+
|
|
15
17
|
def teardown
|
|
16
18
|
@subtracter = nil
|
|
17
19
|
end
|
|
@@ -66,7 +66,7 @@ class TestUnitCollectorDescendant < Test::Unit::TestCase
|
|
|
66
66
|
collector.filter = [Proc.new {false}, Proc.new {true}]
|
|
67
67
|
end
|
|
68
68
|
|
|
69
|
-
assert_collect(
|
|
69
|
+
assert_collect(empty_suite) do |collector|
|
|
70
70
|
collector.filter = [Proc.new {true}, Proc.new {false}]
|
|
71
71
|
end
|
|
72
72
|
|
|
@@ -90,13 +90,11 @@ class TestUnitCollectorDescendant < Test::Unit::TestCase
|
|
|
90
90
|
end
|
|
91
91
|
end
|
|
92
92
|
|
|
93
|
-
expected = empty_suite
|
|
94
93
|
suite1 = Test::Unit::TestSuite.new(@test_case1.name)
|
|
95
94
|
suite1 << @test_case1.new("test_1")
|
|
96
95
|
suite2 = Test::Unit::TestSuite.new(@test_case2.name)
|
|
97
96
|
suite2 << @test_case2.new("test_0")
|
|
98
|
-
|
|
99
|
-
assert_collect(expected) do |collector|
|
|
97
|
+
assert_collect(empty_suite) do |collector|
|
|
100
98
|
filters = [Proc.new {|test| test.method_name == 'test_1' ? true : nil},
|
|
101
99
|
Proc.new {|test| test.method_name == 'test_0' ? true : nil},
|
|
102
100
|
Proc.new {false}]
|
|
@@ -13,8 +13,9 @@ class TestUnitCollectorLoad < Test::Unit::TestCase
|
|
|
13
13
|
::Object.const_set(@temporary_test_cases_module_name, Module.new)
|
|
14
14
|
|
|
15
15
|
@test_dir = Pathname(Dir.tmpdir) + "test-unit"
|
|
16
|
-
@
|
|
17
|
-
@test_dir
|
|
16
|
+
@extra_test_dir = Pathname(Dir.tmpdir) + "test-unit-extra"
|
|
17
|
+
ensure_clean_directory(@test_dir)
|
|
18
|
+
ensure_clean_directory(@extra_test_dir)
|
|
18
19
|
end
|
|
19
20
|
|
|
20
21
|
setup
|
|
@@ -196,6 +197,72 @@ EOT
|
|
|
196
197
|
end
|
|
197
198
|
end
|
|
198
199
|
|
|
200
|
+
setup
|
|
201
|
+
def setup_sub_git_test_cases
|
|
202
|
+
@sub_git_test_dir = @sub_test_dir + ".git"
|
|
203
|
+
@sub_git_test_dir.mkpath
|
|
204
|
+
|
|
205
|
+
@sub_git_test_case11 = @sub_git_test_dir + "test_case11.rb"
|
|
206
|
+
|
|
207
|
+
@sub_git_test_case11.open("w") do |test_case|
|
|
208
|
+
test_case.puts(<<-EOT)
|
|
209
|
+
module #{@temporary_test_cases_module_name}
|
|
210
|
+
class SubGitTestCase11 < Test::Unit::TestCase
|
|
211
|
+
def test11
|
|
212
|
+
end
|
|
213
|
+
end
|
|
214
|
+
end
|
|
215
|
+
EOT
|
|
216
|
+
end
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
setup
|
|
220
|
+
def setup_extra_top_level_test_cases
|
|
221
|
+
@test_cases12 = @extra_test_dir + "test_cases12.rb"
|
|
222
|
+
@test_cases12.open("w") do |test_case|
|
|
223
|
+
test_case.puts(<<-EOT)
|
|
224
|
+
module #{@temporary_test_cases_module_name}
|
|
225
|
+
class TestCase121 < Test::Unit::TestCase
|
|
226
|
+
def test121_1
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
def test121_2
|
|
230
|
+
end
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
class TestCase122 < Test::Unit::TestCase
|
|
234
|
+
def test122_1
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
def test122_2
|
|
238
|
+
end
|
|
239
|
+
end
|
|
240
|
+
end
|
|
241
|
+
EOT
|
|
242
|
+
end
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
setup
|
|
246
|
+
def setup_sub_level_extra_test_cases
|
|
247
|
+
@sub_extra_test_dir = @extra_test_dir + "sub"
|
|
248
|
+
@sub_extra_test_dir.mkpath
|
|
249
|
+
|
|
250
|
+
@cases13_test = @sub_extra_test_dir + "13cases_test.rb"
|
|
251
|
+
@cases13_test.open("w") do |test_case|
|
|
252
|
+
test_case.puts(<<-EOT)
|
|
253
|
+
module #{@temporary_test_cases_module_name}
|
|
254
|
+
class SubTestCase13 < Test::Unit::TestCase
|
|
255
|
+
def test13_1
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
def test13_2
|
|
259
|
+
end
|
|
260
|
+
end
|
|
261
|
+
end
|
|
262
|
+
EOT
|
|
263
|
+
end
|
|
264
|
+
end
|
|
265
|
+
|
|
199
266
|
def teardown
|
|
200
267
|
@test_dir.rmtree if @test_dir.exist?
|
|
201
268
|
::Object.send(:remove_const, @temporary_test_cases_module_name)
|
|
@@ -212,6 +279,21 @@ EOT
|
|
|
212
279
|
@sub_test_dir.to_s)
|
|
213
280
|
end
|
|
214
281
|
|
|
282
|
+
def test_simple_collect_test_suffix
|
|
283
|
+
assert_collect([:suite, {:name => @extra_test_dir.basename.to_s},
|
|
284
|
+
[:suite, {:name => _test_case_name("TestCase121")},
|
|
285
|
+
[:test, {:name => "test121_1"}],
|
|
286
|
+
[:test, {:name => "test121_2"}]],
|
|
287
|
+
[:suite, {:name => _test_case_name("TestCase122")},
|
|
288
|
+
[:test, {:name => "test122_1"}],
|
|
289
|
+
[:test, {:name => "test122_2"}]],
|
|
290
|
+
[:suite, {:name => @sub_extra_test_dir.basename.to_s},
|
|
291
|
+
[:suite, {:name => _test_case_name("SubTestCase13")},
|
|
292
|
+
[:test, {:name => "test13_1"}],
|
|
293
|
+
[:test, {:name => "test13_2"}]]]],
|
|
294
|
+
@extra_test_dir.to_s)
|
|
295
|
+
end
|
|
296
|
+
|
|
215
297
|
def test_multilevel_collect
|
|
216
298
|
assert_collect([:suite, {:name => "."},
|
|
217
299
|
[:suite, {:name => _test_case_name("TestCase1")},
|
|
@@ -234,13 +316,39 @@ EOT
|
|
|
234
316
|
end
|
|
235
317
|
|
|
236
318
|
def test_collect_file
|
|
237
|
-
assert_collect([:suite, {:name =>
|
|
238
|
-
[:
|
|
239
|
-
|
|
240
|
-
[:test, {:name => "test1_2"}]]],
|
|
319
|
+
assert_collect([:suite, {:name => _test_case_name("TestCase1")},
|
|
320
|
+
[:test, {:name => "test1_1"}],
|
|
321
|
+
[:test, {:name => "test1_2"}]],
|
|
241
322
|
@test_case1.to_s)
|
|
323
|
+
end
|
|
242
324
|
|
|
243
|
-
|
|
325
|
+
def test_collect_file_no_pattern_match_file_name
|
|
326
|
+
assert_collect([:suite, {:name => _test_case_name("NoLoadSubTestCase5")},
|
|
327
|
+
[:test, {:name => "test5_1"}],
|
|
328
|
+
[:test, {:name => "test5_2"}]],
|
|
329
|
+
@no_load_sub_test_case5.to_s)
|
|
330
|
+
end
|
|
331
|
+
|
|
332
|
+
def test_collect_file_test_cases
|
|
333
|
+
assert_collect([:suite, {:name => "[#{@test_cases12}]"},
|
|
334
|
+
[:suite, {:name => _test_case_name("TestCase121")},
|
|
335
|
+
[:test, {:name => "test121_1"}],
|
|
336
|
+
[:test, {:name => "test121_2"}]],
|
|
337
|
+
[:suite, {:name => _test_case_name("TestCase122")},
|
|
338
|
+
[:test, {:name => "test122_1"}],
|
|
339
|
+
[:test, {:name => "test122_2"}]]],
|
|
340
|
+
@test_cases12.to_s)
|
|
341
|
+
end
|
|
342
|
+
|
|
343
|
+
def test_collect_files
|
|
344
|
+
assert_collect([:suite,
|
|
345
|
+
{:name => "[#{@test_case1}, #{@test_case2}]"},
|
|
346
|
+
[:suite, {:name => _test_case_name("TestCase1")},
|
|
347
|
+
[:test, {:name => "test1_1"}],
|
|
348
|
+
[:test, {:name => "test1_2"}]],
|
|
349
|
+
[:suite, {:name => _test_case_name("TestCase2")},
|
|
350
|
+
[:test, {:name => "test2"}]]],
|
|
351
|
+
@test_case1.to_s, @test_case2.to_s)
|
|
244
352
|
end
|
|
245
353
|
|
|
246
354
|
def test_nil_pattern
|
|
@@ -278,7 +386,7 @@ EOT
|
|
|
278
386
|
[:test, {:name => "test4_2"}]],
|
|
279
387
|
[:suite, {:name => _test_case_name("SubTestCase6")},
|
|
280
388
|
[:test, {:name => "test6"}]]],
|
|
281
|
-
|
|
389
|
+
[:suite, {:name => @sub2_test_dir.basename.to_s},
|
|
282
390
|
[:suite, {:name => _test_case_name("Sub2TestCase8")},
|
|
283
391
|
[:test, {:name => "test8_1"}],
|
|
284
392
|
[:test, {:name => "test8_2"}]],
|
|
@@ -299,6 +407,11 @@ EOT
|
|
|
299
407
|
end
|
|
300
408
|
end
|
|
301
409
|
|
|
410
|
+
def ensure_clean_directory(directory)
|
|
411
|
+
directory.rmtree if directory.exist?
|
|
412
|
+
directory.mkpath
|
|
413
|
+
end
|
|
414
|
+
|
|
302
415
|
def keep_required_files
|
|
303
416
|
required_files = $".dup
|
|
304
417
|
yield
|
|
@@ -72,7 +72,7 @@ module Test
|
|
|
72
72
|
assert_equal(empty_suite, @c.collect)
|
|
73
73
|
|
|
74
74
|
@c.filter = [proc{true}, proc{false}]
|
|
75
|
-
assert_equal(
|
|
75
|
+
assert_equal(empty_suite, @c.collect)
|
|
76
76
|
|
|
77
77
|
@c.filter = [proc{nil}, proc{false}]
|
|
78
78
|
assert_equal(empty_suite, @c.collect)
|
|
@@ -87,10 +87,12 @@ module Test
|
|
|
87
87
|
assert_equal(expected, @c.collect)
|
|
88
88
|
|
|
89
89
|
expected = TestSuite.new(ObjectSpace::NAME)
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
@c.filter = [proc{|t| t.method_name == 'test_1' ? true : nil},
|
|
93
|
-
|
|
90
|
+
TestSuite.new(@tc1.name) << @tc1.new('test_1')
|
|
91
|
+
TestSuite.new(@tc2.name) << @tc2.new('test_0')
|
|
92
|
+
@c.filter = [proc{|t| t.method_name == 'test_1' ? true : nil},
|
|
93
|
+
proc{|t| t.method_name == 'test_0' ? true : nil},
|
|
94
|
+
proc{false}]
|
|
95
|
+
assert_equal(empty_suite, @c.collect)
|
|
94
96
|
end
|
|
95
97
|
end
|
|
96
98
|
end
|
data/test-unit/test/run-test.rb
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
class TestUnitColorScheme < Test::Unit::TestCase
|
|
2
2
|
def test_default
|
|
3
3
|
assert_equal({
|
|
4
|
-
"
|
|
5
|
-
|
|
4
|
+
"pass" => color("green", :foreground => false) +
|
|
5
|
+
color("white", :bold => true),
|
|
6
|
+
"failure" => color("red", :foreground => false) +
|
|
7
|
+
color("white", :bold => true),
|
|
6
8
|
"pending" => color("magenta", :bold => true),
|
|
7
9
|
"omission" => color("blue", :bold => true),
|
|
8
10
|
"notification" => color("cyan", :bold => true),
|
|
@@ -12,6 +14,13 @@ class TestUnitColorScheme < Test::Unit::TestCase
|
|
|
12
14
|
color("blue", :foreground => false),
|
|
13
15
|
"suite" => color("white", :bold => true) +
|
|
14
16
|
color("green", :foreground => false),
|
|
17
|
+
"diff-inserted-tag" => color("red", :bold => true),
|
|
18
|
+
"diff-deleted-tag" => color("green", :bold => true),
|
|
19
|
+
"diff-difference-tag" => color("cyan", :bold => true),
|
|
20
|
+
"diff-inserted" => color("red", :foreground => false) +
|
|
21
|
+
color("white", :bold => true),
|
|
22
|
+
"diff-deleted" => color("green", :foreground => false) +
|
|
23
|
+
color("white", :bold => true),
|
|
15
24
|
},
|
|
16
25
|
Test::Unit::ColorScheme.default.to_hash)
|
|
17
26
|
end
|