dokaz 0.0.2 → 0.0.3
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 +8 -8
- data/dokaz.gemspec +1 -1
- data/lib/dokaz/formatters.rb +26 -11
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OTE0MmZmNzRmMjlkOGE1ZTFmNjRiYjUwYmU5ZDlhNzQzZGE2Mjc4Yg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NTkxNjdlMDk0Mjk5NDZiYmU0ODBlMDE2YjUzYTJjMzliM2YyN2UyZg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MjI2NDRlZTJkYjlkNWQxYzA0N2UwYWZiZjA0YWYxNzgwZmFkNDJlMWVlNzA2
|
10
|
+
YWEyNDk0OTZkOGVmYjg5ZDcwNWIxYTc5OGM2ODMzNzRmNTljZTY3Y2VkOGM1
|
11
|
+
ZmEzZWM5Zjg1NjQ2ZmU2MWZhZTQwYWZjMjE1MDFiNmYzOGY5OGU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Y2JmMGY4ODljN2QxZjE0ODA4ZDYwN2Y4Mjg0MmM1M2EwYWNkYjM1YTBjYzIw
|
14
|
+
YTU2MTYwMjllOTc1NzgyMzUyODQxZmIyN2Y1NWQyMWNlM2E3ZWFmZmFlNThk
|
15
|
+
OTcyMjVjMjE5ZmI3ZWUwYTZhZGM5MjE4MTEwYTM0MTA0OGU1ZGY=
|
data/dokaz.gemspec
CHANGED
data/lib/dokaz/formatters.rb
CHANGED
@@ -22,6 +22,26 @@ class Dokaz
|
|
22
22
|
def filter_backtrace(trace)
|
23
23
|
trace.take_while{|ln| ln !~ /lib\/dokaz/}
|
24
24
|
end
|
25
|
+
|
26
|
+
def ok(str)
|
27
|
+
color(:green, str)
|
28
|
+
end
|
29
|
+
|
30
|
+
def error(str)
|
31
|
+
color(:red, str)
|
32
|
+
end
|
33
|
+
|
34
|
+
def comment(str)
|
35
|
+
color(:dark, str)
|
36
|
+
end
|
37
|
+
|
38
|
+
def color(code, str)
|
39
|
+
if STDOUT.tty?
|
40
|
+
ANSI.send(code){str}
|
41
|
+
else
|
42
|
+
str
|
43
|
+
end
|
44
|
+
end
|
25
45
|
end
|
26
46
|
|
27
47
|
class SpecFormatter < Formatter
|
@@ -37,7 +57,7 @@ class Dokaz
|
|
37
57
|
def finish_block(block)
|
38
58
|
unless @err
|
39
59
|
@ok += 1
|
40
|
-
print
|
60
|
+
print ok('.')
|
41
61
|
end
|
42
62
|
end
|
43
63
|
|
@@ -47,27 +67,27 @@ class Dokaz
|
|
47
67
|
|
48
68
|
@errors.each do |code, e|
|
49
69
|
puts code
|
50
|
-
puts(
|
70
|
+
puts( error("#{e.message} (#{e.class})\n " + filter_backtrace(e.backtrace).join("\n ") + "\n"))
|
51
71
|
end
|
52
72
|
|
53
73
|
puts
|
54
74
|
@errors.each do |code, e|
|
55
75
|
ln = e.backtrace.first.sub(/:in .*$/, '')
|
56
|
-
puts
|
76
|
+
puts error("dokaz #{ln}") + comment(" # #{e.message} (#{e.class})")
|
57
77
|
end
|
58
78
|
|
59
79
|
puts
|
60
80
|
puts [
|
61
81
|
"#{@ok + @errors.count} total",
|
62
|
-
!@ok.zero? &&
|
63
|
-
!@errors.empty? &&
|
82
|
+
!@ok.zero? && ok("#{@ok} ok"),
|
83
|
+
!@errors.empty? && error("#{@errors.count} errors")
|
64
84
|
].select{|l| l}.join(', ')
|
65
85
|
|
66
86
|
end
|
67
87
|
|
68
88
|
def output_err(code, e)
|
69
89
|
@errors << [code, e]
|
70
|
-
print
|
90
|
+
print error('F')
|
71
91
|
@err = true
|
72
92
|
end
|
73
93
|
end
|
@@ -93,10 +113,5 @@ class Dokaz
|
|
93
113
|
def finish_block(block)
|
94
114
|
puts "\n\n"
|
95
115
|
end
|
96
|
-
|
97
|
-
private
|
98
|
-
def comment(str)
|
99
|
-
ANSI.dark{str}
|
100
|
-
end
|
101
116
|
end
|
102
117
|
end
|