cutest 1.2.0.rc1 → 1.2.0.rc2
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/lib/cutest.rb +11 -7
- data/test/run.rb +12 -12
- metadata +2 -2
data/lib/cutest.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
class Cutest
|
2
|
-
VERSION = "1.2.0.
|
2
|
+
VERSION = "1.2.0.rc2"
|
3
3
|
FILTER = %r[/(ruby|jruby|rbx)[-/]([0-9\.])+]
|
4
4
|
CACHE = Hash.new { |h, k| h[k] = File.readlines(k) }
|
5
5
|
|
@@ -25,30 +25,34 @@ class Cutest
|
|
25
25
|
exit 1
|
26
26
|
|
27
27
|
rescue StandardError
|
28
|
-
display_error
|
29
|
-
|
30
28
|
trace = $!.backtrace
|
31
29
|
pivot = trace.index { |line| line.match(file) }
|
32
30
|
|
33
31
|
if pivot
|
34
32
|
other = trace[0..pivot].select { |line| line !~ FILTER }
|
35
|
-
other.reverse.each { |
|
33
|
+
other.reverse.each { |line| display_trace(line) }
|
36
34
|
else
|
37
35
|
display_trace(trace.first)
|
38
36
|
end
|
39
37
|
|
38
|
+
display_error
|
39
|
+
|
40
40
|
exit 1
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
45
|
def self.code(fn, ln)
|
46
|
-
|
46
|
+
begin
|
47
|
+
CACHE[fn][ln.to_i - 1].strip
|
48
|
+
rescue
|
49
|
+
"(Can't display line)"
|
50
|
+
end
|
47
51
|
end
|
48
52
|
|
49
53
|
def self.display_error
|
50
|
-
print "\n
|
51
|
-
print "#{$!.message}\n
|
54
|
+
print "\n#{$!.class}: "
|
55
|
+
print "#{$!.message}\n"
|
52
56
|
end
|
53
57
|
|
54
58
|
def self.display_trace(line)
|
data/test/run.rb
CHANGED
@@ -7,9 +7,9 @@ test "output of successful run" do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
test "output of failed run" do
|
10
|
-
expected = "
|
11
|
-
"
|
12
|
-
"
|
10
|
+
expected = " line: assert false\n" +
|
11
|
+
" file: test/fixtures/failure.rb +2\n\n" +
|
12
|
+
"Cutest::AssertionFailed: expression returned false\n\n"
|
13
13
|
|
14
14
|
out = %x{./bin/cutest test/fixtures/failure.rb}
|
15
15
|
|
@@ -17,9 +17,9 @@ test "output of failed run" do
|
|
17
17
|
end
|
18
18
|
|
19
19
|
test "output of failed run" do
|
20
|
-
expected = "
|
21
|
-
"
|
22
|
-
"
|
20
|
+
expected = " line: raise \"Oops\"\n" +
|
21
|
+
" file: test/fixtures/exception.rb +2\n\n" +
|
22
|
+
"RuntimeError: Oops\n\n"
|
23
23
|
|
24
24
|
out = %x{./bin/cutest test/fixtures/exception.rb}
|
25
25
|
|
@@ -27,9 +27,9 @@ test "output of failed run" do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
test "output of custom assertion" do
|
30
|
-
expected = "
|
31
|
-
"
|
32
|
-
"
|
30
|
+
expected = " line: assert_empty \"foo\"\n" +
|
31
|
+
" file: test/fixtures/fail_custom_assertion.rb +7\n\n" +
|
32
|
+
"Cutest::AssertionFailed: not empty\n\n"
|
33
33
|
|
34
34
|
out = %x{./bin/cutest test/fixtures/fail_custom_assertion.rb}
|
35
35
|
|
@@ -37,9 +37,9 @@ test "output of custom assertion" do
|
|
37
37
|
end
|
38
38
|
|
39
39
|
test "output of failure in nested file" do
|
40
|
-
expected = "
|
41
|
-
"
|
42
|
-
"
|
40
|
+
expected = " line: assert false\n" +
|
41
|
+
" file: test/fixtures/failure.rb +2\n\n" +
|
42
|
+
"Cutest::AssertionFailed: expression returned false\n\n"
|
43
43
|
|
44
44
|
out = %x{./bin/cutest test/fixtures/failure_in_loaded_file.rb}
|
45
45
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cutest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.0.
|
4
|
+
version: 1.2.0.rc2
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-08-16 00:00:00.000000000 Z
|
14
14
|
dependencies: []
|
15
15
|
description: Run tests in separate processes to avoid shared state.
|
16
16
|
email:
|