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,89 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
# Author:: Nathaniel Talbott.
|
3
|
-
# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
|
4
|
-
# License:: Ruby license.
|
5
|
-
|
6
|
-
require 'test/unit/util/observable'
|
7
|
-
require 'test/unit/failure'
|
8
|
-
require 'test/unit/error'
|
9
|
-
require 'test/unit/omission'
|
10
|
-
require 'test/unit/pending'
|
11
|
-
require 'test/unit/notification'
|
12
|
-
|
13
|
-
module Test
|
14
|
-
module Unit
|
15
|
-
module NullResultContainerInitializer
|
16
|
-
private
|
17
|
-
def initialize_containers
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
# Collects Test::Unit::Failure and Test::Unit::Error so that
|
22
|
-
# they can be displayed to the user. To this end, observers
|
23
|
-
# can be added to it, allowing the dynamic updating of, say, a
|
24
|
-
# UI.
|
25
|
-
class TestResult
|
26
|
-
include Util::Observable
|
27
|
-
include NullResultContainerInitializer
|
28
|
-
include TestResultFailureSupport
|
29
|
-
include TestResultErrorSupport
|
30
|
-
include TestResultPendingSupport
|
31
|
-
include TestResultOmissionSupport
|
32
|
-
include TestResultNotificationSupport
|
33
|
-
|
34
|
-
CHANGED = "CHANGED"
|
35
|
-
FAULT = "FAULT"
|
36
|
-
|
37
|
-
attr_reader :run_count, :assertion_count, :faults
|
38
|
-
|
39
|
-
# Constructs a new, empty TestResult.
|
40
|
-
def initialize
|
41
|
-
@run_count, @assertion_count = 0, 0
|
42
|
-
@summary_generators = []
|
43
|
-
@problem_checkers = []
|
44
|
-
@faults = []
|
45
|
-
initialize_containers
|
46
|
-
end
|
47
|
-
|
48
|
-
# Records a test run.
|
49
|
-
def add_run
|
50
|
-
@run_count += 1
|
51
|
-
notify_changed
|
52
|
-
end
|
53
|
-
|
54
|
-
# Records an individual assertion.
|
55
|
-
def add_assertion
|
56
|
-
@assertion_count += 1
|
57
|
-
notify_changed
|
58
|
-
end
|
59
|
-
|
60
|
-
# Returns a string contain the recorded runs, assertions,
|
61
|
-
# failures and errors in this TestResult.
|
62
|
-
def summary
|
63
|
-
["#{run_count} tests",
|
64
|
-
"#{assertion_count} assertions",
|
65
|
-
*@summary_generators.collect {|generator| send(generator)}].join(", ")
|
66
|
-
end
|
67
|
-
|
68
|
-
def to_s
|
69
|
-
summary
|
70
|
-
end
|
71
|
-
|
72
|
-
# Returns whether or not this TestResult represents
|
73
|
-
# successful completion.
|
74
|
-
def passed?
|
75
|
-
@problem_checkers.all? {|checker| not send(checker)}
|
76
|
-
end
|
77
|
-
|
78
|
-
private
|
79
|
-
def notify_changed
|
80
|
-
notify_listeners(CHANGED, self)
|
81
|
-
end
|
82
|
-
|
83
|
-
def notify_fault(fault)
|
84
|
-
@faults << fault
|
85
|
-
notify_listeners(FAULT, fault)
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
@@ -1,110 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
#
|
3
|
-
# Author:: Nathaniel Talbott.
|
4
|
-
# Copyright:: Copyright (c) 2000-2003 Nathaniel Talbott. All rights reserved.
|
5
|
-
# License:: Ruby license.
|
6
|
-
|
7
|
-
require 'test/unit/error'
|
8
|
-
|
9
|
-
module Test
|
10
|
-
module Unit
|
11
|
-
|
12
|
-
# A collection of tests which can be #run.
|
13
|
-
#
|
14
|
-
# Note: It is easy to confuse a TestSuite instance with
|
15
|
-
# something that has a static suite method; I know because _I_
|
16
|
-
# have trouble keeping them straight. Think of something that
|
17
|
-
# has a suite method as simply providing a way to get a
|
18
|
-
# meaningful TestSuite instance.
|
19
|
-
class TestSuite
|
20
|
-
attr_reader :name, :tests
|
21
|
-
|
22
|
-
STARTED = name + "::STARTED"
|
23
|
-
FINISHED = name + "::FINISHED"
|
24
|
-
|
25
|
-
# Creates a new TestSuite with the given name.
|
26
|
-
def initialize(name="Unnamed TestSuite", test_case=nil)
|
27
|
-
@name = name
|
28
|
-
@tests = []
|
29
|
-
@test_case = test_case
|
30
|
-
end
|
31
|
-
|
32
|
-
# Runs the tests and/or suites contained in this
|
33
|
-
# TestSuite.
|
34
|
-
def run(result, &progress_block)
|
35
|
-
yield(STARTED, name)
|
36
|
-
run_startup(result)
|
37
|
-
@tests.each do |test|
|
38
|
-
test.run(result, &progress_block)
|
39
|
-
end
|
40
|
-
run_shutdown(result)
|
41
|
-
yield(FINISHED, name)
|
42
|
-
end
|
43
|
-
|
44
|
-
# Adds the test to the suite.
|
45
|
-
def <<(test)
|
46
|
-
@tests << test
|
47
|
-
self
|
48
|
-
end
|
49
|
-
|
50
|
-
def delete(test)
|
51
|
-
@tests.delete(test)
|
52
|
-
end
|
53
|
-
|
54
|
-
# Retuns the rolled up number of tests in this suite;
|
55
|
-
# i.e. if the suite contains other suites, it counts the
|
56
|
-
# tests within those suites, not the suites themselves.
|
57
|
-
def size
|
58
|
-
total_size = 0
|
59
|
-
@tests.each { |test| total_size += test.size }
|
60
|
-
total_size
|
61
|
-
end
|
62
|
-
|
63
|
-
def empty?
|
64
|
-
tests.empty?
|
65
|
-
end
|
66
|
-
|
67
|
-
# Overridden to return the name given the suite at
|
68
|
-
# creation.
|
69
|
-
def to_s
|
70
|
-
@name
|
71
|
-
end
|
72
|
-
|
73
|
-
# It's handy to be able to compare TestSuite instances.
|
74
|
-
def ==(other)
|
75
|
-
return false unless(other.kind_of?(self.class))
|
76
|
-
return false unless(@name == other.name)
|
77
|
-
@tests == other.tests
|
78
|
-
end
|
79
|
-
|
80
|
-
private
|
81
|
-
def run_startup(result)
|
82
|
-
return if @test_case.nil? or !@test_case.respond_to?(:startup)
|
83
|
-
begin
|
84
|
-
@test_case.startup
|
85
|
-
rescue Exception
|
86
|
-
raise unless handle_exception($!, result)
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
def run_shutdown(result)
|
91
|
-
return if @test_case.nil? or !@test_case.respond_to?(:shutdown)
|
92
|
-
begin
|
93
|
-
@test_case.shutdown
|
94
|
-
rescue Exception
|
95
|
-
raise unless handle_exception($!, result)
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
def handle_exception(exception, result)
|
100
|
-
case exception
|
101
|
-
when *ErrorHandler::PASS_THROUGH_EXCEPTIONS
|
102
|
-
false
|
103
|
-
else
|
104
|
-
result.add_error(Error.new(@test_case.name, exception))
|
105
|
-
true
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
@@ -1,278 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
#
|
3
|
-
# Author:: Nathaniel Talbott.
|
4
|
-
# Copyright::
|
5
|
-
# * Copyright (c) 2000-2003 Nathaniel Talbott. All rights reserved.
|
6
|
-
# * Copyright (c) 2008-2009 Kouhei Sutou <kou@clear-code.com>
|
7
|
-
# License:: Ruby license.
|
8
|
-
|
9
|
-
require 'test/unit/color-scheme'
|
10
|
-
require 'test/unit/ui/testrunner'
|
11
|
-
require 'test/unit/ui/testrunnermediator'
|
12
|
-
require 'test/unit/ui/console/outputlevel'
|
13
|
-
|
14
|
-
module Test
|
15
|
-
module Unit
|
16
|
-
module UI
|
17
|
-
module Console
|
18
|
-
|
19
|
-
# Runs a Test::Unit::TestSuite on the console.
|
20
|
-
class TestRunner < UI::TestRunner
|
21
|
-
include OutputLevel
|
22
|
-
|
23
|
-
# Creates a new TestRunner for running the passed
|
24
|
-
# suite. If quiet_mode is true, the output while
|
25
|
-
# running is limited to progress dots, errors and
|
26
|
-
# failures, and the final result. io specifies
|
27
|
-
# where runner output should go to; defaults to
|
28
|
-
# STDOUT.
|
29
|
-
def initialize(suite, options={})
|
30
|
-
super
|
31
|
-
@output_level = @options[:output_level] || NORMAL
|
32
|
-
@output = @options[:output] || STDOUT
|
33
|
-
@use_color = @options[:use_color]
|
34
|
-
@use_color = guess_color_availability if @use_color.nil?
|
35
|
-
@color_scheme = @options[:color_scheme] || ColorScheme.default
|
36
|
-
@reset_color = Color.new("reset")
|
37
|
-
@progress_row = 0
|
38
|
-
@progress_row_max = @options[:progress_row_max]
|
39
|
-
@progress_row_max ||= guess_progress_row_max
|
40
|
-
@already_outputted = false
|
41
|
-
@n_successes = 0
|
42
|
-
@indent = 0
|
43
|
-
@top_level = true
|
44
|
-
@faults = []
|
45
|
-
end
|
46
|
-
|
47
|
-
# Begins the test run.
|
48
|
-
def start
|
49
|
-
setup_mediator
|
50
|
-
attach_to_mediator
|
51
|
-
return start_mediator
|
52
|
-
end
|
53
|
-
|
54
|
-
private
|
55
|
-
def setup_mediator
|
56
|
-
@mediator = create_mediator(@suite)
|
57
|
-
output_setup_end
|
58
|
-
end
|
59
|
-
|
60
|
-
def output_setup_end
|
61
|
-
suite_name = @suite.to_s
|
62
|
-
suite_name = @suite.name if @suite.kind_of?(Module)
|
63
|
-
output("Loaded suite #{suite_name}")
|
64
|
-
end
|
65
|
-
|
66
|
-
def create_mediator(suite)
|
67
|
-
return TestRunnerMediator.new(suite)
|
68
|
-
end
|
69
|
-
|
70
|
-
def attach_to_mediator
|
71
|
-
@mediator.add_listener(TestResult::FAULT, &method(:add_fault))
|
72
|
-
@mediator.add_listener(TestRunnerMediator::STARTED, &method(:started))
|
73
|
-
@mediator.add_listener(TestRunnerMediator::FINISHED, &method(:finished))
|
74
|
-
@mediator.add_listener(TestCase::STARTED, &method(:test_started))
|
75
|
-
@mediator.add_listener(TestCase::FINISHED, &method(:test_finished))
|
76
|
-
@mediator.add_listener(TestSuite::STARTED, &method(:test_suite_started))
|
77
|
-
@mediator.add_listener(TestSuite::FINISHED, &method(:test_suite_finished))
|
78
|
-
end
|
79
|
-
|
80
|
-
def start_mediator
|
81
|
-
return @mediator.run_suite
|
82
|
-
end
|
83
|
-
|
84
|
-
def add_fault(fault)
|
85
|
-
@faults << fault
|
86
|
-
output_progress(fault.single_character_display, fault_color(fault))
|
87
|
-
@already_outputted = true
|
88
|
-
end
|
89
|
-
|
90
|
-
def started(result)
|
91
|
-
@result = result
|
92
|
-
output_started
|
93
|
-
end
|
94
|
-
|
95
|
-
def output_started
|
96
|
-
output("Started")
|
97
|
-
end
|
98
|
-
|
99
|
-
def finished(elapsed_time)
|
100
|
-
nl if output?(NORMAL) and !output?(VERBOSE)
|
101
|
-
@faults.each_with_index do |fault, index|
|
102
|
-
nl
|
103
|
-
output_single("%3d) " % (index + 1))
|
104
|
-
label, detail = format_fault(fault).split(/\r?\n/, 2)
|
105
|
-
output(label, fault_color(fault))
|
106
|
-
output(detail)
|
107
|
-
end
|
108
|
-
nl
|
109
|
-
output("Finished in #{elapsed_time} seconds.")
|
110
|
-
nl
|
111
|
-
output(@result, result_color)
|
112
|
-
n_tests = @result.run_count
|
113
|
-
if n_tests.zero?
|
114
|
-
pass_percentage = 0
|
115
|
-
else
|
116
|
-
pass_percentage = 100.0 * (@n_successes / n_tests.to_f)
|
117
|
-
end
|
118
|
-
output("%g%% passed" % pass_percentage, result_color)
|
119
|
-
end
|
120
|
-
|
121
|
-
def format_fault(fault)
|
122
|
-
fault.long_display
|
123
|
-
end
|
124
|
-
|
125
|
-
def test_started(name)
|
126
|
-
return unless output?(VERBOSE)
|
127
|
-
|
128
|
-
name = name.sub(/\(.+?\)\z/, '')
|
129
|
-
right_space = 8 * 2
|
130
|
-
left_space = @progress_row_max - right_space
|
131
|
-
left_space = left_space - indent.size - name.size
|
132
|
-
tab_stop = "\t" * ((left_space - 1) / 8)
|
133
|
-
output_single("#{indent}#{name}:#{tab_stop}", nil, VERBOSE)
|
134
|
-
@test_start = Time.now
|
135
|
-
end
|
136
|
-
|
137
|
-
def test_finished(name)
|
138
|
-
unless @already_outputted
|
139
|
-
@n_successes += 1
|
140
|
-
output_progress(".", color("success"))
|
141
|
-
end
|
142
|
-
@already_outputted = false
|
143
|
-
|
144
|
-
return unless output?(VERBOSE)
|
145
|
-
|
146
|
-
output(": (%f)" % (Time.now - @test_start), nil, VERBOSE)
|
147
|
-
end
|
148
|
-
|
149
|
-
def test_suite_started(name)
|
150
|
-
if @top_level
|
151
|
-
@top_level = false
|
152
|
-
return
|
153
|
-
end
|
154
|
-
|
155
|
-
output_single(indent, nil, VERBOSE)
|
156
|
-
if /\A[A-Z]/ =~ name
|
157
|
-
_color = color("case")
|
158
|
-
else
|
159
|
-
_color = color("suite")
|
160
|
-
end
|
161
|
-
output_single(name, _color, VERBOSE)
|
162
|
-
output(": ", nil, VERBOSE)
|
163
|
-
@indent += 2
|
164
|
-
end
|
165
|
-
|
166
|
-
def test_suite_finished(name)
|
167
|
-
@indent -= 2
|
168
|
-
end
|
169
|
-
|
170
|
-
def indent
|
171
|
-
if output?(VERBOSE)
|
172
|
-
" " * @indent
|
173
|
-
else
|
174
|
-
""
|
175
|
-
end
|
176
|
-
end
|
177
|
-
|
178
|
-
def nl(level=NORMAL)
|
179
|
-
output("", nil, level)
|
180
|
-
end
|
181
|
-
|
182
|
-
def output(something, color=nil, level=NORMAL)
|
183
|
-
return unless output?(level)
|
184
|
-
output_single(something, color, level)
|
185
|
-
@output.puts
|
186
|
-
end
|
187
|
-
|
188
|
-
def output_single(something, color=nil, level=NORMAL)
|
189
|
-
return false unless output?(level)
|
190
|
-
if @use_color and color
|
191
|
-
something = "%s%s%s" % [color.escape_sequence,
|
192
|
-
something,
|
193
|
-
@reset_color.escape_sequence]
|
194
|
-
end
|
195
|
-
@output.write(something)
|
196
|
-
@output.flush
|
197
|
-
true
|
198
|
-
end
|
199
|
-
|
200
|
-
def output_progress(mark, color=nil)
|
201
|
-
if output_single(mark, color, PROGRESS_ONLY)
|
202
|
-
return unless @progress_row_max > 0
|
203
|
-
@progress_row += mark.size
|
204
|
-
if @progress_row >= @progress_row_max
|
205
|
-
nl unless @output_level == VERBOSE
|
206
|
-
@progress_row = 0
|
207
|
-
end
|
208
|
-
end
|
209
|
-
end
|
210
|
-
|
211
|
-
def output?(level)
|
212
|
-
level <= @output_level
|
213
|
-
end
|
214
|
-
|
215
|
-
def color(name)
|
216
|
-
@color_scheme[name] || ColorScheme.default[name]
|
217
|
-
end
|
218
|
-
|
219
|
-
def fault_color(fault)
|
220
|
-
color(fault.class.name.split(/::/).last.downcase)
|
221
|
-
end
|
222
|
-
|
223
|
-
def result_color
|
224
|
-
if @result.passed?
|
225
|
-
if @result.pending_count > 0
|
226
|
-
color("pending")
|
227
|
-
elsif @result.omission_count > 0
|
228
|
-
color("omission")
|
229
|
-
elsif @result.notification_count > 0
|
230
|
-
color("notification")
|
231
|
-
else
|
232
|
-
color("success")
|
233
|
-
end
|
234
|
-
elsif @result.error_count > 0
|
235
|
-
color("error")
|
236
|
-
elsif @result.failure_count > 0
|
237
|
-
color("failure")
|
238
|
-
end
|
239
|
-
end
|
240
|
-
|
241
|
-
def guess_color_availability
|
242
|
-
return false unless @output.tty?
|
243
|
-
case ENV["TERM"]
|
244
|
-
when /term(?:-color)?\z/, "screen"
|
245
|
-
true
|
246
|
-
else
|
247
|
-
return true if ENV["EMACS"] == "t"
|
248
|
-
false
|
249
|
-
end
|
250
|
-
end
|
251
|
-
|
252
|
-
def guess_progress_row_max
|
253
|
-
term_width = guess_term_width
|
254
|
-
if term_width.zero?
|
255
|
-
if ENV["EMACS"] == "t"
|
256
|
-
-1
|
257
|
-
else
|
258
|
-
79
|
259
|
-
end
|
260
|
-
else
|
261
|
-
term_width
|
262
|
-
end
|
263
|
-
end
|
264
|
-
|
265
|
-
def guess_term_width
|
266
|
-
Integer(ENV["TERM_WIDTH"] || 0)
|
267
|
-
rescue ArgumentError
|
268
|
-
0
|
269
|
-
end
|
270
|
-
end
|
271
|
-
end
|
272
|
-
end
|
273
|
-
end
|
274
|
-
end
|
275
|
-
|
276
|
-
if __FILE__ == $0
|
277
|
-
Test::Unit::UI::Console::TestRunner.start_command_line_test
|
278
|
-
end
|