activeldap 0.10.0 → 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/CHANGES +6 -30
- data/README +4 -2
- data/Rakefile +7 -0
- data/data/locale/en/LC_MESSAGES/active-ldap.mo +0 -0
- data/data/locale/ja/LC_MESSAGES/active-ldap.mo +0 -0
- data/examples/al-admin/po/en/al-admin.po +3 -3
- data/examples/al-admin/po/ja/al-admin.po +3 -3
- data/examples/al-admin/po/nl/al-admin.po +3 -3
- data/lib/active_ldap/adapter/base.rb +0 -2
- data/lib/active_ldap/base.rb +4 -2
- data/lib/active_ldap/get_text_support.rb +3 -11
- data/lib/active_ldap/operations.rb +1 -0
- data/lib/active_ldap/schema/syntaxes.rb +5 -3
- data/lib/active_ldap/validations.rb +25 -15
- data/lib/active_ldap.rb +1 -1
- data/po/en/active-ldap.po +1 -1
- data/po/ja/active-ldap.po +1 -1
- data/rails/plugin/active_ldap/init.rb +1 -1
- data/test/run-test.rb +2 -0
- data/test/test_base.rb +63 -1
- data/test/test_syntax.rb +3 -2
- data/test-unit-ext/NEWS.en +28 -0
- data/test-unit-ext/NEWS.ja +28 -0
- data/test-unit-ext/README.en +247 -0
- data/test-unit-ext/README.ja +246 -0
- data/test-unit-ext/Rakefile +111 -0
- data/{test → test-unit-ext/lib}/test-unit-ext/always-show-result.rb +0 -0
- data/test-unit-ext/lib/test-unit-ext/assertions.rb +40 -0
- data/test-unit-ext/lib/test-unit-ext/attributes.rb +129 -0
- data/{test → test-unit-ext/lib}/test-unit-ext/backtrace-filter.rb +0 -0
- data/test-unit-ext/lib/test-unit-ext/color.rb +59 -0
- data/test-unit-ext/lib/test-unit-ext/colorized-runner.rb +111 -0
- data/test-unit-ext/lib/test-unit-ext/diff.rb +516 -0
- data/{test → test-unit-ext/lib}/test-unit-ext/long-display-for-emacs.rb +0 -0
- data/test-unit-ext/lib/test-unit-ext/notification.rb +79 -0
- data/test-unit-ext/lib/test-unit-ext/omission.rb +96 -0
- data/test-unit-ext/lib/test-unit-ext/pending.rb +97 -0
- data/{test → test-unit-ext/lib}/test-unit-ext/priority.rb +25 -53
- data/test-unit-ext/lib/test-unit-ext/version.rb +3 -0
- data/test-unit-ext/lib/test-unit-ext/xml-report.rb +224 -0
- data/test-unit-ext/lib/test-unit-ext.rb +16 -0
- data/test-unit-ext/misc/rd2html.rb +42 -0
- data/test-unit-ext/test/run-test.rb +14 -0
- data/test-unit-ext/test/test_attributes.rb +139 -0
- data/test-unit-ext/test/test_color.rb +39 -0
- data/test-unit-ext/test/test_diff.rb +475 -0
- data/test-unit-ext/test/test_notification.rb +32 -0
- data/test-unit-ext/test/test_omission.rb +64 -0
- data/test-unit-ext/test/test_pending.rb +64 -0
- data/test-unit-ext/test/test_priority.rb +88 -0
- data/test-unit-ext/test/test_xml_report.rb +161 -0
- metadata +34 -7
- data/test/test-unit-ext.rb +0 -4
@@ -0,0 +1,129 @@
|
|
1
|
+
require "test/unit"
|
2
|
+
|
3
|
+
module Test
|
4
|
+
module Unit
|
5
|
+
class TestCase
|
6
|
+
class << self
|
7
|
+
alias_method :method_added_without_attributes, :method_added
|
8
|
+
def method_added(name)
|
9
|
+
method_added_without_attributes(name)
|
10
|
+
if defined?(@current_attributes)
|
11
|
+
attributes = {}
|
12
|
+
kept_attributes = {}
|
13
|
+
@current_attributes.each do |attribute_name, attribute|
|
14
|
+
attributes[attribute_name] = attribute[:value]
|
15
|
+
kept_attributes[attribute_name] = attribute if attribute[:keep]
|
16
|
+
end
|
17
|
+
set_attributes(name, attributes)
|
18
|
+
@current_attributes = kept_attributes
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def attribute(name, value, options={}, *tests)
|
23
|
+
unless options.is_a?(Hash)
|
24
|
+
tests << options
|
25
|
+
options = {}
|
26
|
+
end
|
27
|
+
@current_attributes ||= {}
|
28
|
+
if tests.empty?
|
29
|
+
@current_attributes[name] = options.merge(:value => value)
|
30
|
+
else
|
31
|
+
tests.each do |test|
|
32
|
+
set_attribute(test, {name => value})
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def bug(value, *tests)
|
38
|
+
attribute(:bug, value, *tests)
|
39
|
+
end
|
40
|
+
|
41
|
+
def set_attributes(test_name, attributes)
|
42
|
+
return if attributes.empty?
|
43
|
+
test_name = normalize_test_name(test_name)
|
44
|
+
@attributes ||= {}
|
45
|
+
@attributes[test_name] ||= {}
|
46
|
+
@attributes[test_name] = @attributes[test_name].merge(attributes)
|
47
|
+
end
|
48
|
+
|
49
|
+
def attributes(test_name)
|
50
|
+
test_name = normalize_test_name(test_name)
|
51
|
+
@attributes ||= {}
|
52
|
+
@attributes[test_name]
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
def normalize_test_name(test_name)
|
57
|
+
"test_#{test_name.to_s.sub(/^test_/, '')}"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
alias_method :run_without_attributes, :run
|
62
|
+
def run(result, &block)
|
63
|
+
run_without_attributes(TestResultAttributesSupport.new(result, self),
|
64
|
+
&block)
|
65
|
+
end
|
66
|
+
|
67
|
+
def attributes
|
68
|
+
self.class.attributes(@method_name) || {}
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
class TestResultAttributesSupport
|
73
|
+
def initialize(result, test)
|
74
|
+
@result = result
|
75
|
+
@test = test
|
76
|
+
end
|
77
|
+
|
78
|
+
def add_failure(failure)
|
79
|
+
failure.attributes = @test.attributes
|
80
|
+
method_missing(:add_failure, failure)
|
81
|
+
end
|
82
|
+
|
83
|
+
def add_error(error)
|
84
|
+
error.attributes = @test.attributes
|
85
|
+
method_missing(:add_error, error)
|
86
|
+
end
|
87
|
+
|
88
|
+
def method_missing(name, *args, &block)
|
89
|
+
@result.send(name, *args, &block)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
module AttributesFormatter
|
94
|
+
private
|
95
|
+
def format_attributes
|
96
|
+
return '' if attributes.empty?
|
97
|
+
attributes.collect do |key, value|
|
98
|
+
" #{key}: #{value}"
|
99
|
+
end.join("\n") + "\n"
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
class Failure
|
104
|
+
include AttributesFormatter
|
105
|
+
|
106
|
+
attr_accessor :attributes
|
107
|
+
|
108
|
+
alias_method :long_display_without_attributes, :long_display
|
109
|
+
def long_display
|
110
|
+
test_name_re = Regexp.escape(@test_name)
|
111
|
+
long_display_without_attributes.sub(/(^#{test_name_re}.*\n)/,
|
112
|
+
"\\1#{format_attributes}")
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
class Error
|
117
|
+
include AttributesFormatter
|
118
|
+
|
119
|
+
attr_accessor :attributes
|
120
|
+
|
121
|
+
alias_method :long_display_without_attributes, :long_display
|
122
|
+
def long_display
|
123
|
+
test_name_re = Regexp.escape(@test_name)
|
124
|
+
long_display_without_attributes.sub(/(^#{test_name_re}:\n)/,
|
125
|
+
"\\1#{format_attributes}")
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
File without changes
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module Test
|
2
|
+
class Color
|
3
|
+
NAMES = ["black", "red", "green", "yellow",
|
4
|
+
"blue", "magenta", "cyan", "white"]
|
5
|
+
def initialize(name, options={})
|
6
|
+
@name = name
|
7
|
+
@foreground = options[:foreground]
|
8
|
+
@foreground = true if @foreground.nil?
|
9
|
+
@intensity = options[:intensity]
|
10
|
+
@bold = options[:bold]
|
11
|
+
@italic = options[:italic]
|
12
|
+
@underline = options[:underline]
|
13
|
+
end
|
14
|
+
|
15
|
+
def sequence
|
16
|
+
sequence = []
|
17
|
+
if @name == "none"
|
18
|
+
elsif @name == "reset"
|
19
|
+
sequence << "0"
|
20
|
+
else
|
21
|
+
foreground_parameter = @foreground ? 3 : 4
|
22
|
+
foreground_parameter += 6 if @intensity
|
23
|
+
sequence << "#{foreground_parameter}#{NAMES.index(@name)}"
|
24
|
+
end
|
25
|
+
sequence << "1" if @bold
|
26
|
+
sequence << "3" if @italic
|
27
|
+
sequence << "4" if @underline
|
28
|
+
sequence
|
29
|
+
end
|
30
|
+
|
31
|
+
def escape_sequence
|
32
|
+
"\e[#{sequence.join(';')}m"
|
33
|
+
end
|
34
|
+
|
35
|
+
def +(other)
|
36
|
+
MixColor.new([self, other])
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
class MixColor
|
41
|
+
def initialize(colors)
|
42
|
+
@colors = colors
|
43
|
+
end
|
44
|
+
|
45
|
+
def sequence
|
46
|
+
@colors.inject([]) do |result, color|
|
47
|
+
result + color.sequence
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def escape_sequence
|
52
|
+
"\e[#{sequence.join(';')}m"
|
53
|
+
end
|
54
|
+
|
55
|
+
def +(other)
|
56
|
+
self.class.new([self, other])
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
require "test/unit/ui/console/testrunner"
|
2
|
+
|
3
|
+
module Test
|
4
|
+
module Unit
|
5
|
+
module UI
|
6
|
+
module Console
|
7
|
+
class ColorizedTestRunner < TestRunner
|
8
|
+
extend TestRunnerUtilities
|
9
|
+
|
10
|
+
SCHEMES = {
|
11
|
+
:default => {
|
12
|
+
"success" => Color.new("green", :bold => true),
|
13
|
+
"failure" => Color.new("red", :bold => true),
|
14
|
+
"pending" => Color.new("magenta", :bold => true),
|
15
|
+
"omission" => Color.new("blue", :bold => true),
|
16
|
+
"notification" => Color.new("cyan", :bold => true),
|
17
|
+
"error" => Color.new("yellow", :bold => true),
|
18
|
+
},
|
19
|
+
}
|
20
|
+
|
21
|
+
def initialize(suite, output_level=NORMAL, io=STDOUT)
|
22
|
+
super
|
23
|
+
@use_color = guess_color_availability
|
24
|
+
@color_scheme = SCHEMES[:default]
|
25
|
+
@reset_color = Color.new("reset")
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
def add_fault(fault)
|
30
|
+
@faults << fault
|
31
|
+
output_single_with_color(fault.single_character_display,
|
32
|
+
fault_color(fault),
|
33
|
+
PROGRESS_ONLY)
|
34
|
+
@already_outputted = true
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_finished(name)
|
38
|
+
unless @already_outputted
|
39
|
+
output_single_with_color(".",
|
40
|
+
@color_scheme["success"],
|
41
|
+
PROGRESS_ONLY)
|
42
|
+
end
|
43
|
+
nl(VERBOSE)
|
44
|
+
@already_outputted = false
|
45
|
+
end
|
46
|
+
|
47
|
+
def finished(elapsed_time)
|
48
|
+
nl
|
49
|
+
output("Finished in #{elapsed_time} seconds.")
|
50
|
+
@faults.each_with_index do |fault, index|
|
51
|
+
nl
|
52
|
+
output_single("%3d) " % (index + 1))
|
53
|
+
output_with_color(fault.long_display, fault_color(fault))
|
54
|
+
end
|
55
|
+
nl
|
56
|
+
output_with_color(@result.to_s, result_color)
|
57
|
+
end
|
58
|
+
|
59
|
+
def fault_color(fault)
|
60
|
+
@color_scheme[fault.class.name.split(/::/).last.downcase]
|
61
|
+
end
|
62
|
+
|
63
|
+
def result_color
|
64
|
+
if @result.passed?
|
65
|
+
if @result.pending_count > 0
|
66
|
+
@color_scheme["pending"]
|
67
|
+
elsif @result.notification_count > 0
|
68
|
+
@color_scheme["notification"]
|
69
|
+
else
|
70
|
+
@color_scheme["success"]
|
71
|
+
end
|
72
|
+
elsif @result.error_count > 0
|
73
|
+
@color_scheme["error"]
|
74
|
+
elsif @result.failure_count > 0
|
75
|
+
@color_scheme["failure"]
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def output_with_color(message, color=nil, level=NORMAL)
|
80
|
+
return unless output?(level)
|
81
|
+
output_single_with_color(message, color, level)
|
82
|
+
@io.puts
|
83
|
+
end
|
84
|
+
|
85
|
+
def output_single_with_color(message, color=nil, level=NORMAL)
|
86
|
+
return unless output?(level)
|
87
|
+
if @use_color and color
|
88
|
+
message = "%s%s%s" % [color.escape_sequence,
|
89
|
+
message,
|
90
|
+
@reset_color.escape_sequence]
|
91
|
+
end
|
92
|
+
@io.write(message)
|
93
|
+
@io.flush
|
94
|
+
end
|
95
|
+
|
96
|
+
def guess_color_availability
|
97
|
+
return false unless @io.tty?
|
98
|
+
term = ENV["TERM"]
|
99
|
+
return true if term and (/term\z/ =~ term or term == "screen")
|
100
|
+
return true if ENV["EMACS"] == "t"
|
101
|
+
false
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
AutoRunner::RUNNERS[:console] = Proc.new do
|
108
|
+
Test::Unit::UI::Console::ColorizedTestRunner
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|