glib2 0.20.0 → 0.90.2
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +92 -0
- data/README +22 -10
- data/Rakefile +54 -72
- data/ext/glib2/depend +10 -0
- data/ext/glib2/extconf.rb +61 -0
- data/ext/glib2/glib2.def +89 -0
- data/{src → ext/glib2}/rbgcompat.h +0 -0
- data/{src → ext/glib2}/rbglib.c +17 -7
- data/{src → ext/glib2}/rbglib.h +2 -2
- data/{src → ext/glib2}/rbglib_bookmarkfile.c +0 -0
- data/{src → ext/glib2}/rbglib_completion.c +0 -0
- data/{src → ext/glib2}/rbglib_convert.c +0 -0
- data/{src → ext/glib2}/rbglib_error.c +0 -0
- data/{src → ext/glib2}/rbglib_fileutils.c +0 -0
- data/{src → ext/glib2}/rbglib_i18n.c +0 -0
- data/{src → ext/glib2}/rbglib_int64.c +0 -0
- data/{src → ext/glib2}/rbglib_iochannel.c +0 -0
- data/{src → ext/glib2}/rbglib_keyfile.c +0 -0
- data/{src → ext/glib2}/rbglib_maincontext.c +1 -3
- data/{src → ext/glib2}/rbglib_mainloop.c +0 -0
- data/{src → ext/glib2}/rbglib_messages.c +0 -0
- data/{src → ext/glib2}/rbglib_pollfd.c +0 -0
- data/{src → ext/glib2}/rbglib_shell.c +0 -0
- data/{src → ext/glib2}/rbglib_source.c +0 -0
- data/{src → ext/glib2}/rbglib_spawn.c +0 -0
- data/{src → ext/glib2}/rbglib_threads.c +0 -0
- data/{src → ext/glib2}/rbglib_timer.c +0 -0
- data/{src → ext/glib2}/rbglib_unicode.c +0 -0
- data/{src → ext/glib2}/rbglib_utils.c +0 -0
- data/{src → ext/glib2}/rbglib_win32.c +0 -0
- data/{src → ext/glib2}/rbgobj_boxed.c +0 -0
- data/{src → ext/glib2}/rbgobj_closure.c +0 -0
- data/{src → ext/glib2}/rbgobj_convert.c +0 -0
- data/{src → ext/glib2}/rbgobj_enums.c +0 -0
- data/{src → ext/glib2}/rbgobj_fundamental.c +0 -0
- data/{src → ext/glib2}/rbgobj_object.c +0 -0
- data/{src → ext/glib2}/rbgobj_param.c +0 -0
- data/{src → ext/glib2}/rbgobj_paramspecs.c +0 -0
- data/{src → ext/glib2}/rbgobj_signal.c +0 -0
- data/{src → ext/glib2}/rbgobj_strv.c +0 -0
- data/{src → ext/glib2}/rbgobj_type.c +0 -0
- data/{src → ext/glib2}/rbgobj_typeinstance.c +0 -0
- data/{src → ext/glib2}/rbgobj_typeinterface.c +0 -0
- data/{src → ext/glib2}/rbgobj_typemodule.c +0 -0
- data/{src → ext/glib2}/rbgobj_typeplugin.c +0 -0
- data/{src → ext/glib2}/rbgobj_value.c +0 -0
- data/{src → ext/glib2}/rbgobj_valuearray.c +0 -0
- data/{src → ext/glib2}/rbgobj_valuetypes.c +0 -0
- data/{src → ext/glib2}/rbgobject.c +0 -0
- data/{src → ext/glib2}/rbgobject.h +0 -0
- data/{src → ext/glib2}/rbgprivate.h +0 -0
- data/ext/glib2/rbgutil.c +316 -0
- data/{src → ext/glib2}/rbgutil.h +9 -9
- data/{src → ext/glib2}/rbgutil_callback.c +0 -0
- data/extconf.rb +48 -60
- data/{src/lib → lib}/glib-mkenums.rb +2 -2
- data/{src/lib → lib}/glib2.rb +28 -9
- data/lib/gnome2-win32-binary-downloader.rb +92 -0
- data/{src/lib → lib}/mkmf-gnome2.rb +76 -89
- data/test-unit/COPYING +56 -0
- data/test-unit/GPL +340 -0
- data/test-unit/History.txt +232 -0
- data/test-unit/Manifest.txt +110 -0
- data/test-unit/PSFL +271 -0
- data/test-unit/README.txt +75 -0
- data/test-unit/Rakefile +53 -0
- data/test-unit/TODO +5 -0
- data/test-unit/bin/testrb +5 -0
- data/test-unit/html/bar.png +0 -0
- data/test-unit/html/bar.svg +153 -0
- data/test-unit/html/developer.png +0 -0
- data/test-unit/html/developer.svg +469 -0
- data/test-unit/html/famfamfam-logo.png +0 -0
- data/test-unit/html/favicon.ico +0 -0
- data/test-unit/html/favicon.png +0 -0
- data/test-unit/html/favicon.svg +82 -0
- data/test-unit/html/heading-mark.png +0 -0
- data/test-unit/html/heading-mark.svg +393 -0
- data/test-unit/html/index.html +247 -0
- data/test-unit/html/index.html.ja +270 -0
- data/test-unit/html/install.png +0 -0
- data/test-unit/html/install.svg +636 -0
- data/test-unit/html/jp.png +0 -0
- data/test-unit/html/kinotan-failure.png +0 -0
- data/test-unit/html/kinotan-pass.png +0 -0
- data/test-unit/html/logo.png +0 -0
- data/test-unit/html/logo.svg +483 -0
- data/test-unit/html/reference.png +0 -0
- data/test-unit/html/rubyforge.png +0 -0
- data/test-unit/html/tango-logo.png +0 -0
- data/test-unit/html/test-unit.css +339 -0
- data/test-unit/html/tutorial.png +0 -0
- data/test-unit/html/tutorial.svg +559 -0
- data/test-unit/html/us.png +0 -0
- data/test-unit/images/color-diff.png +0 -0
- data/test-unit/lib/test/unit.rb +328 -0
- data/test-unit/lib/test/unit/assertionfailederror.rb +25 -0
- data/test-unit/lib/test/unit/assertions.rb +1334 -0
- data/test-unit/lib/test/unit/attribute.rb +125 -0
- data/test-unit/lib/test/unit/autorunner.rb +363 -0
- data/test-unit/lib/test/unit/collector.rb +36 -0
- data/test-unit/lib/test/unit/collector/descendant.rb +23 -0
- data/test-unit/lib/test/unit/collector/dir.rb +108 -0
- data/test-unit/lib/test/unit/collector/load.rb +144 -0
- data/test-unit/lib/test/unit/collector/objectspace.rb +34 -0
- data/test-unit/lib/test/unit/color-scheme.rb +106 -0
- data/test-unit/lib/test/unit/color.rb +96 -0
- data/test-unit/lib/test/unit/diff.rb +740 -0
- data/test-unit/lib/test/unit/error.rb +130 -0
- data/test-unit/lib/test/unit/exceptionhandler.rb +39 -0
- data/test-unit/lib/test/unit/failure.rb +136 -0
- data/test-unit/lib/test/unit/fixture.rb +176 -0
- data/test-unit/lib/test/unit/notification.rb +129 -0
- data/test-unit/lib/test/unit/omission.rb +191 -0
- data/test-unit/lib/test/unit/pending.rb +150 -0
- data/test-unit/lib/test/unit/priority.rb +180 -0
- data/test-unit/lib/test/unit/runner/console.rb +52 -0
- data/test-unit/lib/test/unit/runner/emacs.rb +8 -0
- data/test-unit/lib/test/unit/runner/tap.rb +8 -0
- data/test-unit/lib/test/unit/testcase.rb +483 -0
- data/test-unit/lib/test/unit/testresult.rb +121 -0
- data/test-unit/lib/test/unit/testsuite.rb +110 -0
- data/test-unit/lib/test/unit/ui/console/outputlevel.rb +14 -0
- data/test-unit/lib/test/unit/ui/console/testrunner.rb +430 -0
- data/test-unit/lib/test/unit/ui/emacs/testrunner.rb +63 -0
- data/test-unit/lib/test/unit/ui/tap/testrunner.rb +82 -0
- data/test-unit/lib/test/unit/ui/testrunner.rb +53 -0
- data/test-unit/lib/test/unit/ui/testrunnermediator.rb +77 -0
- data/test-unit/lib/test/unit/ui/testrunnerutilities.rb +41 -0
- data/test-unit/lib/test/unit/util/backtracefilter.rb +42 -0
- data/test-unit/lib/test/unit/util/method-owner-finder.rb +28 -0
- data/test-unit/lib/test/unit/util/observable.rb +90 -0
- data/test-unit/lib/test/unit/util/output.rb +31 -0
- data/test-unit/lib/test/unit/util/procwrapper.rb +48 -0
- data/test-unit/lib/test/unit/version.rb +7 -0
- data/test-unit/sample/adder.rb +13 -0
- data/test-unit/sample/subtracter.rb +12 -0
- data/test-unit/sample/test_adder.rb +20 -0
- data/test-unit/sample/test_subtracter.rb +20 -0
- data/test-unit/sample/test_user.rb +23 -0
- data/test-unit/test/collector/test-descendant.rb +133 -0
- data/test-unit/test/collector/test-load.rb +442 -0
- data/test-unit/test/collector/test_dir.rb +406 -0
- data/test-unit/test/collector/test_objectspace.rb +100 -0
- data/test-unit/test/run-test.rb +15 -0
- data/test-unit/test/test-attribute.rb +86 -0
- data/test-unit/test/test-color-scheme.rb +69 -0
- data/test-unit/test/test-color.rb +47 -0
- data/test-unit/test/test-diff.rb +518 -0
- data/test-unit/test/test-emacs-runner.rb +60 -0
- data/test-unit/test/test-fixture.rb +287 -0
- data/test-unit/test/test-notification.rb +33 -0
- data/test-unit/test/test-omission.rb +81 -0
- data/test-unit/test/test-pending.rb +70 -0
- data/test-unit/test/test-priority.rb +119 -0
- data/test-unit/test/test-testcase.rb +544 -0
- data/test-unit/test/test_assertions.rb +1197 -0
- data/test-unit/test/test_error.rb +26 -0
- data/test-unit/test/test_failure.rb +33 -0
- data/test-unit/test/test_testresult.rb +113 -0
- data/test-unit/test/test_testsuite.rb +129 -0
- data/test-unit/test/testunit-test-util.rb +14 -0
- data/test-unit/test/ui/test_tap.rb +33 -0
- data/test-unit/test/ui/test_testrunmediator.rb +20 -0
- data/test-unit/test/util/test-method-owner-finder.rb +38 -0
- data/test-unit/test/util/test-output.rb +11 -0
- data/test-unit/test/util/test_backtracefilter.rb +41 -0
- data/test-unit/test/util/test_observable.rb +102 -0
- data/test-unit/test/util/test_procwrapper.rb +36 -0
- data/test/run-test.rb +2 -6
- metadata +197 -100
- data/src/glib-enum-types.c +0 -1032
- data/src/glib-enum-types.h +0 -140
- data/src/lib/pkg-config.rb +0 -137
- data/src/rbgutil.c +0 -222
@@ -0,0 +1,36 @@
|
|
1
|
+
module Test
|
2
|
+
module Unit
|
3
|
+
module Collector
|
4
|
+
def initialize
|
5
|
+
@filters = []
|
6
|
+
end
|
7
|
+
|
8
|
+
def filter=(filters)
|
9
|
+
@filters = case(filters)
|
10
|
+
when Proc
|
11
|
+
[filters]
|
12
|
+
when Array
|
13
|
+
filters
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def add_suite(destination, suite)
|
18
|
+
to_delete = suite.tests.find_all{|t| !include?(t)}
|
19
|
+
to_delete.each{|t| suite.delete(t)}
|
20
|
+
destination << suite unless(suite.size == 0)
|
21
|
+
end
|
22
|
+
|
23
|
+
def include?(test)
|
24
|
+
return true if(@filters.empty?)
|
25
|
+
@filters.each do |filter|
|
26
|
+
return false if filter[test] == false
|
27
|
+
end
|
28
|
+
true
|
29
|
+
end
|
30
|
+
|
31
|
+
def sort(suites)
|
32
|
+
suites.sort_by {|suite| suite.name || suite.to_s}
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'test/unit/collector'
|
2
|
+
|
3
|
+
module Test
|
4
|
+
module Unit
|
5
|
+
module Collector
|
6
|
+
class Descendant
|
7
|
+
include Collector
|
8
|
+
|
9
|
+
NAME = 'collected from the subclasses of TestCase'
|
10
|
+
|
11
|
+
def collect(name=NAME)
|
12
|
+
suite = TestSuite.new(name)
|
13
|
+
sub_suites = []
|
14
|
+
TestCase::DESCENDANTS.each do |descendant_test_case|
|
15
|
+
add_suite(sub_suites, descendant_test_case.suite)
|
16
|
+
end
|
17
|
+
sort(sub_suites).each {|s| suite << s}
|
18
|
+
suite
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
require 'test/unit/testsuite'
|
2
|
+
require 'test/unit/collector'
|
3
|
+
|
4
|
+
module Test
|
5
|
+
module Unit
|
6
|
+
module Collector
|
7
|
+
class Dir
|
8
|
+
include Collector
|
9
|
+
|
10
|
+
attr_reader :pattern, :exclude
|
11
|
+
attr_accessor :base
|
12
|
+
|
13
|
+
def initialize(dir=::Dir, file=::File, object_space=::ObjectSpace, req=nil)
|
14
|
+
super()
|
15
|
+
@dir = dir
|
16
|
+
@file = file
|
17
|
+
@object_space = object_space
|
18
|
+
@req = req
|
19
|
+
@pattern = [/\btest_.*\.rb\Z/m]
|
20
|
+
@exclude = []
|
21
|
+
@base = nil
|
22
|
+
end
|
23
|
+
|
24
|
+
def collect(*from)
|
25
|
+
basedir = @base
|
26
|
+
$:.push(basedir) if basedir
|
27
|
+
if(from.empty?)
|
28
|
+
recursive_collect('.', find_test_cases)
|
29
|
+
elsif(from.size == 1)
|
30
|
+
recursive_collect(from.first, find_test_cases)
|
31
|
+
else
|
32
|
+
suites = []
|
33
|
+
from.each do |f|
|
34
|
+
suite = recursive_collect(f, find_test_cases)
|
35
|
+
suites << suite unless(suite.tests.empty?)
|
36
|
+
end
|
37
|
+
suite = TestSuite.new("[#{from.join(', ')}]")
|
38
|
+
sort(suites).each{|s| suite << s}
|
39
|
+
suite
|
40
|
+
end
|
41
|
+
ensure
|
42
|
+
$:.delete_at($:.rindex(basedir)) if basedir
|
43
|
+
end
|
44
|
+
|
45
|
+
def find_test_cases(ignore=[])
|
46
|
+
cases = []
|
47
|
+
@object_space.each_object(Class) do |c|
|
48
|
+
cases << c if(c < TestCase && !ignore.include?(c))
|
49
|
+
end
|
50
|
+
ignore.concat(cases)
|
51
|
+
cases
|
52
|
+
end
|
53
|
+
|
54
|
+
def recursive_collect(name, already_gathered)
|
55
|
+
sub_suites = []
|
56
|
+
path = realdir(name)
|
57
|
+
if @file.directory?(path)
|
58
|
+
dir_name = name unless name == '.'
|
59
|
+
@dir.entries(path).each do |e|
|
60
|
+
next if(e == '.' || e == '..')
|
61
|
+
e_name = dir_name ? @file.join(dir_name, e) : e
|
62
|
+
if @file.directory?(realdir(e_name))
|
63
|
+
next if /\A(?:CVS|\.svn|\.git)\z/ =~ e
|
64
|
+
sub_suite = recursive_collect(e_name, already_gathered)
|
65
|
+
sub_suites << sub_suite unless(sub_suite.empty?)
|
66
|
+
else
|
67
|
+
next if /~\z/ =~ e_name or /\A\.\#/ =~ e
|
68
|
+
if @pattern and !@pattern.empty?
|
69
|
+
next unless @pattern.any? {|pat| pat =~ e_name}
|
70
|
+
end
|
71
|
+
if @exclude and !@exclude.empty?
|
72
|
+
next if @exclude.any? {|pat| pat =~ e_name}
|
73
|
+
end
|
74
|
+
collect_file(e_name, sub_suites, already_gathered)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
else
|
78
|
+
collect_file(name, sub_suites, already_gathered)
|
79
|
+
end
|
80
|
+
suite = TestSuite.new(@file.basename(name))
|
81
|
+
sort(sub_suites).each{|s| suite << s}
|
82
|
+
suite
|
83
|
+
end
|
84
|
+
|
85
|
+
def collect_file(name, suites, already_gathered)
|
86
|
+
dir = @file.dirname(@file.expand_path(name, @base))
|
87
|
+
$:.unshift(dir)
|
88
|
+
if(@req)
|
89
|
+
@req.require(name)
|
90
|
+
else
|
91
|
+
require(name)
|
92
|
+
end
|
93
|
+
find_test_cases(already_gathered).each{|t| add_suite(suites, t.suite)}
|
94
|
+
ensure
|
95
|
+
$:.delete_at($:.rindex(dir)) if(dir)
|
96
|
+
end
|
97
|
+
|
98
|
+
def realdir(path)
|
99
|
+
if @base
|
100
|
+
@file.join(@base, path)
|
101
|
+
else
|
102
|
+
path
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
@@ -0,0 +1,144 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
|
3
|
+
require 'test/unit/testsuite'
|
4
|
+
require 'test/unit/collector'
|
5
|
+
|
6
|
+
module Test
|
7
|
+
module Unit
|
8
|
+
module Collector
|
9
|
+
class Load
|
10
|
+
include Collector
|
11
|
+
|
12
|
+
attr_reader :patterns, :excludes, :base
|
13
|
+
|
14
|
+
def initialize
|
15
|
+
super
|
16
|
+
@system_excludes = [/~\z/, /\A\.\#/]
|
17
|
+
@system_directory_excludes = [/\A(?:CVS|\.svn|\.git)\z/]
|
18
|
+
@patterns = [/\Atest[_\-].+\.rb\z/m, /[_\-]test\.rb\z/]
|
19
|
+
@excludes = []
|
20
|
+
@base = nil
|
21
|
+
end
|
22
|
+
|
23
|
+
def base=(base)
|
24
|
+
base = Pathname(base) unless base.nil?
|
25
|
+
@base = base
|
26
|
+
end
|
27
|
+
|
28
|
+
def collect(*froms)
|
29
|
+
add_load_path(@base) do
|
30
|
+
froms = ["."] if froms.empty?
|
31
|
+
test_suites = []
|
32
|
+
already_gathered = find_test_cases
|
33
|
+
froms.each do |from|
|
34
|
+
from = resolve_path(from)
|
35
|
+
if from.directory?
|
36
|
+
test_suite = collect_recursive(from, already_gathered)
|
37
|
+
test_suites << test_suite unless test_suite.tests.empty?
|
38
|
+
else
|
39
|
+
collect_file(from, test_suites, already_gathered)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
if test_suites.size > 1
|
44
|
+
test_suite = TestSuite.new("[#{froms.join(', ')}]")
|
45
|
+
sort(test_suites).each do |sub_test_suite|
|
46
|
+
test_suite << sub_test_suite
|
47
|
+
end
|
48
|
+
test_suite
|
49
|
+
else
|
50
|
+
test_suites.first
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def find_test_cases(ignore=[])
|
56
|
+
test_cases = []
|
57
|
+
TestCase::DESCENDANTS.each do |test_case|
|
58
|
+
test_cases << test_case unless ignore.include?(test_case)
|
59
|
+
end
|
60
|
+
ignore.concat(test_cases)
|
61
|
+
test_cases
|
62
|
+
end
|
63
|
+
|
64
|
+
private
|
65
|
+
def collect_recursive(path, already_gathered)
|
66
|
+
sub_test_suites = []
|
67
|
+
|
68
|
+
if path.directory?
|
69
|
+
directories, files = path.children.partition do |child|
|
70
|
+
child.directory?
|
71
|
+
end
|
72
|
+
|
73
|
+
files.each do |child|
|
74
|
+
next if excluded_file?(child.basename.to_s)
|
75
|
+
collect_file(child, sub_test_suites, already_gathered)
|
76
|
+
end
|
77
|
+
|
78
|
+
directories.each do |child|
|
79
|
+
next if excluded_directory?(child.basename.to_s)
|
80
|
+
sub_test_suite = collect_recursive(child, already_gathered)
|
81
|
+
sub_test_suites << sub_test_suite unless sub_test_suite.empty?
|
82
|
+
end
|
83
|
+
else
|
84
|
+
unless excluded_file?(path.basename.to_s)
|
85
|
+
collect_file(path, sub_test_suites, already_gathered)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
test_suite = TestSuite.new(path.basename.to_s)
|
90
|
+
sort(sub_test_suites).each do |sub_test_suite|
|
91
|
+
test_suite << sub_test_suite
|
92
|
+
end
|
93
|
+
test_suite
|
94
|
+
end
|
95
|
+
|
96
|
+
def collect_file(path, test_suites, already_gathered)
|
97
|
+
@program_file ||= File.expand_path($0)
|
98
|
+
return if @program_file == path.expand_path.to_s
|
99
|
+
add_load_path(path.expand_path.dirname) do
|
100
|
+
require(path.to_s)
|
101
|
+
find_test_cases(already_gathered).each do |test_case|
|
102
|
+
add_suite(test_suites, test_case.suite)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
def resolve_path(path)
|
108
|
+
if @base
|
109
|
+
@base + path
|
110
|
+
else
|
111
|
+
Pathname(path)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def add_load_path(path)
|
116
|
+
$LOAD_PATH.push(path.to_s) if path
|
117
|
+
yield
|
118
|
+
ensure
|
119
|
+
$LOAD_PATH.delete_at($LOAD_PATH.rindex(path.to_s)) if path
|
120
|
+
end
|
121
|
+
|
122
|
+
def excluded_directory?(base)
|
123
|
+
@system_directory_excludes.any? {|pattern| pattern =~ base}
|
124
|
+
end
|
125
|
+
|
126
|
+
def excluded_file?(base)
|
127
|
+
return true if @system_excludes.any? {|pattern| pattern =~ base}
|
128
|
+
|
129
|
+
patterns = @patterns || []
|
130
|
+
unless patterns.empty?
|
131
|
+
return true unless patterns.any? {|pattern| pattern =~ base}
|
132
|
+
end
|
133
|
+
|
134
|
+
excludes = @excludes || []
|
135
|
+
unless excludes.empty?
|
136
|
+
return true if excludes.any? {|pattern| pattern =~ base}
|
137
|
+
end
|
138
|
+
|
139
|
+
false
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# Author:: Nathaniel Talbott.
|
2
|
+
# Copyright:: Copyright (c) 2000-2003 Nathaniel Talbott. All rights reserved.
|
3
|
+
# License:: Ruby license.
|
4
|
+
|
5
|
+
require 'test/unit/collector'
|
6
|
+
|
7
|
+
module Test
|
8
|
+
module Unit
|
9
|
+
module Collector
|
10
|
+
class ObjectSpace
|
11
|
+
include Collector
|
12
|
+
|
13
|
+
NAME = 'collected from the ObjectSpace'
|
14
|
+
|
15
|
+
def initialize(source=::ObjectSpace)
|
16
|
+
super()
|
17
|
+
@source = source
|
18
|
+
end
|
19
|
+
|
20
|
+
def collect(name=NAME)
|
21
|
+
suite = TestSuite.new(name)
|
22
|
+
sub_suites = []
|
23
|
+
@source.each_object(Class) do |klass|
|
24
|
+
if(Test::Unit::TestCase > klass)
|
25
|
+
add_suite(sub_suites, klass.suite)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
sort(sub_suites).each{|s| suite << s}
|
29
|
+
suite
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,106 @@
|
|
1
|
+
require 'test/unit/color'
|
2
|
+
|
3
|
+
module Test
|
4
|
+
module Unit
|
5
|
+
class ColorScheme
|
6
|
+
include Enumerable
|
7
|
+
|
8
|
+
class << self
|
9
|
+
@@default = nil
|
10
|
+
def default
|
11
|
+
@@default ||= new("pass" =>
|
12
|
+
Color.new("green", :foreground => false) +
|
13
|
+
Color.new("white", :bold => true),
|
14
|
+
"failure" =>
|
15
|
+
Color.new("red", :foreground => false) +
|
16
|
+
Color.new("white", :bold => true),
|
17
|
+
"pending" => Color.new("magenta", :bold => true),
|
18
|
+
"omission" => Color.new("blue", :bold => true),
|
19
|
+
"notification" => Color.new("cyan", :bold => true),
|
20
|
+
"error" => Color.new("yellow", :bold => true) +
|
21
|
+
Color.new("black", :foreground => false),
|
22
|
+
"case" => Color.new("white", :bold => true) +
|
23
|
+
Color.new("blue", :foreground => false),
|
24
|
+
"suite" => Color.new("white", :bold => true) +
|
25
|
+
Color.new("green", :foreground => false),
|
26
|
+
"diff-inserted-tag" =>
|
27
|
+
Color.new("red", :bold => true),
|
28
|
+
"diff-deleted-tag" =>
|
29
|
+
Color.new("green", :bold => true),
|
30
|
+
"diff-difference-tag" =>
|
31
|
+
Color.new("cyan", :bold => true),
|
32
|
+
"diff-inserted" =>
|
33
|
+
Color.new("red", :foreground => false) +
|
34
|
+
Color.new("white", :bold => true),
|
35
|
+
"diff-deleted" =>
|
36
|
+
Color.new("green", :foreground => false) +
|
37
|
+
Color.new("white", :bold => true))
|
38
|
+
end
|
39
|
+
|
40
|
+
@@schemes = {}
|
41
|
+
def all
|
42
|
+
@@schemes.merge("default" => default)
|
43
|
+
end
|
44
|
+
|
45
|
+
def [](id)
|
46
|
+
@@schemes[id.to_s]
|
47
|
+
end
|
48
|
+
|
49
|
+
def []=(id, scheme_or_spec)
|
50
|
+
if scheme_or_spec.is_a?(self)
|
51
|
+
scheme = scheme_or_spec
|
52
|
+
else
|
53
|
+
scheme = new(scheme_or_spec)
|
54
|
+
end
|
55
|
+
@@schemes[id.to_s] = scheme
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def initialize(scheme_spec)
|
60
|
+
@scheme = {}
|
61
|
+
scheme_spec.each do |key, color_spec|
|
62
|
+
self[key] = color_spec
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def [](name)
|
67
|
+
@scheme[name.to_s]
|
68
|
+
end
|
69
|
+
|
70
|
+
def []=(name, color_spec)
|
71
|
+
@scheme[name.to_s] = make_color(color_spec)
|
72
|
+
end
|
73
|
+
|
74
|
+
def each(&block)
|
75
|
+
@scheme.each(&block)
|
76
|
+
end
|
77
|
+
|
78
|
+
def to_hash
|
79
|
+
hash = {}
|
80
|
+
@scheme.each do |key, color|
|
81
|
+
hash[key] = color
|
82
|
+
end
|
83
|
+
hash
|
84
|
+
end
|
85
|
+
|
86
|
+
private
|
87
|
+
def make_color(color_spec)
|
88
|
+
if color_spec.is_a?(Color) or color_spec.is_a?(MixColor)
|
89
|
+
color_spec
|
90
|
+
else
|
91
|
+
color_name = nil
|
92
|
+
normalized_color_spec = {}
|
93
|
+
color_spec.each do |key, value|
|
94
|
+
key = key.to_sym
|
95
|
+
if key == :name
|
96
|
+
color_name = value
|
97
|
+
else
|
98
|
+
normalized_color_spec[key] = value
|
99
|
+
end
|
100
|
+
end
|
101
|
+
Color.new(color_name, normalized_color_spec)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|