test-unit-power_assert 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/README.rdoc +10 -8
- data/lib/test/unit/power_assert.rb +15 -15
- data/lib/test/unit/power_assert/version.rb +1 -1
- data/test/test_power_assert.rb +12 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8e16b7c9e80dfc75395dea5f7458eea9686b888
|
4
|
+
data.tar.gz: efe8b62dbc50c8c6ccb53253044bc07b20990a1f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3490cc805cfcfb4cdf700e3fec724d3d6601ce05fd37ad9ec5c58f5832ba8992137396d4665fb3f70de6b224c89eb98cf2bbf9b204b577fb3f0b32650cda3a86
|
7
|
+
data.tar.gz: 63bc36c8c5299f2b19468d6d623abadcfc3f6cae446d1f493a96127db8475b582ec6a0afc13c4a401a7f6310d82d87d0a48e1c328d7194b51e57ad7c53934959
|
data/.travis.yml
CHANGED
data/README.rdoc
CHANGED
@@ -20,7 +20,7 @@ or
|
|
20
20
|
require 'test/unit/power_assert'
|
21
21
|
class MyTest < Test::Unit::TestCase
|
22
22
|
def test_failed
|
23
|
-
|
23
|
+
assert do
|
24
24
|
"0".class == "3".to_i.times.map {|i| i + 1 }.class
|
25
25
|
end
|
26
26
|
end
|
@@ -31,13 +31,15 @@ Note: It is recommended to require test/unit/power_assert before _loading_ test
|
|
31
31
|
=== Result
|
32
32
|
Failure:
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
34
|
+
Failure:
|
35
|
+
"0".class == "3".to_i.times.map {|i| i + 1 }.class
|
36
|
+
| | | | | |
|
37
|
+
| | | | | Array
|
38
|
+
| | | | [1, 2, 3]
|
39
|
+
| | | #<Enumerator: 3:times>
|
40
|
+
| | 3
|
41
|
+
| false
|
42
|
+
String
|
41
43
|
test_failed(MyTest)
|
42
44
|
|
43
45
|
== Travis Build Status {<img src="https://secure.travis-ci.org/k-tsj/test-unit-power_assert.png"/>}[http://travis-ci.org/k-tsj/test-unit-power_assert]
|
@@ -7,24 +7,24 @@ require 'test/unit/power_assert/version'
|
|
7
7
|
require 'test/unit'
|
8
8
|
require 'power_assert'
|
9
9
|
|
10
|
-
module Test::Unit
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
10
|
+
module Test::Unit::Assertions
|
11
|
+
alias __assert_orig__ assert
|
12
|
+
|
13
|
+
def assert(boolean = nil, message = nil, &blk)
|
14
|
+
if blk
|
15
|
+
::PowerAssert.start(blk, assertion_method: __callee__) do |pa|
|
16
|
+
prc = pa.message_proc
|
17
|
+
class << prc
|
18
|
+
alias to_s call
|
19
|
+
end
|
20
|
+
assert_block(prc) do
|
21
|
+
pa.yield
|
22
22
|
end
|
23
23
|
end
|
24
|
+
else
|
25
|
+
__assert_orig__(boolean, message)
|
24
26
|
end
|
25
27
|
end
|
26
28
|
|
27
|
-
|
28
|
-
include PowerAssert::Assertions
|
29
|
-
end
|
29
|
+
alias power_assert assert
|
30
30
|
end
|
data/test/test_power_assert.rb
CHANGED
@@ -3,12 +3,23 @@ require 'test/unit/power_assert'
|
|
3
3
|
|
4
4
|
class TestPowerAssert < Test::Unit::TestCase
|
5
5
|
def test_successful
|
6
|
+
assert do
|
7
|
+
true
|
8
|
+
end
|
9
|
+
assert(true)
|
6
10
|
power_assert do
|
7
11
|
true
|
8
12
|
end
|
9
13
|
end
|
10
14
|
|
11
|
-
def
|
15
|
+
def test_assert_failed
|
16
|
+
return unless ENV['DEMO']
|
17
|
+
assert do
|
18
|
+
"0".class == "3".to_i.times.map {|i| i + 1 }.class
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_power_assert_failed
|
12
23
|
return unless ENV['DEMO']
|
13
24
|
power_assert do
|
14
25
|
"0".class == "3".to_i.times.map {|i| i + 1 }.class
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test-unit-power_assert
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kazuki Tsujimoto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-unit
|