cutest 1.0.0.beta1 → 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/cutest.gemspec +1 -1
- data/lib/cutest.rb +11 -6
- data/test/run.rb +31 -1
- metadata +6 -9
data/cutest.gemspec
CHANGED
data/lib/cutest.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
class Cutest
|
2
|
-
VERSION = "1.0.0
|
2
|
+
VERSION = "1.0.0"
|
3
3
|
|
4
4
|
if ENV["DEBUG"]
|
5
5
|
begin
|
@@ -140,13 +140,13 @@ private
|
|
140
140
|
# Assert that value is not nil or false.
|
141
141
|
def assert(value)
|
142
142
|
flunk("assertion failed") unless value
|
143
|
-
|
143
|
+
success
|
144
144
|
end
|
145
145
|
|
146
146
|
# Assert that two values are equal.
|
147
147
|
def assert_equal(value, other)
|
148
|
-
flunk("#{value} != #{other}") unless value == other
|
149
|
-
|
148
|
+
flunk("#{value.inspect} != #{other.inspect}") unless value == other
|
149
|
+
success
|
150
150
|
end
|
151
151
|
|
152
152
|
# Assert that the block doesn't raise the expected exception.
|
@@ -155,8 +155,8 @@ private
|
|
155
155
|
yield
|
156
156
|
rescue => exception
|
157
157
|
ensure
|
158
|
-
flunk("got #{exception} instead") unless exception.kind_of?(expected)
|
159
|
-
|
158
|
+
flunk("got #{exception.inspect} instead") unless exception.kind_of?(expected)
|
159
|
+
success
|
160
160
|
end
|
161
161
|
end
|
162
162
|
|
@@ -168,4 +168,9 @@ private
|
|
168
168
|
|
169
169
|
raise exception
|
170
170
|
end
|
171
|
+
|
172
|
+
# Executed when an assertion succeeds.
|
173
|
+
def success
|
174
|
+
print "."
|
175
|
+
end
|
171
176
|
end
|
data/test/run.rb
CHANGED
@@ -17,5 +17,35 @@ test "output of successful run" do
|
|
17
17
|
Cutest.run(Dir["test/fixtures/success.rb"])
|
18
18
|
end
|
19
19
|
|
20
|
-
|
20
|
+
assert_equal(stdout, expected)
|
21
|
+
end
|
22
|
+
|
23
|
+
test "output of failed run" do
|
24
|
+
expected = "\n\e[01;36mException: \e[01;33massert false\e[00m # assertion failed\ntest/fixtures/failure.rb +2\n\n"
|
25
|
+
|
26
|
+
stdout, stderr = capture do
|
27
|
+
Cutest.run(Dir["test/fixtures/failure.rb"])
|
28
|
+
end
|
29
|
+
|
30
|
+
assert_equal(stdout, expected)
|
31
|
+
end
|
32
|
+
|
33
|
+
test "output of failed run" do
|
34
|
+
expected = "\n\e[01;36mException: \e[01;33mraise \"Oops\"\e[00m # Oops\ntest/fixtures/exception.rb +2\n\n"
|
35
|
+
|
36
|
+
stdout, stderr = capture do
|
37
|
+
Cutest.run(Dir["test/fixtures/exception.rb"])
|
38
|
+
end
|
39
|
+
|
40
|
+
assert_equal(stdout, expected)
|
41
|
+
end
|
42
|
+
|
43
|
+
test "output of custom assertion" do
|
44
|
+
expected = "\n\e[01;36mException: \e[01;33massert_empty \"foo\"\e[00m # not empty\ntest/fixtures/fail_custom_assertion.rb +7\n\n"
|
45
|
+
|
46
|
+
stdout, stderr = capture do
|
47
|
+
Cutest.run(Dir["test/fixtures/fail_custom_assertion.rb"])
|
48
|
+
end
|
49
|
+
|
50
|
+
assert_equal(stdout, expected)
|
21
51
|
end
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cutest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
4
|
+
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
|
10
|
-
version: 1.0.0.beta1
|
9
|
+
version: 1.0.0
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Damian Janowski
|
@@ -16,7 +15,7 @@ autorequire:
|
|
16
15
|
bindir: bin
|
17
16
|
cert_chain: []
|
18
17
|
|
19
|
-
date: 2010-
|
18
|
+
date: 2010-11-11 00:00:00 -03:00
|
20
19
|
default_executable:
|
21
20
|
dependencies: []
|
22
21
|
|
@@ -64,13 +63,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
64
63
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
64
|
none: false
|
66
65
|
requirements:
|
67
|
-
- - "
|
66
|
+
- - ">="
|
68
67
|
- !ruby/object:Gem::Version
|
69
68
|
segments:
|
70
|
-
-
|
71
|
-
|
72
|
-
- 1
|
73
|
-
version: 1.3.1
|
69
|
+
- 0
|
70
|
+
version: "0"
|
74
71
|
requirements: []
|
75
72
|
|
76
73
|
rubyforge_project:
|