core_ex 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +26 -0
- data/NEWS +8 -0
- data/README +1 -0
- data/Rakefile +7 -0
- data/SPEC.dyn.yml +8 -0
- data/SPEC.yml +37 -0
- data/lib/core_ex/attr_once.rb +36 -0
- data/lib/core_ex/dtime.rb +169 -0
- data/lib/core_ex/embedded_tests.rb +33 -0
- data/lib/core_ex/enumerable.rb +173 -0
- data/lib/core_ex/exception.rb +32 -0
- data/lib/core_ex/filelist.rb +464 -0
- data/lib/core_ex/fileutils.rb +44 -0
- data/lib/core_ex/pathname.rb +196 -0
- data/lib/core_ex/require.rb +378 -0
- data/lib/core_ex/string.rb +47 -0
- data/lib/core_ex/temp_path.rb +194 -0
- data/lib/core_ex/test/unit/ui/yaml/testrunner.rb +166 -0
- data/lib/core_ex/time.rb +91 -0
- data/lib/core_ex/version.rb +119 -0
- data/lib/core_ex/yaml.rb +24 -0
- data/lib/core_ex.rb +55 -0
- data/test/check-core_ex.yml +12 -0
- data/test/check-pkg-core_ex.yml +15 -0
- data/test/resources/autoload_tree/A.rb +11 -0
- data/test/resources/autoload_tree/B.rb +10 -0
- data/test/resources/autoload_tree/foo/C.rb +18 -0
- data/test/resources/require/test_require +1 -0
- data/test/resources/require/test_require_rb.rb +1 -0
- data/test/resources/require/test_require_so.so +1 -0
- data/test/resources/use-from-gems.rb +9 -0
- data/test/resources/yaml_testrunner/unit_test.rb +43 -0
- data/test/sanity/multiple-requires.yml +20 -0
- data/test/sanity/single-requires.yml +24 -0
- data/test/sanity-suite.yml +12 -0
- data/test/test-unit-setup.rb +6 -0
- data/test/unit-suite.yml +14 -0
- metadata +113 -0
@@ -0,0 +1,166 @@
|
|
1
|
+
# Author:: Nicolas Despres <nicolas.despres@epita.fr>.
|
2
|
+
# Copyright:: Copyright (c) 2004 TTK Team. All rights reserved.
|
3
|
+
# License:: Ruby license.
|
4
|
+
|
5
|
+
# $LastChangedBy: ertai $
|
6
|
+
# $Id: testrunner.rb 252 2005-05-31 23:41:42Z ertai $
|
7
|
+
|
8
|
+
|
9
|
+
require 'test/unit/autorunner'
|
10
|
+
require 'test/unit/ui/testrunnermediator'
|
11
|
+
require 'test/unit/ui/testrunnermediator'
|
12
|
+
require 'test/unit/ui/testrunnerutilities'
|
13
|
+
require 'core_ex'
|
14
|
+
|
15
|
+
|
16
|
+
module Test
|
17
|
+
|
18
|
+
module Unit
|
19
|
+
|
20
|
+
module UI
|
21
|
+
|
22
|
+
module Yaml
|
23
|
+
|
24
|
+
class TestRunner
|
25
|
+
extend TestRunnerUtilities
|
26
|
+
|
27
|
+
public
|
28
|
+
def initialize(suite, output_level=NORMAL, io=STDOUT)
|
29
|
+
if (suite.respond_to?(:suite))
|
30
|
+
@suite = suite.suite
|
31
|
+
else
|
32
|
+
@suite = suite
|
33
|
+
end
|
34
|
+
@output_level = output_level
|
35
|
+
@io = io
|
36
|
+
@failures = []
|
37
|
+
@errors = []
|
38
|
+
end
|
39
|
+
|
40
|
+
# Begins the test run.
|
41
|
+
public
|
42
|
+
def start
|
43
|
+
setup_mediator
|
44
|
+
attach_to_mediator
|
45
|
+
return start_mediator
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
def setup_mediator
|
50
|
+
@mediator = create_mediator(@suite)
|
51
|
+
suite_name = @suite.to_s
|
52
|
+
if ( @suite.kind_of?(Module) )
|
53
|
+
suite_name = @suite.name
|
54
|
+
end
|
55
|
+
@io.puts('---')
|
56
|
+
@io.puts("suite_class: #{suite_name}")
|
57
|
+
@io.puts('details:') if $VERBOSE
|
58
|
+
@test_outcome = 'S'
|
59
|
+
end
|
60
|
+
|
61
|
+
private
|
62
|
+
def create_mediator(suite)
|
63
|
+
return TestRunnerMediator.new(suite)
|
64
|
+
end
|
65
|
+
|
66
|
+
private
|
67
|
+
def attach_to_mediator
|
68
|
+
@mediator.add_listener(TestResult::FAULT, &method(:add_fault))
|
69
|
+
@mediator.add_listener(TestRunnerMediator::STARTED,
|
70
|
+
&method(:started))
|
71
|
+
@mediator.add_listener(TestRunnerMediator::FINISHED,
|
72
|
+
&method(:finished))
|
73
|
+
if $VERBOSE
|
74
|
+
@mediator.add_listener(TestCase::STARTED,
|
75
|
+
&method(:test_started))
|
76
|
+
@mediator.add_listener(TestCase::FINISHED,
|
77
|
+
&method(:test_finished))
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
private
|
82
|
+
def test_started(name)
|
83
|
+
@test_start_time = Time.now
|
84
|
+
@io.print(" #{name}:")
|
85
|
+
@io.flush
|
86
|
+
end
|
87
|
+
|
88
|
+
private
|
89
|
+
def test_finished(name)
|
90
|
+
#FIXME: remove the double-quote when the TTK Dumper manages oneline
|
91
|
+
# feature
|
92
|
+
@io.puts(" \"[ #@test_outcome, #{Time.now - @test_start_time} ]\"")
|
93
|
+
@test_outcome = 'S'
|
94
|
+
@io.flush
|
95
|
+
end
|
96
|
+
|
97
|
+
private
|
98
|
+
def start_mediator
|
99
|
+
return @mediator.run_suite
|
100
|
+
end
|
101
|
+
|
102
|
+
private
|
103
|
+
def add_fault(fault)
|
104
|
+
case fault.class.to_s
|
105
|
+
when 'Test::Unit::Failure'
|
106
|
+
@test_outcome = 'F'
|
107
|
+
@failures << fault
|
108
|
+
when 'Test::Unit::Error'
|
109
|
+
@test_outcome = 'E'
|
110
|
+
@errors << fault
|
111
|
+
else
|
112
|
+
raise(Exception, 'unexpected fault!!')
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
private
|
117
|
+
def started(result)
|
118
|
+
@result = result
|
119
|
+
end
|
120
|
+
|
121
|
+
private
|
122
|
+
def finished(elapsed_time)
|
123
|
+
t = DTime.new(elapsed_time)
|
124
|
+
@io.puts("elapsed_time: #{t}")
|
125
|
+
if $VERBOSE
|
126
|
+
@io.puts("detail_elpased_time: #{t.inspect}")
|
127
|
+
end
|
128
|
+
@io.puts("tests_number: #{@result.run_count}")
|
129
|
+
@io.puts("assertions_number: #{@result.assertion_count}")
|
130
|
+
@io.puts("errors_number: #{@errors.length}")
|
131
|
+
@io.puts("failures_number: #{@failures.length}")
|
132
|
+
unless @failures.empty?
|
133
|
+
@io.puts('failures:')
|
134
|
+
@failures.each { |fault| print_fault(fault) }
|
135
|
+
end
|
136
|
+
unless @errors.empty?
|
137
|
+
@io.puts('errors:')
|
138
|
+
@errors.each { |err| print_fault(err) }
|
139
|
+
end
|
140
|
+
@io.flush
|
141
|
+
end
|
142
|
+
|
143
|
+
private
|
144
|
+
def print_fault(fault)
|
145
|
+
fault_disp = fault.long_display.split("\n")
|
146
|
+
indent = ' '
|
147
|
+
@io.puts("#{indent}#{fault_disp[1].chomp(':')}: |")
|
148
|
+
for i in 2...fault_disp.length do
|
149
|
+
2.times { @io.print(indent) }
|
150
|
+
@io.puts(fault_disp[i].strip)
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
end # class TestRunner
|
155
|
+
|
156
|
+
end # module Yaml
|
157
|
+
|
158
|
+
end # module UI
|
159
|
+
|
160
|
+
end # module Unit
|
161
|
+
|
162
|
+
end # module Test
|
163
|
+
|
164
|
+
Test::Unit::AutoRunner::RUNNERS[:yaml] = lambda do |r|
|
165
|
+
Test::Unit::UI::Yaml::TestRunner
|
166
|
+
end
|
data/lib/core_ex/time.rb
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
2
|
+
# Copyright:: Copyright (c) 2005 Nicolas Pouillard. All rights reserved.
|
3
|
+
# License:: GNU General Public License (GPL).
|
4
|
+
# Revision:: $Id: time.rb 252 2005-05-31 23:41:42Z ertai $
|
5
|
+
|
6
|
+
require 'time'
|
7
|
+
require 'core_ex'
|
8
|
+
require 'core_ex/dtime'
|
9
|
+
|
10
|
+
class Time
|
11
|
+
|
12
|
+
PRECISION = 1e-016
|
13
|
+
|
14
|
+
def float_minus ( rhs )
|
15
|
+
diff = to_f - rhs.to_f
|
16
|
+
(diff / PRECISION).to_i * PRECISION
|
17
|
+
end
|
18
|
+
private :float_minus
|
19
|
+
|
20
|
+
|
21
|
+
undef :-
|
22
|
+
undef :+
|
23
|
+
|
24
|
+
|
25
|
+
def - ( rhs )
|
26
|
+
case rhs
|
27
|
+
when Time
|
28
|
+
DTime.new(float_minus(rhs))
|
29
|
+
when 0
|
30
|
+
self
|
31
|
+
when Numeric
|
32
|
+
Time.at(float_minus(rhs)).utc
|
33
|
+
when DTime
|
34
|
+
Time.at(float_minus(rhs)).utc
|
35
|
+
else
|
36
|
+
raise TypeError, rhs
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
|
41
|
+
def + ( rhs )
|
42
|
+
if rhs.is_a? Numeric or rhs.is_a? DTime
|
43
|
+
Time.at(to_f + rhs.to_f).utc
|
44
|
+
else
|
45
|
+
raise TypeError, rhs
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
def self.diff ( *args, &block )
|
51
|
+
DTime.diff(*args, &block)
|
52
|
+
end
|
53
|
+
|
54
|
+
end # class Time
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
test_section __FILE__ do
|
59
|
+
|
60
|
+
class TimeExTest < Test::Unit::TestCase
|
61
|
+
|
62
|
+
def setup
|
63
|
+
@t1, @t2 = Time.now, Time.now
|
64
|
+
end
|
65
|
+
|
66
|
+
def test_minus
|
67
|
+
d1 = @t1 - @t2
|
68
|
+
assert_kind_of(DTime, d1)
|
69
|
+
assert_kind_of(Time, Time.now - d1)
|
70
|
+
assert_kind_of(Time, Time.now - 1.4)
|
71
|
+
assert_kind_of(Time, Time.now - 4)
|
72
|
+
assert_equal(@t1, @t1 - 0)
|
73
|
+
assert_equal(@t1, @t1 - 0.0)
|
74
|
+
assert_equal(0, (@t1 - @t1).to_f)
|
75
|
+
end
|
76
|
+
|
77
|
+
def test_minus_2
|
78
|
+
t = Time.utc(1937, 1, 1, 11, 40, 27, 870000)
|
79
|
+
s = "1937-01-01T12:00:27.87+00:20"
|
80
|
+
assert_equal(0, (t - Time.iso8601(s)).to_f)
|
81
|
+
end
|
82
|
+
|
83
|
+
def test_plus
|
84
|
+
d1 = @t1 - @t2
|
85
|
+
assert_raise(TypeError) { @t1 + @t2 }
|
86
|
+
assert_kind_of(Time, @t1 + d1)
|
87
|
+
end
|
88
|
+
|
89
|
+
end # TimeExTest
|
90
|
+
|
91
|
+
end
|
@@ -0,0 +1,119 @@
|
|
1
|
+
# Copyright: Copyright (c) 2004 Nicolas Despres. All rights reserved.
|
2
|
+
# Author: Nicolas Despres <polrop@lrde.epita.fr>.
|
3
|
+
# License: Gnu General Public License.
|
4
|
+
|
5
|
+
# $LastChangedBy: ertai $
|
6
|
+
# $Id: version.rb 252 2005-05-31 23:41:42Z ertai $
|
7
|
+
|
8
|
+
require 'core_ex'
|
9
|
+
|
10
|
+
class Version
|
11
|
+
include Comparable
|
12
|
+
|
13
|
+
attr_accessor :major, :minor, :build, :revision
|
14
|
+
|
15
|
+
def initialize(major, minor, build, revision)
|
16
|
+
@major = major
|
17
|
+
@minor = minor
|
18
|
+
@build = build
|
19
|
+
@revision = revision
|
20
|
+
end
|
21
|
+
|
22
|
+
def <=>(other)
|
23
|
+
to_a <=> other.to_a
|
24
|
+
end
|
25
|
+
|
26
|
+
def pp
|
27
|
+
"#{to_s} (Revision: #@revision)"
|
28
|
+
end
|
29
|
+
|
30
|
+
def to_s
|
31
|
+
"#@major.#@minor.#@build"
|
32
|
+
end
|
33
|
+
|
34
|
+
def to_a
|
35
|
+
[ @major, @minor, @build, @revision ]
|
36
|
+
end
|
37
|
+
|
38
|
+
def major_release
|
39
|
+
@major += 1
|
40
|
+
@minor = 0
|
41
|
+
@build = 0
|
42
|
+
@revision += 1
|
43
|
+
self
|
44
|
+
end
|
45
|
+
|
46
|
+
def minor_release
|
47
|
+
@minor += 1
|
48
|
+
@build = 0
|
49
|
+
@revision += 1
|
50
|
+
self
|
51
|
+
end
|
52
|
+
|
53
|
+
def build_release
|
54
|
+
@build += 1
|
55
|
+
@revision += 1
|
56
|
+
self
|
57
|
+
end
|
58
|
+
|
59
|
+
end # class Version
|
60
|
+
|
61
|
+
|
62
|
+
test_section __FILE__ do
|
63
|
+
|
64
|
+
|
65
|
+
class VersionTest < Test::Unit::TestCase
|
66
|
+
|
67
|
+
def setup
|
68
|
+
@a = Version.new(0, 1, 2, 3)
|
69
|
+
@b = Version.new(2, 1, 0, 10)
|
70
|
+
@c = Version.new(0, 0, 0, 0)
|
71
|
+
end
|
72
|
+
|
73
|
+
|
74
|
+
def test_simple
|
75
|
+
assert(Version.new(0, 1, 2, 3) < Version.new(0, 1, 2, 4))
|
76
|
+
assert(Version.new(0, 1, 2, 4) > Version.new(0, 1, 2, 3))
|
77
|
+
assert(Version.new(0, 1, 2, 3) == Version.new(0, 1, 2, 3))
|
78
|
+
assert(Version.new(0, 1, 3, 3) > Version.new(0, 1, 2, 3))
|
79
|
+
assert(Version.new(0, 1, 2, 3) < Version.new(0, 1, 3, 3))
|
80
|
+
assert(Version.new(3, 2, 2, 3) > Version.new(3, 1, 2, 3))
|
81
|
+
assert(Version.new(0, 1, 2, 3) < Version.new(0, 2, 2, 3))
|
82
|
+
assert(Version.new(0, 3, 3, 3) < Version.new(1, 2, 2, 10))
|
83
|
+
end
|
84
|
+
|
85
|
+
def checker ( my, meth, *ref )
|
86
|
+
assert_equal(Version.new(*ref), my.send(meth), meth)
|
87
|
+
assert_equal(Version.new(*ref), my, meth)
|
88
|
+
end
|
89
|
+
|
90
|
+
def test_major_release
|
91
|
+
checker(@a, :major_release, 1, 0, 0, 4)
|
92
|
+
checker(@b, :major_release, 3, 0, 0, 11)
|
93
|
+
checker(@c, :major_release, 1, 0, 0, 1)
|
94
|
+
end
|
95
|
+
|
96
|
+
def test_minor_release
|
97
|
+
checker(@a, :minor_release, 0, 2, 0, 4)
|
98
|
+
checker(@b, :minor_release, 2, 2, 0, 11)
|
99
|
+
checker(@c, :minor_release, 0, 1, 0, 1)
|
100
|
+
end
|
101
|
+
|
102
|
+
def test_build_release
|
103
|
+
checker(@a, :build_release, 0, 1, 3, 4)
|
104
|
+
checker(@b, :build_release, 2, 1, 1, 11)
|
105
|
+
checker(@c, :build_release, 0, 0, 1, 1)
|
106
|
+
end
|
107
|
+
|
108
|
+
def test_pp
|
109
|
+
assert_equal('0.1.2 (Revision: 3)', @a.pp)
|
110
|
+
assert_equal('2.1.0 (Revision: 10)', @b.pp)
|
111
|
+
assert_equal('0.0.0 (Revision: 0)', @c.pp)
|
112
|
+
end
|
113
|
+
|
114
|
+
end # class VersionTest
|
115
|
+
|
116
|
+
|
117
|
+
end
|
118
|
+
|
119
|
+
|
data/lib/core_ex/yaml.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# Copyright:: Copyright (c) 2005 Nicolas Pouillard. All rights reserved.
|
2
|
+
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
3
|
+
# License:: Gnu General Public License.
|
4
|
+
# Revision:: $Id: yaml.rb 249 2005-05-31 13:23:42Z ertai $
|
5
|
+
|
6
|
+
require 'yaml'
|
7
|
+
|
8
|
+
YAML.add_builtin_type('!re') do |type, val|
|
9
|
+
Regexp.new(val.to_s)
|
10
|
+
end
|
11
|
+
|
12
|
+
YAML.add_builtin_type('!path') do |type, val|
|
13
|
+
Pathname.new(val.to_s)
|
14
|
+
end
|
15
|
+
|
16
|
+
YAML.add_builtin_type('!proc') do |type, val|
|
17
|
+
require 'dumpable_proc'
|
18
|
+
DumpableProc.new(val.to_s)
|
19
|
+
end
|
20
|
+
|
21
|
+
YAML.add_builtin_type('!filelist') do |type, val|
|
22
|
+
require 'rake'
|
23
|
+
FileList.new(val)
|
24
|
+
end
|
data/lib/core_ex.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# Copyright:: Copyright (c) 2005 Nicolas Pouillard. All rights reserved.
|
2
|
+
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
3
|
+
# License:: Gnu General Public License.
|
4
|
+
# Revision:: $Id: core_ex.rb 252 2005-05-31 23:41:42Z ertai $
|
5
|
+
|
6
|
+
require 'pathname'
|
7
|
+
|
8
|
+
module CoreEx
|
9
|
+
@@dir = Pathname.new(__FILE__).dirname.expand_path
|
10
|
+
$: << @@dir.to_s
|
11
|
+
$" << 'core_ex.rb'
|
12
|
+
|
13
|
+
@@core_ex = @@dir + 'core_ex'
|
14
|
+
|
15
|
+
%w[ embedded_tests pathname require ].each do |aPath|
|
16
|
+
require "core_ex/#{aPath}"
|
17
|
+
end
|
18
|
+
RequireSystem.instance
|
19
|
+
%w[ attr_once enumerable exception string fileutils yaml ].each do |aPath|
|
20
|
+
(@@core_ex + aPath).require
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.each ( &block )
|
24
|
+
@@core_list ||= FileList[@@core_ex + '**/*.rb']
|
25
|
+
@@core_list.each(&block)
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.require
|
29
|
+
@@core_list ||= FileList[@@core_ex + '**/*.rb']
|
30
|
+
@@core_list.require
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.dir
|
34
|
+
@@dir
|
35
|
+
end
|
36
|
+
|
37
|
+
end # module CoreEx
|
38
|
+
|
39
|
+
core_ex = CoreEx.dir + 'core_ex'
|
40
|
+
{
|
41
|
+
:Time => 'time',
|
42
|
+
:DTime => 'dtime',
|
43
|
+
:Version => 'version',
|
44
|
+
:FileList => 'filelist',
|
45
|
+
:Test => 'test/unit/ui/yaml/testrunner',
|
46
|
+
:TempPath => 'temp_path'
|
47
|
+
}.each do |k, v|
|
48
|
+
k = [k] unless k.is_a? Enumerable
|
49
|
+
v = [v] unless v.is_a? Enumerable
|
50
|
+
k.each do |aConst|
|
51
|
+
v.each do |aPath|
|
52
|
+
Kernel.autoload(aConst, (core_ex + aPath).to_s)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
|
3
|
+
# Run this suite with -S 'url: scheme://the/url/to/the/ttk/package'
|
4
|
+
CoreEx Package Test Suite:
|
5
|
+
strategy: Suite
|
6
|
+
contents:
|
7
|
+
|
8
|
+
- Checkout:
|
9
|
+
strategy: Checkout
|
10
|
+
url: <<url>>
|
11
|
+
fatal: true
|
12
|
+
|
13
|
+
- Check the package:
|
14
|
+
strategy: Import
|
15
|
+
import: <<checkout_dir>>/test/check-core_ex.yml
|
@@ -0,0 +1 @@
|
|
1
|
+
$REQUIRE_SYSTEM_TEST_COUNTER += 1
|
@@ -0,0 +1 @@
|
|
1
|
+
$REQUIRE_SYSTEM_TEST_COUNTER += 1
|
@@ -0,0 +1 @@
|
|
1
|
+
$REQUIRE_SYSTEM_TEST_COUNTER += 1
|
@@ -0,0 +1,43 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
|
4
|
+
class Good
|
5
|
+
|
6
|
+
|
7
|
+
end
|
8
|
+
|
9
|
+
|
10
|
+
# FIXME bootstrap me
|
11
|
+
if __FILE__ == $0
|
12
|
+
|
13
|
+
require 'test/unit/ui/yaml/testrunner'
|
14
|
+
|
15
|
+
class GoodTest < Test::Unit::TestCase
|
16
|
+
|
17
|
+
def test_1
|
18
|
+
assert(true)
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_2
|
22
|
+
assert(false, 'bad')
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_3
|
26
|
+
assert(true, 'good')
|
27
|
+
assert(true, 'very good')
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_4
|
31
|
+
raise 'error'
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_5
|
35
|
+
assert(true)
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
Test::Unit::UI::Yaml::TestRunner.run(GoodTest)
|
41
|
+
|
42
|
+
end
|
43
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
---
|
2
|
+
|
3
|
+
CoreEx Sanity Multiple Requires Test Suite:
|
4
|
+
|
5
|
+
strategy: Cmd
|
6
|
+
command: ruby
|
7
|
+
exit: 0
|
8
|
+
error: ""
|
9
|
+
output: !re 0 failures, 0 errors$
|
10
|
+
args: -I<<pwd>>/../../lib
|
11
|
+
input: |2
|
12
|
+
require 'core_ex'
|
13
|
+
CoreEx.require
|
14
|
+
class TC_ < Test::Unit::TestCase
|
15
|
+
def test_definitions
|
16
|
+
CoreEx.each do |file|
|
17
|
+
assert(RequireSystem.instance.required?(file), "#{file} not present")
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
|
3
|
+
CoreEx Sanity Single Requires Test Suite:
|
4
|
+
|
5
|
+
strategy: Glob
|
6
|
+
glob: <<pwd>>/../../lib/**/*.rb
|
7
|
+
regexp: !re ^<<pwd>>\/\.\.\/\.\.\/lib\/(.*)\.rb$
|
8
|
+
test:
|
9
|
+
<<match>>:
|
10
|
+
strategy: RUnit
|
11
|
+
strategy: Cmd
|
12
|
+
command: ruby
|
13
|
+
exit: 0
|
14
|
+
error: ""
|
15
|
+
output: !re 0 failures, 0 errors$
|
16
|
+
args: -I<<pwd>>/../../lib
|
17
|
+
input: |
|
18
|
+
require '<<match>>'
|
19
|
+
require 'test/unit'
|
20
|
+
class TC_ < Test::Unit::TestCase
|
21
|
+
def test_definitions
|
22
|
+
assert($".include?('<<match>>.rb')) #"
|
23
|
+
end
|
24
|
+
end
|
data/test/unit-suite.yml
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
---
|
2
|
+
|
3
|
+
CoreEx Unit Test Suite:
|
4
|
+
|
5
|
+
strategy: Glob
|
6
|
+
glob : <<pwd>>/../lib/**/*.rb
|
7
|
+
regexp : !re ([^/]*)\.rb$
|
8
|
+
symbols : { core_ex: <<pwd>>/../lib }
|
9
|
+
|
10
|
+
test:
|
11
|
+
<<match>>:
|
12
|
+
strategy: RUnit
|
13
|
+
unit_file: <<pwd>>/test-unit-setup.rb
|
14
|
+
args: <<path>>
|