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,125 +0,0 @@
|
|
1
|
-
require 'test/unit/util/backtracefilter'
|
2
|
-
|
3
|
-
module Test
|
4
|
-
module Unit
|
5
|
-
class Notification
|
6
|
-
include Util::BacktraceFilter
|
7
|
-
attr_reader :test_name, :location, :message
|
8
|
-
|
9
|
-
SINGLE_CHARACTER = 'N'
|
10
|
-
LABEL = "Notification"
|
11
|
-
|
12
|
-
# Creates a new Notification with the given location and
|
13
|
-
# message.
|
14
|
-
def initialize(test_name, location, message)
|
15
|
-
@test_name = test_name
|
16
|
-
@location = location
|
17
|
-
@message = message
|
18
|
-
end
|
19
|
-
|
20
|
-
# Returns a single character representation of a notification.
|
21
|
-
def single_character_display
|
22
|
-
SINGLE_CHARACTER
|
23
|
-
end
|
24
|
-
|
25
|
-
def label
|
26
|
-
LABEL
|
27
|
-
end
|
28
|
-
|
29
|
-
# Returns a brief version of the error description.
|
30
|
-
def short_display
|
31
|
-
"#{@test_name}: #{@message.split("\n")[0]}"
|
32
|
-
end
|
33
|
-
|
34
|
-
# Returns a verbose version of the error description.
|
35
|
-
def long_display
|
36
|
-
backtrace = filter_backtrace(location).join("\n")
|
37
|
-
"#{label}: #{@message}\n#{@test_name}\n#{backtrace}"
|
38
|
-
end
|
39
|
-
|
40
|
-
# Overridden to return long_display.
|
41
|
-
def to_s
|
42
|
-
long_display
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
class NotifiedError < StandardError
|
47
|
-
end
|
48
|
-
|
49
|
-
|
50
|
-
module TestCaseNotificationSupport
|
51
|
-
class << self
|
52
|
-
def included(base)
|
53
|
-
base.class_eval do
|
54
|
-
include NotificationHandler
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
# Notify some information.
|
60
|
-
#
|
61
|
-
# Example:
|
62
|
-
# def test_notification
|
63
|
-
# notify("I'm here!")
|
64
|
-
# # Reached here
|
65
|
-
# notify("Special!") if special_case?
|
66
|
-
# # Reached here too
|
67
|
-
# end
|
68
|
-
def notify(message, &block)
|
69
|
-
notification = Notification.new(name, filter_backtrace(caller), message)
|
70
|
-
add_notification(notification)
|
71
|
-
end
|
72
|
-
|
73
|
-
private
|
74
|
-
def add_notification(notification)
|
75
|
-
current_result.add_notification(notification)
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
module NotificationHandler
|
80
|
-
class << self
|
81
|
-
def included(base)
|
82
|
-
base.exception_handler(:handle_Notified_error)
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
private
|
87
|
-
def handle_Notified_error(exception)
|
88
|
-
return false unless exception.is_a?(NotifiedError)
|
89
|
-
notification = Notification.new(name,
|
90
|
-
filter_backtrace(exception.backtrace),
|
91
|
-
exception.message)
|
92
|
-
add_notification(notification)
|
93
|
-
true
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
module TestResultNotificationSupport
|
98
|
-
attr_reader :notifications
|
99
|
-
|
100
|
-
# Records a Test::Unit::Notification.
|
101
|
-
def add_notification(notification)
|
102
|
-
@notifications << notification
|
103
|
-
notify_fault(notification)
|
104
|
-
notify_changed
|
105
|
-
end
|
106
|
-
|
107
|
-
# Returns the number of notifications this TestResult has
|
108
|
-
# recorded.
|
109
|
-
def notification_count
|
110
|
-
@notifications.size
|
111
|
-
end
|
112
|
-
|
113
|
-
private
|
114
|
-
def initialize_containers
|
115
|
-
super
|
116
|
-
@notifications = []
|
117
|
-
@summary_generators << :notification_summary
|
118
|
-
end
|
119
|
-
|
120
|
-
def notification_summary
|
121
|
-
"#{notification_count} notifications"
|
122
|
-
end
|
123
|
-
end
|
124
|
-
end
|
125
|
-
end
|
@@ -1,143 +0,0 @@
|
|
1
|
-
require 'test/unit/util/backtracefilter'
|
2
|
-
|
3
|
-
module Test
|
4
|
-
module Unit
|
5
|
-
class Omission
|
6
|
-
include Util::BacktraceFilter
|
7
|
-
attr_reader :test_name, :location, :message
|
8
|
-
|
9
|
-
SINGLE_CHARACTER = 'O'
|
10
|
-
LABEL = "Omission"
|
11
|
-
|
12
|
-
# Creates a new Omission with the given location and
|
13
|
-
# message.
|
14
|
-
def initialize(test_name, location, message)
|
15
|
-
@test_name = test_name
|
16
|
-
@location = location
|
17
|
-
@message = message
|
18
|
-
end
|
19
|
-
|
20
|
-
# Returns a single character representation of a omission.
|
21
|
-
def single_character_display
|
22
|
-
SINGLE_CHARACTER
|
23
|
-
end
|
24
|
-
|
25
|
-
def label
|
26
|
-
LABEL
|
27
|
-
end
|
28
|
-
|
29
|
-
# Returns a brief version of the error description.
|
30
|
-
def short_display
|
31
|
-
"#{@test_name}: #{@message.split("\n")[0]}"
|
32
|
-
end
|
33
|
-
|
34
|
-
# Returns a verbose version of the error description.
|
35
|
-
def long_display
|
36
|
-
backtrace = filter_backtrace(location).join("\n")
|
37
|
-
"#{label}: #{@message}\n#{@test_name}\n#{backtrace}"
|
38
|
-
end
|
39
|
-
|
40
|
-
# Overridden to return long_display.
|
41
|
-
def to_s
|
42
|
-
long_display
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
class OmittedError < StandardError
|
47
|
-
end
|
48
|
-
|
49
|
-
|
50
|
-
module TestCaseOmissionSupport
|
51
|
-
class << self
|
52
|
-
def included(base)
|
53
|
-
base.class_eval do
|
54
|
-
include OmissionHandler
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
# Omit the test of part of the test.
|
60
|
-
#
|
61
|
-
# Example:
|
62
|
-
# def test_omission
|
63
|
-
# omit
|
64
|
-
# # Not reached here
|
65
|
-
# end
|
66
|
-
#
|
67
|
-
# def test_omission_with_here
|
68
|
-
# omit do
|
69
|
-
# # Not ran here
|
70
|
-
# end
|
71
|
-
# # Reached here
|
72
|
-
# end
|
73
|
-
def omit(message=nil, &block)
|
74
|
-
message ||= "omitted."
|
75
|
-
if block_given?
|
76
|
-
omission = Omission.new(name, filter_backtrace(caller), message)
|
77
|
-
add_omission(omission)
|
78
|
-
else
|
79
|
-
raise OmittedError.new(message)
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
def omit_if(condition, *args, &block)
|
84
|
-
omit(*args, &block) if condition
|
85
|
-
end
|
86
|
-
|
87
|
-
def omit_unless(condition, *args, &block)
|
88
|
-
omit(*args, &block) unless condition
|
89
|
-
end
|
90
|
-
|
91
|
-
private
|
92
|
-
def add_omission(omission)
|
93
|
-
current_result.add_omission(omission)
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
module OmissionHandler
|
98
|
-
class << self
|
99
|
-
def included(base)
|
100
|
-
base.exception_handler(:handle_omitted_error)
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
private
|
105
|
-
def handle_omitted_error(exception)
|
106
|
-
return false unless exception.is_a?(OmittedError)
|
107
|
-
omission = Omission.new(name,
|
108
|
-
filter_backtrace(exception.backtrace),
|
109
|
-
exception.message)
|
110
|
-
add_omission(omission)
|
111
|
-
true
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
module TestResultOmissionSupport
|
116
|
-
attr_reader :omissions
|
117
|
-
|
118
|
-
# Records a Test::Unit::Omission.
|
119
|
-
def add_omission(omission)
|
120
|
-
@omissions << omission
|
121
|
-
notify_fault(omission)
|
122
|
-
notify_changed
|
123
|
-
end
|
124
|
-
|
125
|
-
# Returns the number of omissions this TestResult has
|
126
|
-
# recorded.
|
127
|
-
def omission_count
|
128
|
-
@omissions.size
|
129
|
-
end
|
130
|
-
|
131
|
-
private
|
132
|
-
def initialize_containers
|
133
|
-
super
|
134
|
-
@omissions = []
|
135
|
-
@summary_generators << :omission_summary
|
136
|
-
end
|
137
|
-
|
138
|
-
def omission_summary
|
139
|
-
"#{omission_count} omissions"
|
140
|
-
end
|
141
|
-
end
|
142
|
-
end
|
143
|
-
end
|
@@ -1,146 +0,0 @@
|
|
1
|
-
require 'test/unit/util/backtracefilter'
|
2
|
-
|
3
|
-
module Test
|
4
|
-
module Unit
|
5
|
-
class Pending
|
6
|
-
include Util::BacktraceFilter
|
7
|
-
attr_reader :test_name, :location, :message
|
8
|
-
|
9
|
-
SINGLE_CHARACTER = 'P'
|
10
|
-
LABEL = "Pending"
|
11
|
-
|
12
|
-
# Creates a new Pending with the given location and
|
13
|
-
# message.
|
14
|
-
def initialize(test_name, location, message)
|
15
|
-
@test_name = test_name
|
16
|
-
@location = location
|
17
|
-
@message = message
|
18
|
-
end
|
19
|
-
|
20
|
-
# Returns a single character representation of a pending.
|
21
|
-
def single_character_display
|
22
|
-
SINGLE_CHARACTER
|
23
|
-
end
|
24
|
-
|
25
|
-
def label
|
26
|
-
LABEL
|
27
|
-
end
|
28
|
-
|
29
|
-
# Returns a brief version of the error description.
|
30
|
-
def short_display
|
31
|
-
"#{@test_name}: #{@message.split("\n")[0]}"
|
32
|
-
end
|
33
|
-
|
34
|
-
# Returns a verbose version of the error description.
|
35
|
-
def long_display
|
36
|
-
backtrace = filter_backtrace(location).join("\n")
|
37
|
-
"#{label}: #{@message}\n#{@test_name}\n#{backtrace}"
|
38
|
-
end
|
39
|
-
|
40
|
-
# Overridden to return long_display.
|
41
|
-
def to_s
|
42
|
-
long_display
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
class PendedError < StandardError
|
47
|
-
end
|
48
|
-
|
49
|
-
|
50
|
-
module TestCasePendingSupport
|
51
|
-
class << self
|
52
|
-
def included(base)
|
53
|
-
base.class_eval do
|
54
|
-
include PendingHandler
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
# Marks the test or part of the test is pending.
|
60
|
-
#
|
61
|
-
# Example:
|
62
|
-
# def test_pending
|
63
|
-
# pend
|
64
|
-
# # Not reached here
|
65
|
-
# end
|
66
|
-
#
|
67
|
-
# def test_pending_with_here
|
68
|
-
# pend do
|
69
|
-
# # Ran here
|
70
|
-
# # Fails if the block doesn't raise any error.
|
71
|
-
# # Because it means the block is passed unexpectedly.
|
72
|
-
# end
|
73
|
-
# # Reached here
|
74
|
-
# end
|
75
|
-
def pend(message=nil, &block)
|
76
|
-
message ||= "pended."
|
77
|
-
if block_given?
|
78
|
-
pending = nil
|
79
|
-
begin
|
80
|
-
yield
|
81
|
-
rescue Exception
|
82
|
-
pending = Pending.new(name, filter_backtrace(caller), message)
|
83
|
-
add_pending(pending)
|
84
|
-
end
|
85
|
-
unless pending
|
86
|
-
flunk("Pending block should not be passed: #{message}")
|
87
|
-
end
|
88
|
-
else
|
89
|
-
raise PendedError.new(message)
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
private
|
94
|
-
def add_pending(pending)
|
95
|
-
problem_occurred
|
96
|
-
current_result.add_pending(pending)
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
module PendingHandler
|
101
|
-
class << self
|
102
|
-
def included(base)
|
103
|
-
base.exception_handler(:handle_pended_error)
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
private
|
108
|
-
def handle_pended_error(exception)
|
109
|
-
return false unless exception.is_a?(PendedError)
|
110
|
-
pending = Pending.new(name,
|
111
|
-
filter_backtrace(exception.backtrace),
|
112
|
-
exception.message)
|
113
|
-
add_pending(pending)
|
114
|
-
true
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
module TestResultPendingSupport
|
119
|
-
attr_reader :pendings
|
120
|
-
|
121
|
-
# Records a Test::Unit::Pending.
|
122
|
-
def add_pending(pending)
|
123
|
-
@pendings << pending
|
124
|
-
notify_fault(pending)
|
125
|
-
notify_changed
|
126
|
-
end
|
127
|
-
|
128
|
-
# Returns the number of pendings this TestResult has
|
129
|
-
# recorded.
|
130
|
-
def pending_count
|
131
|
-
@pendings.size
|
132
|
-
end
|
133
|
-
|
134
|
-
private
|
135
|
-
def initialize_containers
|
136
|
-
super
|
137
|
-
@pendings = []
|
138
|
-
@summary_generators << :pending_summary
|
139
|
-
end
|
140
|
-
|
141
|
-
def pending_summary
|
142
|
-
"#{pending_count} pendings"
|
143
|
-
end
|
144
|
-
end
|
145
|
-
end
|
146
|
-
end
|
@@ -1,181 +0,0 @@
|
|
1
|
-
require "fileutils"
|
2
|
-
require "tmpdir"
|
3
|
-
|
4
|
-
module Test
|
5
|
-
module Unit
|
6
|
-
module Priority
|
7
|
-
class << self
|
8
|
-
def included(base)
|
9
|
-
base.extend(ClassMethods)
|
10
|
-
|
11
|
-
base.class_eval do
|
12
|
-
setup :priority_setup, :before => :prepend
|
13
|
-
teardown :priority_teardown, :after => :append
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
@@enabled = false
|
18
|
-
def enabled?
|
19
|
-
@@enabled
|
20
|
-
end
|
21
|
-
|
22
|
-
def enable
|
23
|
-
@@enabled = true
|
24
|
-
end
|
25
|
-
|
26
|
-
def disable
|
27
|
-
@@enabled = false
|
28
|
-
end
|
29
|
-
|
30
|
-
@@default = :normal
|
31
|
-
def default
|
32
|
-
@@default || :normal
|
33
|
-
end
|
34
|
-
|
35
|
-
def default=(default)
|
36
|
-
@@default = default
|
37
|
-
end
|
38
|
-
|
39
|
-
def available_values
|
40
|
-
Checker.available_priorities
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
class Checker
|
45
|
-
class << self
|
46
|
-
def have_priority?(name)
|
47
|
-
singleton_class = (class << self; self; end)
|
48
|
-
singleton_class.method_defined?(priority_check_method_name(name))
|
49
|
-
end
|
50
|
-
|
51
|
-
def need_to_run?(test)
|
52
|
-
priority = test[:priority] || Priority.default
|
53
|
-
if have_priority?(priority)
|
54
|
-
send(priority_check_method_name(priority), test)
|
55
|
-
else
|
56
|
-
true
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def available_priorities
|
61
|
-
methods(false).collect do |name|
|
62
|
-
/\Arun_priority_(.+)\?\z/ =~ name.to_s
|
63
|
-
$1
|
64
|
-
end.compact
|
65
|
-
end
|
66
|
-
|
67
|
-
def run_priority_must?(test)
|
68
|
-
true
|
69
|
-
end
|
70
|
-
|
71
|
-
def run_priority_important?(test)
|
72
|
-
rand > 0.1
|
73
|
-
end
|
74
|
-
|
75
|
-
def run_priority_high?(test)
|
76
|
-
rand > 0.3
|
77
|
-
end
|
78
|
-
|
79
|
-
def run_priority_normal?(test)
|
80
|
-
rand > 0.5
|
81
|
-
end
|
82
|
-
|
83
|
-
def run_priority_low?(test)
|
84
|
-
rand > 0.75
|
85
|
-
end
|
86
|
-
|
87
|
-
def run_priority_never?(test)
|
88
|
-
false
|
89
|
-
end
|
90
|
-
|
91
|
-
private
|
92
|
-
def priority_check_method_name(priority_name)
|
93
|
-
"run_priority_#{priority_name}?"
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
attr_reader :test
|
98
|
-
def initialize(test)
|
99
|
-
@test = test
|
100
|
-
end
|
101
|
-
|
102
|
-
def setup
|
103
|
-
FileUtils.rm_f(passed_file)
|
104
|
-
end
|
105
|
-
|
106
|
-
def teardown
|
107
|
-
if @test.send(:passed?)
|
108
|
-
FileUtils.touch(passed_file)
|
109
|
-
else
|
110
|
-
FileUtils.rm_f(passed_file)
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
def need_to_run?
|
115
|
-
!previous_test_success? or self.class.need_to_run?(@test)
|
116
|
-
end
|
117
|
-
|
118
|
-
private
|
119
|
-
def previous_test_success?
|
120
|
-
File.exist?(passed_file)
|
121
|
-
end
|
122
|
-
|
123
|
-
def result_dir
|
124
|
-
components = [".test-result",
|
125
|
-
@test.class.name || "AnonymousTestCase",
|
126
|
-
escaped_method_name]
|
127
|
-
parent_directories = [File.dirname($0), Dir.pwd]
|
128
|
-
if Process.respond_to?(:uid)
|
129
|
-
parent_directories << File.join(Dir.tmpdir, Process.uid.to_s)
|
130
|
-
end
|
131
|
-
parent_directories.each do |parent_directory|
|
132
|
-
dir = File.expand_path(File.join(parent_directory, *components))
|
133
|
-
begin
|
134
|
-
FileUtils.mkdir_p(dir)
|
135
|
-
return dir
|
136
|
-
rescue Errno::EACCES
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
raise Errno::EACCES, parent_directories.join(", ")
|
141
|
-
end
|
142
|
-
|
143
|
-
def passed_file
|
144
|
-
File.join(result_dir, "passed")
|
145
|
-
end
|
146
|
-
|
147
|
-
def escaped_method_name
|
148
|
-
@test.method_name.to_s.gsub(/[!?=]$/) do |matched|
|
149
|
-
case matched
|
150
|
-
when "!"
|
151
|
-
".destructive"
|
152
|
-
when "?"
|
153
|
-
".predicate"
|
154
|
-
when "="
|
155
|
-
".equal"
|
156
|
-
end
|
157
|
-
end
|
158
|
-
end
|
159
|
-
end
|
160
|
-
|
161
|
-
module ClassMethods
|
162
|
-
def priority(name, *tests)
|
163
|
-
unless Checker.have_priority?(name)
|
164
|
-
raise ArgumentError, "unknown priority: #{name}"
|
165
|
-
end
|
166
|
-
attribute(:priority, name, {:keep => true}, *tests)
|
167
|
-
end
|
168
|
-
end
|
169
|
-
|
170
|
-
def priority_setup
|
171
|
-
return unless Priority.enabled?
|
172
|
-
Checker.new(self).setup
|
173
|
-
end
|
174
|
-
|
175
|
-
def priority_teardown
|
176
|
-
return unless Priority.enabled?
|
177
|
-
Checker.new(self).teardown
|
178
|
-
end
|
179
|
-
end
|
180
|
-
end
|
181
|
-
end
|