activesambaldap 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +21 -0
- data/NEWS.en +1 -1
- data/NEWS.ja +1 -1
- data/README.en +12 -8
- data/README.ja +6 -3
- data/Rakefile +27 -121
- data/lib/active_samba_ldap.rb +1 -1
- data/lib/active_samba_ldap/get_text_support.rb +1 -1
- data/lib/active_samba_ldap/version.rb +1 -1
- data/license/lgpl-2.1.txt +165 -0
- data/po/ja/active-samba-ldap.po +2 -2
- data/test/run-test.rb +3 -3
- metadata +145 -277
- data/bin/asl-groupadd.help +0 -16
- data/bin/asl-groupdel.help +0 -13
- data/bin/asl-groupmod.help +0 -19
- data/bin/asl-groupshow.help +0 -11
- data/bin/asl-passwd.help +0 -15
- data/bin/asl-populate.help +0 -28
- data/bin/asl-purge.help +0 -11
- data/bin/asl-samba-computeradd.help +0 -13
- data/bin/asl-samba-groupadd.help +0 -11
- data/bin/asl-samba-groupdel.help +0 -11
- data/bin/asl-samba-groupmod.help +0 -15
- data/bin/asl-samba-useradd.help +0 -13
- data/bin/asl-samba-userdel.help +0 -11
- data/bin/asl-samba-usermod.help +0 -15
- data/bin/asl-useradd.help +0 -49
- data/bin/asl-userdel.help +0 -18
- data/bin/asl-usermod.help +0 -47
- data/bin/asl-usershow.help +0 -11
- data/data/locale/ja/LC_MESSAGES/active-samba-ldap.mo +0 -0
- data/example/asl-admin/README +0 -243
- data/example/asl-admin/Rakefile +0 -10
- data/example/asl-admin/app/controllers/application_controller.rb +0 -10
- data/example/asl-admin/app/controllers/samba_controller.rb +0 -12
- data/example/asl-admin/app/helpers/application_helper.rb +0 -3
- data/example/asl-admin/app/helpers/samba_helper.rb +0 -2
- data/example/asl-admin/app/models/computer.rb +0 -3
- data/example/asl-admin/app/models/dc.rb +0 -3
- data/example/asl-admin/app/models/group.rb +0 -3
- data/example/asl-admin/app/models/idmap.rb +0 -3
- data/example/asl-admin/app/models/ou.rb +0 -3
- data/example/asl-admin/app/models/unix_id_pool.rb +0 -3
- data/example/asl-admin/app/models/user.rb +0 -3
- data/example/asl-admin/app/views/samba/index.html.erb +0 -17
- data/example/asl-admin/app/views/samba/populate.html.erb +0 -15
- data/example/asl-admin/app/views/samba/purge.html.erb +0 -10
- data/example/asl-admin/config/boot.rb +0 -110
- data/example/asl-admin/config/database.yml +0 -22
- data/example/asl-admin/config/environment.rb +0 -48
- data/example/asl-admin/config/environments/development.rb +0 -17
- data/example/asl-admin/config/environments/production.rb +0 -28
- data/example/asl-admin/config/environments/test.rb +0 -28
- data/example/asl-admin/config/initializers/backtrace_silencers.rb +0 -7
- data/example/asl-admin/config/initializers/inflections.rb +0 -10
- data/example/asl-admin/config/initializers/mime_types.rb +0 -5
- data/example/asl-admin/config/initializers/new_rails_defaults.rb +0 -19
- data/example/asl-admin/config/initializers/session_store.rb +0 -15
- data/example/asl-admin/config/ldap.yml.sample +0 -24
- data/example/asl-admin/config/locales/en.yml +0 -5
- data/example/asl-admin/config/routes.rb +0 -43
- data/example/asl-admin/log/test.log +0 -5
- data/example/asl-admin/public/404.html +0 -30
- data/example/asl-admin/public/422.html +0 -30
- data/example/asl-admin/public/500.html +0 -30
- data/example/asl-admin/public/favicon.ico +0 -0
- data/example/asl-admin/public/images/rails.png +0 -0
- data/example/asl-admin/public/index.html +0 -275
- data/example/asl-admin/public/javascripts/application.js +0 -2
- data/example/asl-admin/public/javascripts/controls.js +0 -963
- data/example/asl-admin/public/javascripts/dragdrop.js +0 -973
- data/example/asl-admin/public/javascripts/effects.js +0 -1128
- data/example/asl-admin/public/javascripts/prototype.js +0 -4320
- data/example/asl-admin/public/robots.txt +0 -5
- data/example/asl-admin/script/about +0 -4
- data/example/asl-admin/script/console +0 -3
- data/example/asl-admin/script/dbconsole +0 -3
- data/example/asl-admin/script/destroy +0 -3
- data/example/asl-admin/script/generate +0 -3
- data/example/asl-admin/script/performance/benchmarker +0 -3
- data/example/asl-admin/script/performance/profiler +0 -3
- data/example/asl-admin/script/plugin +0 -3
- data/example/asl-admin/script/runner +0 -3
- data/example/asl-admin/script/server +0 -3
- data/example/asl-admin/test/performance/browsing_test.rb +0 -9
- data/example/asl-admin/test/test_helper.rb +0 -38
- data/po/active-samba-ldap.pot +0 -463
- data/rails_generators/scaffold_active_samba_ldap/scaffold_active_samba_ldap_generator.rb +0 -28
- data/rails_generators/scaffold_active_samba_ldap/templates/computer.rb +0 -3
- data/rails_generators/scaffold_active_samba_ldap/templates/dc.rb +0 -3
- data/rails_generators/scaffold_active_samba_ldap/templates/group.rb +0 -3
- data/rails_generators/scaffold_active_samba_ldap/templates/idmap.rb +0 -3
- data/rails_generators/scaffold_active_samba_ldap/templates/ldap.yml +0 -24
- data/rails_generators/scaffold_active_samba_ldap/templates/ou.rb +0 -3
- data/rails_generators/scaffold_active_samba_ldap/templates/samba_controller.rb +0 -12
- data/rails_generators/scaffold_active_samba_ldap/templates/samba_helper.rb +0 -2
- data/rails_generators/scaffold_active_samba_ldap/templates/samba_index.html.erb +0 -17
- data/rails_generators/scaffold_active_samba_ldap/templates/samba_populate.html.erb +0 -15
- data/rails_generators/scaffold_active_samba_ldap/templates/samba_purge.html.erb +0 -10
- data/rails_generators/scaffold_active_samba_ldap/templates/unix_id_pool.rb +0 -3
- data/rails_generators/scaffold_active_samba_ldap/templates/user.rb +0 -3
- data/setup.rb +0 -1585
- data/test-unit/History.txt +0 -107
- data/test-unit/README.txt +0 -52
- data/test-unit/Rakefile +0 -40
- data/test-unit/TODO +0 -5
- data/test-unit/bin/testrb +0 -5
- data/test-unit/lib/test/unit.rb +0 -342
- data/test-unit/lib/test/unit/assertionfailederror.rb +0 -14
- data/test-unit/lib/test/unit/assertions.rb +0 -1149
- data/test-unit/lib/test/unit/attribute.rb +0 -125
- data/test-unit/lib/test/unit/autorunner.rb +0 -344
- data/test-unit/lib/test/unit/collector.rb +0 -43
- data/test-unit/lib/test/unit/collector/descendant.rb +0 -23
- data/test-unit/lib/test/unit/collector/dir.rb +0 -108
- data/test-unit/lib/test/unit/collector/load.rb +0 -137
- data/test-unit/lib/test/unit/collector/objectspace.rb +0 -34
- data/test-unit/lib/test/unit/color-scheme.rb +0 -90
- data/test-unit/lib/test/unit/color.rb +0 -96
- data/test-unit/lib/test/unit/diff.rb +0 -538
- data/test-unit/lib/test/unit/error.rb +0 -126
- data/test-unit/lib/test/unit/exceptionhandler.rb +0 -39
- data/test-unit/lib/test/unit/failure.rb +0 -110
- data/test-unit/lib/test/unit/fixture.rb +0 -176
- data/test-unit/lib/test/unit/notification.rb +0 -125
- data/test-unit/lib/test/unit/omission.rb +0 -143
- data/test-unit/lib/test/unit/pending.rb +0 -146
- data/test-unit/lib/test/unit/priority.rb +0 -181
- data/test-unit/lib/test/unit/runner/console.rb +0 -52
- data/test-unit/lib/test/unit/runner/emacs.rb +0 -8
- data/test-unit/lib/test/unit/runner/tap.rb +0 -8
- data/test-unit/lib/test/unit/testcase.rb +0 -425
- data/test-unit/lib/test/unit/testresult.rb +0 -89
- data/test-unit/lib/test/unit/testsuite.rb +0 -110
- data/test-unit/lib/test/unit/ui/console/outputlevel.rb +0 -14
- data/test-unit/lib/test/unit/ui/console/testrunner.rb +0 -278
- data/test-unit/lib/test/unit/ui/emacs/testrunner.rb +0 -49
- data/test-unit/lib/test/unit/ui/tap/testrunner.rb +0 -92
- data/test-unit/lib/test/unit/ui/testrunner.rb +0 -20
- data/test-unit/lib/test/unit/ui/testrunnermediator.rb +0 -77
- data/test-unit/lib/test/unit/ui/testrunnerutilities.rb +0 -41
- data/test-unit/lib/test/unit/util/backtracefilter.rb +0 -41
- data/test-unit/lib/test/unit/util/method-owner-finder.rb +0 -28
- data/test-unit/lib/test/unit/util/observable.rb +0 -90
- data/test-unit/lib/test/unit/util/procwrapper.rb +0 -48
- data/test-unit/lib/test/unit/version.rb +0 -7
- data/test-unit/sample/adder.rb +0 -13
- data/test-unit/sample/subtracter.rb +0 -12
- data/test-unit/sample/tc_adder.rb +0 -18
- data/test-unit/sample/tc_subtracter.rb +0 -18
- data/test-unit/sample/test_user.rb +0 -22
- data/test-unit/sample/ts_examples.rb +0 -7
- data/test-unit/test/collector/test-descendant.rb +0 -135
- data/test-unit/test/collector/test-load.rb +0 -329
- data/test-unit/test/collector/test_dir.rb +0 -406
- data/test-unit/test/collector/test_objectspace.rb +0 -98
- data/test-unit/test/run-test.rb +0 -13
- data/test-unit/test/test-attribute.rb +0 -86
- data/test-unit/test/test-color-scheme.rb +0 -60
- data/test-unit/test/test-color.rb +0 -47
- data/test-unit/test/test-diff.rb +0 -477
- data/test-unit/test/test-emacs-runner.rb +0 -60
- data/test-unit/test/test-fixture.rb +0 -287
- data/test-unit/test/test-notification.rb +0 -33
- data/test-unit/test/test-omission.rb +0 -81
- data/test-unit/test/test-pending.rb +0 -70
- data/test-unit/test/test-priority.rb +0 -119
- data/test-unit/test/test-testcase.rb +0 -507
- data/test-unit/test/test_assertions.rb +0 -1082
- data/test-unit/test/test_error.rb +0 -26
- data/test-unit/test/test_failure.rb +0 -33
- data/test-unit/test/test_testresult.rb +0 -113
- data/test-unit/test/test_testsuite.rb +0 -129
- data/test-unit/test/testunit-test-util.rb +0 -14
- data/test-unit/test/ui/test_testrunmediator.rb +0 -20
- data/test-unit/test/util/test-method-owner-finder.rb +0 -38
- data/test-unit/test/util/test_backtracefilter.rb +0 -41
- data/test-unit/test/util/test_observable.rb +0 -102
- data/test-unit/test/util/test_procwrapper.rb +0 -36
@@ -1,48 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
#
|
3
|
-
# Author:: Nathaniel Talbott.
|
4
|
-
# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
|
5
|
-
# License:: Ruby license.
|
6
|
-
|
7
|
-
module Test
|
8
|
-
module Unit
|
9
|
-
module Util
|
10
|
-
|
11
|
-
# Allows the storage of a Proc passed through '&' in a
|
12
|
-
# hash.
|
13
|
-
#
|
14
|
-
# Note: this may be inefficient, since the hash being
|
15
|
-
# used is not necessarily very good. In Observable,
|
16
|
-
# efficiency is not too important, since the hash is
|
17
|
-
# only accessed when adding and removing listeners,
|
18
|
-
# not when notifying.
|
19
|
-
|
20
|
-
class ProcWrapper
|
21
|
-
|
22
|
-
# Creates a new wrapper for a_proc.
|
23
|
-
def initialize(a_proc)
|
24
|
-
@a_proc = a_proc
|
25
|
-
@hash = a_proc.inspect.sub(/^(#<#{a_proc.class}:)/){''}.sub(/(>)$/){''}.hex
|
26
|
-
end
|
27
|
-
|
28
|
-
def hash
|
29
|
-
return @hash
|
30
|
-
end
|
31
|
-
|
32
|
-
def ==(other)
|
33
|
-
case(other)
|
34
|
-
when ProcWrapper
|
35
|
-
return @a_proc == other.to_proc
|
36
|
-
else
|
37
|
-
return super
|
38
|
-
end
|
39
|
-
end
|
40
|
-
alias :eql? :==
|
41
|
-
|
42
|
-
def to_proc
|
43
|
-
return @a_proc
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
data/test-unit/sample/adder.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
# Author:: Nathaniel Talbott.
|
2
|
-
# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
|
3
|
-
# License:: Ruby license.
|
4
|
-
|
5
|
-
class Adder
|
6
|
-
def initialize(number)
|
7
|
-
@number = number
|
8
|
-
end
|
9
|
-
def add(number)
|
10
|
-
return @number + number
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
@@ -1,12 +0,0 @@
|
|
1
|
-
# Author:: Nathaniel Talbott.
|
2
|
-
# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
|
3
|
-
# License:: Ruby license.
|
4
|
-
|
5
|
-
class Subtracter
|
6
|
-
def initialize(number)
|
7
|
-
@number = number
|
8
|
-
end
|
9
|
-
def subtract(number)
|
10
|
-
return @number - number
|
11
|
-
end
|
12
|
-
end
|
@@ -1,18 +0,0 @@
|
|
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
|
-
require 'adder'
|
7
|
-
|
8
|
-
class TC_Adder < Test::Unit::TestCase
|
9
|
-
def setup
|
10
|
-
@adder = Adder.new(5)
|
11
|
-
end
|
12
|
-
def test_add
|
13
|
-
assert_equal(7, @adder.add(2), "Should have added correctly")
|
14
|
-
end
|
15
|
-
def teardown
|
16
|
-
@adder = nil
|
17
|
-
end
|
18
|
-
end
|
@@ -1,18 +0,0 @@
|
|
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
|
-
require 'subtracter'
|
7
|
-
|
8
|
-
class TC_Subtracter < Test::Unit::TestCase
|
9
|
-
def setup
|
10
|
-
@subtracter = Subtracter.new(5)
|
11
|
-
end
|
12
|
-
def test_subtract
|
13
|
-
assert_equal(3, @subtracter.subtract(2), "Should have subtracted correctly")
|
14
|
-
end
|
15
|
-
def teardown
|
16
|
-
@subtracter = nil
|
17
|
-
end
|
18
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# nested test case example.
|
2
|
-
|
3
|
-
class UserTest < Test::Unit::TestCase
|
4
|
-
def setup
|
5
|
-
@user = "me"
|
6
|
-
end
|
7
|
-
|
8
|
-
def test_full_name
|
9
|
-
assert_equal("me", @user)
|
10
|
-
end
|
11
|
-
|
12
|
-
class ProfileTest < UserTest
|
13
|
-
setup
|
14
|
-
def setup_profile
|
15
|
-
@user += ": profile"
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_has_profile
|
19
|
-
assert_match(/: profile/, @user)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,135 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
require 'test/unit/collector/descendant'
|
3
|
-
|
4
|
-
class TestUnitCollectorDescendant < Test::Unit::TestCase
|
5
|
-
def setup
|
6
|
-
@previous_descendants = Test::Unit::TestCase::DESCENDANTS.dup
|
7
|
-
Test::Unit::TestCase::DESCENDANTS.clear
|
8
|
-
|
9
|
-
@test_case1 = Class.new(Test::Unit::TestCase) do
|
10
|
-
def self.name
|
11
|
-
"test-case1"
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_1
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_2
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
@test_case2 = Class.new(Test::Unit::TestCase) do
|
22
|
-
def self.name
|
23
|
-
"test-case2"
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_0
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
@no_test_case = Class.new do
|
31
|
-
def self.name
|
32
|
-
"no-test-case"
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_4
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def teardown
|
41
|
-
Test::Unit::TestCase::DESCENDANTS.replace(@previous_descendants)
|
42
|
-
end
|
43
|
-
|
44
|
-
def test_basic_collection
|
45
|
-
assert_collect(full_suite("name"), "name")
|
46
|
-
|
47
|
-
assert_collect(full_suite("name"), "name") do |collector|
|
48
|
-
collector.filter = []
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
def test_filtered_collection
|
53
|
-
assert_collect(empty_suite) do |collector|
|
54
|
-
collector.filter = Proc.new {false}
|
55
|
-
end
|
56
|
-
|
57
|
-
assert_collect(full_suite) do |collector|
|
58
|
-
collector.filter = Proc.new {true}
|
59
|
-
end
|
60
|
-
|
61
|
-
assert_collect(full_suite) do |collector|
|
62
|
-
collector.filter = Proc.new {nil}
|
63
|
-
end
|
64
|
-
|
65
|
-
assert_collect(empty_suite) do |collector|
|
66
|
-
collector.filter = [Proc.new {false}, Proc.new {true}]
|
67
|
-
end
|
68
|
-
|
69
|
-
assert_collect(full_suite) do |collector|
|
70
|
-
collector.filter = [Proc.new {true}, Proc.new {false}]
|
71
|
-
end
|
72
|
-
|
73
|
-
assert_collect(empty_suite) do |collector|
|
74
|
-
collector.filter = [Proc.new {nil}, Proc.new {false}]
|
75
|
-
end
|
76
|
-
|
77
|
-
assert_collect(full_suite) do |collector|
|
78
|
-
collector.filter = [Proc.new {nil}, Proc.new {true}]
|
79
|
-
end
|
80
|
-
|
81
|
-
expected = empty_suite
|
82
|
-
suite1 = Test::Unit::TestSuite.new(@test_case1.name)
|
83
|
-
suite1 << @test_case1.new("test_1")
|
84
|
-
suite2 = Test::Unit::TestSuite.new(@test_case2.name)
|
85
|
-
suite2 << @test_case2.new("test_0")
|
86
|
-
expected << suite1 << suite2
|
87
|
-
assert_collect(expected) do |collector|
|
88
|
-
collector.filter = Proc.new do |test|
|
89
|
-
['test_1', 'test_0'].include?(test.method_name)
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
expected = empty_suite
|
94
|
-
suite1 = Test::Unit::TestSuite.new(@test_case1.name)
|
95
|
-
suite1 << @test_case1.new("test_1")
|
96
|
-
suite2 = Test::Unit::TestSuite.new(@test_case2.name)
|
97
|
-
suite2 << @test_case2.new("test_0")
|
98
|
-
expected << suite1 << suite2
|
99
|
-
assert_collect(expected) do |collector|
|
100
|
-
filters = [Proc.new {|test| test.method_name == 'test_1' ? true : nil},
|
101
|
-
Proc.new {|test| test.method_name == 'test_0' ? true : nil},
|
102
|
-
Proc.new {false}]
|
103
|
-
collector.filter = filters
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
private
|
108
|
-
def assert_collect(expected, *collect_args)
|
109
|
-
collector = Test::Unit::Collector::Descendant.new
|
110
|
-
yield(collector) if block_given?
|
111
|
-
assert_equal(expected, collector.send(:collect, *collect_args))
|
112
|
-
end
|
113
|
-
|
114
|
-
def default_name
|
115
|
-
Test::Unit::Collector::Descendant::NAME
|
116
|
-
end
|
117
|
-
|
118
|
-
def empty_suite(name=nil)
|
119
|
-
Test::Unit::TestSuite.new(name || default_name)
|
120
|
-
end
|
121
|
-
|
122
|
-
def full_suite(name=nil)
|
123
|
-
sub_suite1 = Test::Unit::TestSuite.new(@test_case1.name)
|
124
|
-
sub_suite1 << @test_case1.new('test_1')
|
125
|
-
sub_suite1 << @test_case1.new('test_2')
|
126
|
-
|
127
|
-
sub_suite2 = Test::Unit::TestSuite.new(@test_case2.name)
|
128
|
-
sub_suite2 << @test_case2.new('test_0')
|
129
|
-
|
130
|
-
suite = empty_suite(name)
|
131
|
-
suite << sub_suite1
|
132
|
-
suite << sub_suite2
|
133
|
-
suite
|
134
|
-
end
|
135
|
-
end
|
@@ -1,329 +0,0 @@
|
|
1
|
-
require 'tmpdir'
|
2
|
-
require 'pathname'
|
3
|
-
|
4
|
-
require 'test/unit'
|
5
|
-
require 'test/unit/collector/load'
|
6
|
-
|
7
|
-
class TestUnitCollectorLoad < Test::Unit::TestCase
|
8
|
-
def setup
|
9
|
-
@previous_descendants = Test::Unit::TestCase::DESCENDANTS.dup
|
10
|
-
Test::Unit::TestCase::DESCENDANTS.clear
|
11
|
-
|
12
|
-
@temporary_test_cases_module_name = "TempTestCases"
|
13
|
-
::Object.const_set(@temporary_test_cases_module_name, Module.new)
|
14
|
-
|
15
|
-
@test_dir = Pathname(Dir.tmpdir) + "test-unit"
|
16
|
-
@test_dir.rmtree if @test_dir.exist?
|
17
|
-
@test_dir.mkpath
|
18
|
-
end
|
19
|
-
|
20
|
-
setup
|
21
|
-
def setup_top_level_test_cases
|
22
|
-
@test_case1 = @test_dir + "test_case1.rb"
|
23
|
-
@test_case2 = @test_dir + "test_case2.rb"
|
24
|
-
@no_load_test_case3 = @test_dir + "case3.rb"
|
25
|
-
|
26
|
-
@test_case1.open("w") do |test_case|
|
27
|
-
test_case.puts(<<-EOT)
|
28
|
-
module #{@temporary_test_cases_module_name}
|
29
|
-
class TestCase1 < Test::Unit::TestCase
|
30
|
-
def test1_1
|
31
|
-
end
|
32
|
-
|
33
|
-
def test1_2
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
EOT
|
38
|
-
end
|
39
|
-
|
40
|
-
@test_case2.open("w") do |test_case|
|
41
|
-
test_case.puts(<<-EOT)
|
42
|
-
module #{@temporary_test_cases_module_name}
|
43
|
-
class TestCase2 < Test::Unit::TestCase
|
44
|
-
def test2
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
EOT
|
49
|
-
end
|
50
|
-
|
51
|
-
@no_load_test_case3.open("w") do |test_case|
|
52
|
-
test_case.puts(<<-EOT)
|
53
|
-
module #{@temporary_test_cases_module_name}
|
54
|
-
class NoLoadTestCase3 < Test::Unit::TestCase
|
55
|
-
def test3
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
EOT
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
setup
|
64
|
-
def setup_sub_level_test_cases
|
65
|
-
@sub_test_dir = @test_dir + "sub"
|
66
|
-
@sub_test_dir.mkpath
|
67
|
-
|
68
|
-
@sub_test_case4 = @sub_test_dir + "test_case4.rb"
|
69
|
-
@no_load_sub_test_case5 = @sub_test_dir + "case5.rb"
|
70
|
-
@sub_test_case6 = @sub_test_dir + "test_case6.rb"
|
71
|
-
|
72
|
-
@sub_test_case4.open("w") do |test_case|
|
73
|
-
test_case.puts(<<-EOT)
|
74
|
-
module #{@temporary_test_cases_module_name}
|
75
|
-
class SubTestCase4 < Test::Unit::TestCase
|
76
|
-
def test4_1
|
77
|
-
end
|
78
|
-
|
79
|
-
def test4_2
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
EOT
|
84
|
-
end
|
85
|
-
|
86
|
-
@no_load_sub_test_case5.open("w") do |test_case|
|
87
|
-
test_case.puts(<<-EOT)
|
88
|
-
module #{@temporary_test_cases_module_name}
|
89
|
-
class NoLoadSubTestCase5 < Test::Unit::TestCase
|
90
|
-
def test5_1
|
91
|
-
end
|
92
|
-
|
93
|
-
def test5_2
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
EOT
|
98
|
-
end
|
99
|
-
|
100
|
-
@sub_test_case6.open("w") do |test_case|
|
101
|
-
test_case.puts(<<-EOT)
|
102
|
-
module #{@temporary_test_cases_module_name}
|
103
|
-
class SubTestCase6 < Test::Unit::TestCase
|
104
|
-
def test6
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
EOT
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
setup
|
113
|
-
def setup_sub_level_test_cases2
|
114
|
-
@sub2_test_dir = @test_dir + "sub2"
|
115
|
-
@sub2_test_dir.mkpath
|
116
|
-
|
117
|
-
@no_load_sub2_test_case7 = @sub2_test_dir + "case7.rb"
|
118
|
-
@sub2_test_case8 = @sub2_test_dir + "test_case8.rb"
|
119
|
-
@sub2_test_case9 = @sub2_test_dir + "test_case9.rb"
|
120
|
-
|
121
|
-
@no_load_sub2_test_case7.open("w") do |test_case|
|
122
|
-
test_case.puts(<<-EOT)
|
123
|
-
module #{@temporary_test_cases_module_name}
|
124
|
-
class NoLoadSub2TestCase7 < Test::Unit::TestCase
|
125
|
-
def test7_1
|
126
|
-
end
|
127
|
-
|
128
|
-
def test7_2
|
129
|
-
end
|
130
|
-
end
|
131
|
-
end
|
132
|
-
EOT
|
133
|
-
end
|
134
|
-
|
135
|
-
@sub2_test_case8.open("w") do |test_case|
|
136
|
-
test_case.puts(<<-EOT)
|
137
|
-
module #{@temporary_test_cases_module_name}
|
138
|
-
class Sub2TestCase8 < Test::Unit::TestCase
|
139
|
-
def test8_1
|
140
|
-
end
|
141
|
-
|
142
|
-
def test8_2
|
143
|
-
end
|
144
|
-
end
|
145
|
-
end
|
146
|
-
EOT
|
147
|
-
end
|
148
|
-
|
149
|
-
@sub2_test_case9.open("w") do |test_case|
|
150
|
-
test_case.puts(<<-EOT)
|
151
|
-
module #{@temporary_test_cases_module_name}
|
152
|
-
class Sub2TestCase9 < Test::Unit::TestCase
|
153
|
-
def test9
|
154
|
-
end
|
155
|
-
end
|
156
|
-
end
|
157
|
-
EOT
|
158
|
-
end
|
159
|
-
end
|
160
|
-
|
161
|
-
setup
|
162
|
-
def setup_svn_test_cases
|
163
|
-
@svn_test_dir = @test_dir + ".svn"
|
164
|
-
@svn_test_dir.mkpath
|
165
|
-
|
166
|
-
@svn_test_case10 = @svn_test_dir + "test_case10.rb"
|
167
|
-
|
168
|
-
@svn_test_case10.open("w") do |test_case|
|
169
|
-
test_case.puts(<<-EOT)
|
170
|
-
module #{@temporary_test_cases_module_name}
|
171
|
-
class SvnTestCase10 < Test::Unit::TestCase
|
172
|
-
def test7
|
173
|
-
end
|
174
|
-
end
|
175
|
-
end
|
176
|
-
EOT
|
177
|
-
end
|
178
|
-
end
|
179
|
-
|
180
|
-
setup
|
181
|
-
def setup_sub_cvs_test_cases
|
182
|
-
@sub_cvs_test_dir = @sub_test_dir + "CVS"
|
183
|
-
@sub_cvs_test_dir.mkpath
|
184
|
-
|
185
|
-
@sub_cvs_test_case11 = @sub_cvs_test_dir + "test_case11.rb"
|
186
|
-
|
187
|
-
@sub_cvs_test_case11.open("w") do |test_case|
|
188
|
-
test_case.puts(<<-EOT)
|
189
|
-
module #{@temporary_test_cases_module_name}
|
190
|
-
class SubCVSTestCase11 < Test::Unit::TestCase
|
191
|
-
def test11
|
192
|
-
end
|
193
|
-
end
|
194
|
-
end
|
195
|
-
EOT
|
196
|
-
end
|
197
|
-
end
|
198
|
-
|
199
|
-
def teardown
|
200
|
-
@test_dir.rmtree if @test_dir.exist?
|
201
|
-
::Object.send(:remove_const, @temporary_test_cases_module_name)
|
202
|
-
Test::Unit::TestCase::DESCENDANTS.replace(@previous_descendants)
|
203
|
-
end
|
204
|
-
|
205
|
-
def test_simple_collect
|
206
|
-
assert_collect([:suite, {:name => @sub_test_dir.basename.to_s},
|
207
|
-
[:suite, {:name => _test_case_name("SubTestCase4")},
|
208
|
-
[:test, {:name => "test4_1"}],
|
209
|
-
[:test, {:name => "test4_2"}]],
|
210
|
-
[:suite, {:name => _test_case_name("SubTestCase6")},
|
211
|
-
[:test, {:name => "test6"}]]],
|
212
|
-
@sub_test_dir.to_s)
|
213
|
-
end
|
214
|
-
|
215
|
-
def test_multilevel_collect
|
216
|
-
assert_collect([:suite, {:name => "."},
|
217
|
-
[:suite, {:name => _test_case_name("TestCase1")},
|
218
|
-
[:test, {:name => "test1_1"}],
|
219
|
-
[:test, {:name => "test1_2"}]],
|
220
|
-
[:suite, {:name => _test_case_name("TestCase2")},
|
221
|
-
[:test, {:name => "test2"}]],
|
222
|
-
[:suite, {:name => @sub_test_dir.basename.to_s},
|
223
|
-
[:suite, {:name => _test_case_name("SubTestCase4")},
|
224
|
-
[:test, {:name => "test4_1"}],
|
225
|
-
[:test, {:name => "test4_2"}]],
|
226
|
-
[:suite, {:name => _test_case_name("SubTestCase6")},
|
227
|
-
[:test, {:name => "test6"}]]],
|
228
|
-
[:suite, {:name => @sub2_test_dir.basename.to_s},
|
229
|
-
[:suite, {:name => _test_case_name("Sub2TestCase8")},
|
230
|
-
[:test, {:name => "test8_1"}],
|
231
|
-
[:test, {:name => "test8_2"}]],
|
232
|
-
[:suite, {:name => _test_case_name("Sub2TestCase9")},
|
233
|
-
[:test, {:name => "test9"}]]]])
|
234
|
-
end
|
235
|
-
|
236
|
-
def test_collect_file
|
237
|
-
assert_collect([:suite, {:name => @test_case1.basename.to_s},
|
238
|
-
[:suite, {:name => _test_case_name("TestCase1")},
|
239
|
-
[:test, {:name => "test1_1"}],
|
240
|
-
[:test, {:name => "test1_2"}]]],
|
241
|
-
@test_case1.to_s)
|
242
|
-
|
243
|
-
assert_collect(nil, @no_load_sub_test_case5.to_s)
|
244
|
-
end
|
245
|
-
|
246
|
-
def test_nil_pattern
|
247
|
-
assert_collect([:suite, {:name => @sub_test_dir.basename.to_s},
|
248
|
-
[:suite, {:name => _test_case_name("NoLoadSubTestCase5")},
|
249
|
-
[:test, {:name => "test5_1"}],
|
250
|
-
[:test, {:name => "test5_2"}]],
|
251
|
-
[:suite, {:name => _test_case_name("SubTestCase4")},
|
252
|
-
[:test, {:name => "test4_1"}],
|
253
|
-
[:test, {:name => "test4_2"}]],
|
254
|
-
[:suite, {:name => _test_case_name("SubTestCase6")},
|
255
|
-
[:test, {:name => "test6"}]]],
|
256
|
-
@sub_test_dir.to_s) do |collector|
|
257
|
-
collector.patterns.clear
|
258
|
-
end
|
259
|
-
end
|
260
|
-
|
261
|
-
def test_filtering
|
262
|
-
assert_collect([:suite, {:name => "."},
|
263
|
-
[:suite, {:name => _test_case_name("TestCase1")},
|
264
|
-
[:test, {:name => "test1_1"}],
|
265
|
-
[:test, {:name => "test1_2"}]]]) do |collector|
|
266
|
-
collector.filter = Proc.new do |test|
|
267
|
-
!/\Atest1/.match(test.method_name).nil?
|
268
|
-
end
|
269
|
-
end
|
270
|
-
end
|
271
|
-
|
272
|
-
def test_collect_multi
|
273
|
-
test_dirs = [@sub_test_dir.to_s, @sub2_test_dir.to_s]
|
274
|
-
assert_collect([:suite, {:name => "[#{test_dirs.join(', ')}]"},
|
275
|
-
[:suite, {:name => @sub_test_dir.basename.to_s},
|
276
|
-
[:suite, {:name => _test_case_name("SubTestCase4")},
|
277
|
-
[:test, {:name => "test4_1"}],
|
278
|
-
[:test, {:name => "test4_2"}]],
|
279
|
-
[:suite, {:name => _test_case_name("SubTestCase6")},
|
280
|
-
[:test, {:name => "test6"}]]],
|
281
|
-
[:suite, {:name => @sub2_test_dir.basename.to_s},
|
282
|
-
[:suite, {:name => _test_case_name("Sub2TestCase8")},
|
283
|
-
[:test, {:name => "test8_1"}],
|
284
|
-
[:test, {:name => "test8_2"}]],
|
285
|
-
[:suite, {:name => _test_case_name("Sub2TestCase9")},
|
286
|
-
[:test, {:name => "test9"}]]]],
|
287
|
-
*test_dirs)
|
288
|
-
end
|
289
|
-
|
290
|
-
private
|
291
|
-
def assert_collect(expected, *collect_args)
|
292
|
-
keep_required_files do
|
293
|
-
Dir.chdir(@test_dir.to_s) do
|
294
|
-
collector = Test::Unit::Collector::Load.new
|
295
|
-
yield(collector) if block_given?
|
296
|
-
actual = inspect_test_object(collector.send(:collect, *collect_args))
|
297
|
-
assert_equal(expected, actual)
|
298
|
-
end
|
299
|
-
end
|
300
|
-
end
|
301
|
-
|
302
|
-
def keep_required_files
|
303
|
-
required_files = $".dup
|
304
|
-
yield
|
305
|
-
ensure
|
306
|
-
$".replace(required_files)
|
307
|
-
end
|
308
|
-
|
309
|
-
def _test_case_name(test_case_class_name)
|
310
|
-
"#{@temporary_test_cases_module_name}::#{test_case_class_name}"
|
311
|
-
end
|
312
|
-
|
313
|
-
def inspect_test_object(test_object)
|
314
|
-
return nil if test_object.nil?
|
315
|
-
case test_object
|
316
|
-
when Test::Unit::TestSuite
|
317
|
-
sub_tests = test_object.tests.collect do |test|
|
318
|
-
inspect_test_object(test)
|
319
|
-
end.sort_by do |type, attributes, *children|
|
320
|
-
attributes[:name]
|
321
|
-
end
|
322
|
-
[:suite, {:name => test_object.name}, *sub_tests]
|
323
|
-
when Test::Unit::TestCase
|
324
|
-
[:test, {:name => test_object.method_name}]
|
325
|
-
else
|
326
|
-
raise "unexpected test object: #{test_object.inspect}"
|
327
|
-
end
|
328
|
-
end
|
329
|
-
end
|