rubyunit 0.1.7 → 0.1.8
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.
- checksums.yaml +4 -4
- data/LICENSE +165 -0
- data/README.md +1 -2
- data/lib/RubyUnit/Runner.rb +2 -0
- data/lib/RubyUnit/TestCase.rb +58 -8
- data/lib/RubyUnit.rb +8 -27
- data/tests/TEST_GemInfo.rb +27 -0
- data/tests/TEST_RubyUnit.rb +15 -0
- data/tests/TEST_TestCase.rb +7 -0
- data/tests/TestSuite.rb +19 -0
- data/tests/data/GemInfo.rb +8 -0
- data/tests/data/TestCase.rb +3 -0
- metadata +10 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16efc526e3776368644128d5ebbe643d3361e75e
|
4
|
+
data.tar.gz: 762ffcba3e891ef4583203a63cded3dc1a8ee15c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0fc1890230763a45108c339026baa02ca3ff3fd1fde390f5c83ae77590470d58829d97f423e95e55ee7aa111e375c08a18ac912ce6a33bb64801e5513429bc9
|
7
|
+
data.tar.gz: a2ebc354cf1549388ac0be77499bb47fd97098bb68ac14036b96711938d104bc879c3a581a2659a61b3f4f2bd66f94f2f2049ca1cc19d928a97527ba0636bb41
|
data/LICENSE
ADDED
@@ -0,0 +1,165 @@
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
2
|
+
Version 3, 29 June 2007
|
3
|
+
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
6
|
+
of this license document, but changing it is not allowed.
|
7
|
+
|
8
|
+
|
9
|
+
This version of the GNU Lesser General Public License incorporates
|
10
|
+
the terms and conditions of version 3 of the GNU General Public
|
11
|
+
License, supplemented by the additional permissions listed below.
|
12
|
+
|
13
|
+
0. Additional Definitions.
|
14
|
+
|
15
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
16
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
17
|
+
General Public License.
|
18
|
+
|
19
|
+
"The Library" refers to a covered work governed by this License,
|
20
|
+
other than an Application or a Combined Work as defined below.
|
21
|
+
|
22
|
+
An "Application" is any work that makes use of an interface provided
|
23
|
+
by the Library, but which is not otherwise based on the Library.
|
24
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
25
|
+
of using an interface provided by the Library.
|
26
|
+
|
27
|
+
A "Combined Work" is a work produced by combining or linking an
|
28
|
+
Application with the Library. The particular version of the Library
|
29
|
+
with which the Combined Work was made is also called the "Linked
|
30
|
+
Version".
|
31
|
+
|
32
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
33
|
+
Corresponding Source for the Combined Work, excluding any source code
|
34
|
+
for portions of the Combined Work that, considered in isolation, are
|
35
|
+
based on the Application, and not on the Linked Version.
|
36
|
+
|
37
|
+
The "Corresponding Application Code" for a Combined Work means the
|
38
|
+
object code and/or source code for the Application, including any data
|
39
|
+
and utility programs needed for reproducing the Combined Work from the
|
40
|
+
Application, but excluding the System Libraries of the Combined Work.
|
41
|
+
|
42
|
+
1. Exception to Section 3 of the GNU GPL.
|
43
|
+
|
44
|
+
You may convey a covered work under sections 3 and 4 of this License
|
45
|
+
without being bound by section 3 of the GNU GPL.
|
46
|
+
|
47
|
+
2. Conveying Modified Versions.
|
48
|
+
|
49
|
+
If you modify a copy of the Library, and, in your modifications, a
|
50
|
+
facility refers to a function or data to be supplied by an Application
|
51
|
+
that uses the facility (other than as an argument passed when the
|
52
|
+
facility is invoked), then you may convey a copy of the modified
|
53
|
+
version:
|
54
|
+
|
55
|
+
a) under this License, provided that you make a good faith effort to
|
56
|
+
ensure that, in the event an Application does not supply the
|
57
|
+
function or data, the facility still operates, and performs
|
58
|
+
whatever part of its purpose remains meaningful, or
|
59
|
+
|
60
|
+
b) under the GNU GPL, with none of the additional permissions of
|
61
|
+
this License applicable to that copy.
|
62
|
+
|
63
|
+
3. Object Code Incorporating Material from Library Header Files.
|
64
|
+
|
65
|
+
The object code form of an Application may incorporate material from
|
66
|
+
a header file that is part of the Library. You may convey such object
|
67
|
+
code under terms of your choice, provided that, if the incorporated
|
68
|
+
material is not limited to numerical parameters, data structure
|
69
|
+
layouts and accessors, or small macros, inline functions and templates
|
70
|
+
(ten or fewer lines in length), you do both of the following:
|
71
|
+
|
72
|
+
a) Give prominent notice with each copy of the object code that the
|
73
|
+
Library is used in it and that the Library and its use are
|
74
|
+
covered by this License.
|
75
|
+
|
76
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
77
|
+
document.
|
78
|
+
|
79
|
+
4. Combined Works.
|
80
|
+
|
81
|
+
You may convey a Combined Work under terms of your choice that,
|
82
|
+
taken together, effectively do not restrict modification of the
|
83
|
+
portions of the Library contained in the Combined Work and reverse
|
84
|
+
engineering for debugging such modifications, if you also do each of
|
85
|
+
the following:
|
86
|
+
|
87
|
+
a) Give prominent notice with each copy of the Combined Work that
|
88
|
+
the Library is used in it and that the Library and its use are
|
89
|
+
covered by this License.
|
90
|
+
|
91
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
92
|
+
document.
|
93
|
+
|
94
|
+
c) For a Combined Work that displays copyright notices during
|
95
|
+
execution, include the copyright notice for the Library among
|
96
|
+
these notices, as well as a reference directing the user to the
|
97
|
+
copies of the GNU GPL and this license document.
|
98
|
+
|
99
|
+
d) Do one of the following:
|
100
|
+
|
101
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
102
|
+
License, and the Corresponding Application Code in a form
|
103
|
+
suitable for, and under terms that permit, the user to
|
104
|
+
recombine or relink the Application with a modified version of
|
105
|
+
the Linked Version to produce a modified Combined Work, in the
|
106
|
+
manner specified by section 6 of the GNU GPL for conveying
|
107
|
+
Corresponding Source.
|
108
|
+
|
109
|
+
1) Use a suitable shared library mechanism for linking with the
|
110
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
111
|
+
a copy of the Library already present on the user's computer
|
112
|
+
system, and (b) will operate properly with a modified version
|
113
|
+
of the Library that is interface-compatible with the Linked
|
114
|
+
Version.
|
115
|
+
|
116
|
+
e) Provide Installation Information, but only if you would otherwise
|
117
|
+
be required to provide such information under section 6 of the
|
118
|
+
GNU GPL, and only to the extent that such information is
|
119
|
+
necessary to install and execute a modified version of the
|
120
|
+
Combined Work produced by recombining or relinking the
|
121
|
+
Application with a modified version of the Linked Version. (If
|
122
|
+
you use option 4d0, the Installation Information must accompany
|
123
|
+
the Minimal Corresponding Source and Corresponding Application
|
124
|
+
Code. If you use option 4d1, you must provide the Installation
|
125
|
+
Information in the manner specified by section 6 of the GNU GPL
|
126
|
+
for conveying Corresponding Source.)
|
127
|
+
|
128
|
+
5. Combined Libraries.
|
129
|
+
|
130
|
+
You may place library facilities that are a work based on the
|
131
|
+
Library side by side in a single library together with other library
|
132
|
+
facilities that are not Applications and are not covered by this
|
133
|
+
License, and convey such a combined library under terms of your
|
134
|
+
choice, if you do both of the following:
|
135
|
+
|
136
|
+
a) Accompany the combined library with a copy of the same work based
|
137
|
+
on the Library, uncombined with any other library facilities,
|
138
|
+
conveyed under the terms of this License.
|
139
|
+
|
140
|
+
b) Give prominent notice with the combined library that part of it
|
141
|
+
is a work based on the Library, and explaining where to find the
|
142
|
+
accompanying uncombined form of the same work.
|
143
|
+
|
144
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
145
|
+
|
146
|
+
The Free Software Foundation may publish revised and/or new versions
|
147
|
+
of the GNU Lesser General Public License from time to time. Such new
|
148
|
+
versions will be similar in spirit to the present version, but may
|
149
|
+
differ in detail to address new problems or concerns.
|
150
|
+
|
151
|
+
Each version is given a distinguishing version number. If the
|
152
|
+
Library as you received it specifies that a certain numbered version
|
153
|
+
of the GNU Lesser General Public License "or any later version"
|
154
|
+
applies to it, you have the option of following the terms and
|
155
|
+
conditions either of that published version or of any later version
|
156
|
+
published by the Free Software Foundation. If the Library as you
|
157
|
+
received it does not specify a version number of the GNU Lesser
|
158
|
+
General Public License, you may choose any version of the GNU Lesser
|
159
|
+
General Public License ever published by the Free Software Foundation.
|
160
|
+
|
161
|
+
If the Library as you received it specifies that a proxy can decide
|
162
|
+
whether future versions of the GNU Lesser General Public License shall
|
163
|
+
apply, that proxy's public statement of acceptance of any version is
|
164
|
+
permanent authorization for you to choose that version for the
|
165
|
+
Library.
|
data/README.md
CHANGED
@@ -8,11 +8,10 @@ RubyUnit
|
|
8
8
|
### Practical Examples
|
9
9
|
* https://github.com/matthewclower/PlayingCards
|
10
10
|
|
11
|
-
|
12
11
|
### Links
|
13
12
|
* http://rubyunit.github.io/
|
14
13
|
* https://github.com/RubyUnit/RubyUnit
|
15
|
-
|
14
|
+
* https://github.com/matthewclower/RubyUnit/wiki
|
16
15
|
|
17
16
|
### Description
|
18
17
|
|
data/lib/RubyUnit/Runner.rb
CHANGED
data/lib/RubyUnit/TestCase.rb
CHANGED
@@ -217,13 +217,13 @@ module RubyUnit
|
|
217
217
|
# end
|
218
218
|
#
|
219
219
|
def assertRaiseExpected *args, &block
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
raise ArguemntError, "message must be a String or nil" unless message.is_a? String or message.nil?
|
220
|
+
raise ArgumentError, "wrong number of arguments (#{args.count} for 2..3)" unless args.count > 0
|
221
|
+
expected, pattern, message = args
|
222
|
+
raise ArgumentError, "expected exception must be a subclass of Exception" unless expected < Exception
|
223
|
+
raise ArgumentError, "exception message must be a Regexp or String" unless pattern.is_a? Regexp or pattern.is_a? String or pattern.nil?
|
224
|
+
raise ArguemntError, "message must be a String or nil" unless message.is_a? String or message.nil?
|
226
225
|
|
226
|
+
__assertion do
|
227
227
|
begin
|
228
228
|
yield
|
229
229
|
raise AssertionFailure, message
|
@@ -358,6 +358,7 @@ module RubyUnit
|
|
358
358
|
# Assert that a constant is defined correctly in the correct class
|
359
359
|
# * raises RubyUnit::AssertionFailure unless the constant is defined in
|
360
360
|
# the specified class and it is the correct type and value
|
361
|
+
# * raises ArgumentError if _konstant_ is not a string
|
361
362
|
#
|
362
363
|
# expected::
|
363
364
|
# The value that is expected for the constant
|
@@ -366,8 +367,7 @@ module RubyUnit
|
|
366
367
|
# The class where the constant should be defined
|
367
368
|
#
|
368
369
|
# konstant::
|
369
|
-
# The name of the constant
|
370
|
-
# validated in the class
|
370
|
+
# The name of the constant
|
371
371
|
#
|
372
372
|
# message::
|
373
373
|
# The message provided to be reported for a failure
|
@@ -375,13 +375,63 @@ module RubyUnit
|
|
375
375
|
# assertConst 42, Numbers, 'TWENTYFOUR', 'So dyslexic.' # => fail
|
376
376
|
#
|
377
377
|
def assertConst expected, klass, konstant, message = nil
|
378
|
+
raise ArgumentError, 'Constant name must be given as a String' unless konstant.is_a? String
|
378
379
|
__assertion do
|
380
|
+
assertConstDefined klass, konstant, message
|
379
381
|
value = klass.const_get konstant
|
380
382
|
assertIsA expected.class, value, message
|
381
383
|
assertEqual expected, value, message
|
382
384
|
end
|
383
385
|
end
|
384
386
|
|
387
|
+
#
|
388
|
+
# Assert that a constant is defined in the specified class
|
389
|
+
# * raises RubyUnit::AssertionFailure unless the constant is defined in
|
390
|
+
# the specified class
|
391
|
+
# * raises ArgumentError if _konstant_ is not a string
|
392
|
+
#
|
393
|
+
# klass::
|
394
|
+
# The class where the constant should be defined
|
395
|
+
#
|
396
|
+
# konstant::
|
397
|
+
# The name of the constant
|
398
|
+
#
|
399
|
+
# message::
|
400
|
+
# The message provided to be reported for a failure
|
401
|
+
#
|
402
|
+
# assertConstDefined Numbers, 'FORTYTWO', 'Mystery.' # => ??
|
403
|
+
#
|
404
|
+
def assertConstDefined klass, konstant, message = nil
|
405
|
+
raise ArgumentError, 'Constant name must be given as a String' unless konstant.is_a? String
|
406
|
+
__assertion do
|
407
|
+
raise AssertionFailure, message unless klass.const_defined? konstant
|
408
|
+
end
|
409
|
+
end
|
410
|
+
|
411
|
+
#
|
412
|
+
# Assert that a constant is not defined in the specified class
|
413
|
+
# * raises RubyUnit::AssertionFailure if the constant is defined in
|
414
|
+
# the specified class
|
415
|
+
# * raises ArgumentError if _konstant_ is not a string
|
416
|
+
#
|
417
|
+
# klass::
|
418
|
+
# The class where the constant should not be defined
|
419
|
+
#
|
420
|
+
# konstant::
|
421
|
+
# The name of the constant
|
422
|
+
#
|
423
|
+
# message::
|
424
|
+
# The message provided to be reported for a failure
|
425
|
+
#
|
426
|
+
# assertConstNotDefined Numbers, 'TWENTYFOUR', 'Mystery.' # => ??
|
427
|
+
#
|
428
|
+
def assertConstNotDefined klass, konstant, message = nil
|
429
|
+
raise ArgumentError, 'Constant name must be given as a String' unless konstant.is_a? String
|
430
|
+
__assertion do
|
431
|
+
raise AssertionFailure, message if klass.const_defined? konstant
|
432
|
+
end
|
433
|
+
end
|
434
|
+
|
385
435
|
class << self
|
386
436
|
private
|
387
437
|
# Tracks the total number of assertions made during the tests
|
data/lib/RubyUnit.rb
CHANGED
@@ -6,40 +6,21 @@
|
|
6
6
|
#
|
7
7
|
module RubyUnit
|
8
8
|
# Current RubyUnit version
|
9
|
-
VERSION = '0.1.
|
9
|
+
VERSION = '0.1.8'
|
10
10
|
|
11
11
|
#
|
12
12
|
# RubyUnit::GemInfo contains data and functionality needed by the gem builder
|
13
13
|
# when building and distributing the RubyUnit gem.
|
14
14
|
#
|
15
15
|
module GemInfo
|
16
|
+
FILES = ['README.md', 'LICENSE'] + # base files at root level
|
17
|
+
Dir['lib/**/*.rb'] + # library files
|
18
|
+
Dir['example/*.rb'] + # example files
|
19
|
+
Dir['tests/**/*.rb'] # TESTS
|
16
20
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
# spec.files = RubyUnit::GemInfo.files
|
21
|
-
#
|
22
|
-
def self.files
|
23
|
-
# local one-off directory
|
24
|
-
static = ['README.md']
|
25
|
-
# libraries
|
26
|
-
libs = Dir['lib/**/*.rb']
|
27
|
-
# examples
|
28
|
-
examples = Dir['example/*.rb']
|
29
|
-
|
30
|
-
static + libs + examples
|
31
|
-
end
|
32
|
-
|
33
|
-
#
|
34
|
-
# Provides a longer description of the RubyUnit gem
|
35
|
-
#
|
36
|
-
# spec.description = RubyUnit::GemInfo.description
|
37
|
-
#
|
38
|
-
def self.description
|
39
|
-
'Unit testing and test-driven development is a crucial part of the software ' +
|
40
|
-
'development life cycle. This tool is intended to make development and ' +
|
41
|
-
'testing in Ruby easier on everyone.'
|
42
|
-
end
|
21
|
+
DESCRIPTION = 'Unit testing and test-driven development are crucial parts of' +
|
22
|
+
'the software development life cycle. This tool is intended to' +
|
23
|
+
'make development and testing in Ruby easier on everyone.'
|
43
24
|
end
|
44
25
|
end
|
45
26
|
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'RubyUnit'
|
2
|
+
require_relative 'data/GemInfo'
|
3
|
+
|
4
|
+
module RubyUnit
|
5
|
+
#
|
6
|
+
# Test for the GemInfo module
|
7
|
+
#
|
8
|
+
module GemInfo
|
9
|
+
class TEST_GemInfo < TestCase
|
10
|
+
include GemInfoData
|
11
|
+
|
12
|
+
#
|
13
|
+
# Verify that the list of required constants is defined
|
14
|
+
#
|
15
|
+
def constantsDefinedTest konstant
|
16
|
+
assertConstDefined RubyUnit::GemInfo, konstant, "missing constant in GemInfo: #{konstant}!"
|
17
|
+
end
|
18
|
+
|
19
|
+
#
|
20
|
+
# Verify that the list of files contains the LICENSE file
|
21
|
+
#
|
22
|
+
def validateFilesIncludesLicenseTest
|
23
|
+
assert (RubyUnit::GemInfo::FILES.include? 'LICENSE'), 'Gem MUST be distributed with the license!'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'RubyUnit'
|
2
|
+
|
3
|
+
module RubyUnit
|
4
|
+
#
|
5
|
+
# Test for the RubyUnit module
|
6
|
+
#
|
7
|
+
class TEST_RubyUnit < TestCase
|
8
|
+
#
|
9
|
+
# Verify that the VERSION constant is defined in the RubyUnit module
|
10
|
+
#
|
11
|
+
def versionDefinedTest
|
12
|
+
assertConstDefined RubyUnit, 'VERSION', 'Version must be defined in RubyUnit::VERSION!'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/tests/TestSuite.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# IMPORTANT
|
4
|
+
# require relative RubyUnit framework for local so that the tests are run on the build
|
5
|
+
# in this repository
|
6
|
+
$LOAD_PATH.unshift("#{File.dirname(__FILE__)}/../lib") if not ARGV.include? '--gem'
|
7
|
+
|
8
|
+
require 'RubyUnit'
|
9
|
+
|
10
|
+
# Test Cases
|
11
|
+
|
12
|
+
# Ruby module => lib/RubyUnit.rb
|
13
|
+
require_relative 'TEST_RubyUnit'
|
14
|
+
|
15
|
+
# GemInfo module => lib/RubyUnit.rb
|
16
|
+
require_relative 'TEST_GemInfo'
|
17
|
+
|
18
|
+
# TestCase class => lib/RubyUnit/TestCase.rb
|
19
|
+
require_relative 'TEST_TestCase'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubyunit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Clower
|
@@ -10,8 +10,8 @@ bindir: bin
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2014-10-13 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description: Unit testing and test-driven development
|
14
|
-
development life cycle. This tool is intended
|
13
|
+
description: Unit testing and test-driven development are crucial parts ofthe software
|
14
|
+
development life cycle. This tool is intended tomake development and testing in
|
15
15
|
Ruby easier on everyone.
|
16
16
|
email:
|
17
17
|
- matthewclower@gmail.com
|
@@ -20,6 +20,7 @@ extensions: []
|
|
20
20
|
extra_rdoc_files:
|
21
21
|
- README.md
|
22
22
|
files:
|
23
|
+
- LICENSE
|
23
24
|
- README.md
|
24
25
|
- example/RealNumber.rb
|
25
26
|
- example/RealNumberData.rb
|
@@ -29,6 +30,12 @@ files:
|
|
29
30
|
- lib/RubyUnit/AssertionFailure.rb
|
30
31
|
- lib/RubyUnit/Runner.rb
|
31
32
|
- lib/RubyUnit/TestCase.rb
|
33
|
+
- tests/TEST_GemInfo.rb
|
34
|
+
- tests/TEST_RubyUnit.rb
|
35
|
+
- tests/TEST_TestCase.rb
|
36
|
+
- tests/TestSuite.rb
|
37
|
+
- tests/data/GemInfo.rb
|
38
|
+
- tests/data/TestCase.rb
|
32
39
|
homepage: http://github.com/RubyUnit/RubyUnit
|
33
40
|
licenses:
|
34
41
|
- Ruby
|