test_bench-bootstrap 3.0.0 → 4.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.
- checksums.yaml +4 -4
- data/lib/test_bench/bootstrap.rb +3 -86
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dc965093b2dc0c70333aafb0c18143768a68ab13217930d7860a5e613920622d
|
|
4
|
+
data.tar.gz: d949906c02222df28b64b59cfc2e66e77104c673084ab65b0041ecf37772e524
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ce599074b28ff8ec821a3e7b1e2cf613c487730bb030975bb0e1bd6ccea4328fd70a65adc7cef80b81366254479d8368e196926035fee0f8434a85eaad0868d7
|
|
7
|
+
data.tar.gz: c20d7770dddc587baa8dd5608aa4469cd69a8512c61586f95d9dbea49c6817cb9347221f0e81a0c9bbd91a81e6fcde04a1132dbd12291e9969fcea21c830a01d
|
data/lib/test_bench/bootstrap.rb
CHANGED
|
@@ -4,22 +4,6 @@ module TestBench
|
|
|
4
4
|
Object.include(Fixture)
|
|
5
5
|
end
|
|
6
6
|
|
|
7
|
-
if RUBY_ENGINE != 'mruby'
|
|
8
|
-
class Abort < SystemExit
|
|
9
|
-
def self.build
|
|
10
|
-
new(1)
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
class Abort
|
|
16
|
-
def self.call
|
|
17
|
-
Output.raw_write("#{Bootstrap} is aborting\n")
|
|
18
|
-
instance = build
|
|
19
|
-
raise instance
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
|
|
23
7
|
module Backtrace
|
|
24
8
|
if RUBY_ENGINE != 'mruby'
|
|
25
9
|
def self.frame(frame_index)
|
|
@@ -91,7 +75,6 @@ module TestBench
|
|
|
91
75
|
|
|
92
76
|
def assert_raises(error_class=nil, &block)
|
|
93
77
|
begin
|
|
94
|
-
Output.raw_write("assert_raises\n")
|
|
95
78
|
block.()
|
|
96
79
|
|
|
97
80
|
rescue (error_class || StandardError) => error
|
|
@@ -137,14 +120,7 @@ module TestBench
|
|
|
137
120
|
return
|
|
138
121
|
end
|
|
139
122
|
|
|
140
|
-
|
|
141
|
-
block.()
|
|
142
|
-
|
|
143
|
-
rescue => error
|
|
144
|
-
Output.error(error)
|
|
145
|
-
|
|
146
|
-
Abort.()
|
|
147
|
-
end
|
|
123
|
+
block.()
|
|
148
124
|
end
|
|
149
125
|
|
|
150
126
|
def _context(prose=nil, &block)
|
|
@@ -163,11 +139,9 @@ module TestBench
|
|
|
163
139
|
Output.indent(prose, sgr_code: 0x32)
|
|
164
140
|
|
|
165
141
|
rescue => error
|
|
166
|
-
Output.indent(prose, sgr_codes: [0x1, 0x31])
|
|
167
|
-
Output.error(error)
|
|
168
|
-
end
|
|
142
|
+
Output.indent(prose, sgr_codes: [0x1, 0x31])
|
|
169
143
|
|
|
170
|
-
|
|
144
|
+
raise error
|
|
171
145
|
end
|
|
172
146
|
end
|
|
173
147
|
|
|
@@ -199,63 +173,6 @@ module TestBench
|
|
|
199
173
|
indent(text, device: device, sgr_code: sgr_code, sgr_codes: sgr_codes, tab_indent: tab_indent)
|
|
200
174
|
end
|
|
201
175
|
|
|
202
|
-
def error(error)
|
|
203
|
-
omit_backtrace_pattern = Defaults.omit_backtrace_pattern
|
|
204
|
-
|
|
205
|
-
omitting = false
|
|
206
|
-
|
|
207
|
-
write("\e[1mTraceback\e[22m (most recent call last):", sgr_code: 0x31)
|
|
208
|
-
|
|
209
|
-
rjust_length = error.backtrace.length.to_s.length
|
|
210
|
-
|
|
211
|
-
reverse_backtrace = error.backtrace[1..-1].reverse
|
|
212
|
-
|
|
213
|
-
reverse_backtrace.each_with_index do |frame, index|
|
|
214
|
-
frame = frame.dup
|
|
215
|
-
frame.chomp!
|
|
216
|
-
|
|
217
|
-
previous_frame = frame
|
|
218
|
-
|
|
219
|
-
file, _ = frame.split(':', 2)
|
|
220
|
-
|
|
221
|
-
line = ' ' * rjust_length
|
|
222
|
-
|
|
223
|
-
index_text = index.to_s
|
|
224
|
-
index_range = (-index_text.length..-1)
|
|
225
|
-
|
|
226
|
-
if Path.match?(omit_backtrace_pattern, file)
|
|
227
|
-
if omitting
|
|
228
|
-
next
|
|
229
|
-
else
|
|
230
|
-
omitting = true
|
|
231
|
-
|
|
232
|
-
line[index_range] = '?' * index_text.length
|
|
233
|
-
line += ": *omitted*"
|
|
234
|
-
|
|
235
|
-
write(line, sgr_codes: [0x2, 0x3, 0x31], tab_indent: true)
|
|
236
|
-
end
|
|
237
|
-
else
|
|
238
|
-
omitting = false
|
|
239
|
-
|
|
240
|
-
line[index_range] = index_text
|
|
241
|
-
line += ": #{frame}"
|
|
242
|
-
|
|
243
|
-
write(line, sgr_code: 0x31, tab_indent: true)
|
|
244
|
-
end
|
|
245
|
-
end
|
|
246
|
-
|
|
247
|
-
if error.message.empty?
|
|
248
|
-
if error.instance_of?(RuntimeError)
|
|
249
|
-
write("#{error.backtrace[0]}: \e[1;4munhandled exception\e[24;22m", sgr_code: 0x31)
|
|
250
|
-
return
|
|
251
|
-
end
|
|
252
|
-
|
|
253
|
-
error.message = error.class
|
|
254
|
-
end
|
|
255
|
-
|
|
256
|
-
write("#{error.backtrace[0]}: \e[1m#{error} (\e[4m#{error.class}\e[24m)\e[22m", sgr_code: 0x31)
|
|
257
|
-
end
|
|
258
|
-
|
|
259
176
|
def newline
|
|
260
177
|
write('')
|
|
261
178
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: test_bench-bootstrap
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 4.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nathan Ladd
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2022-
|
|
11
|
+
date: 2022-09-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description:
|
|
14
14
|
email: nathanladd+github@gmail.com
|