probatio 1.6.2 → 1.7.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/CHANGELOG.md +7 -0
- data/README.md +12 -1
- data/exe/proba +6 -2
- data/lib/probatio/assertions.rb +8 -16
- data/lib/probatio/errors.rb +5 -4
- data/lib/probatio/plugins.rb +27 -1
- data/lib/probatio.rb +72 -8
- 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: ca8587e9a4b21f857e2a8a50603deff772d78e68ce320ad581a16dd1ba11dc89
|
|
4
|
+
data.tar.gz: 86b7da1f6f31f7cf16a7b2b2cb4c0fbb4f845496095168fbbc94c6b88a8ae40d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a21ac68e3447c28f534127dfd34631f71c9e29cdb612ac62b73b136978e52d997eb62d5c1fd0084fdf941eb18b0bfed5ee0ba59471b35e64c238651785cc68c9
|
|
7
|
+
data.tar.gz: b98452d3e87e06790cdd3a79d1c60704a43b208d87330a01943d8d5f50126856cf989315eec9ba6608a6a044a52270c4d7c48fcf4cffd26bfef7453878a81c1b
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
# CHANGELOG.md
|
|
3
3
|
|
|
4
4
|
|
|
5
|
+
## probatio 1.7.0 released 2026-10-14
|
|
6
|
+
|
|
7
|
+
* Introduce `park(*args, &block)` to "park" groups and tests
|
|
8
|
+
* Log seed: and aseed: in .probatio-output.rb
|
|
9
|
+
* Introduce Probatio::Tracer
|
|
10
|
+
|
|
11
|
+
|
|
5
12
|
## probatio 1.6.2 released 2026-07-29
|
|
6
13
|
|
|
7
14
|
* Introduce `refute` as counterpart to `assert` jack of some trades
|
data/README.md
CHANGED
|
@@ -106,7 +106,7 @@ group 'core' do
|
|
|
106
106
|
setup do
|
|
107
107
|
# occurs once before tests and sub-groups in group 'core'
|
|
108
108
|
end
|
|
109
|
-
|
|
109
|
+
teardowm do
|
|
110
110
|
# occurs once after tests and sub-groups in group 'core'
|
|
111
111
|
end
|
|
112
112
|
|
|
@@ -209,6 +209,17 @@ group 'core' do
|
|
|
209
209
|
|
|
210
210
|
group 'bravo' do
|
|
211
211
|
end
|
|
212
|
+
|
|
213
|
+
park 'not now' do
|
|
214
|
+
#
|
|
215
|
+
# everything within a `park` will be silently discarded
|
|
216
|
+
|
|
217
|
+
group 'coco' do
|
|
218
|
+
test 'this or that' do
|
|
219
|
+
assert false
|
|
220
|
+
end
|
|
221
|
+
end
|
|
222
|
+
end
|
|
212
223
|
end
|
|
213
224
|
|
|
214
225
|
group 'core' do
|
data/exe/proba
CHANGED
|
@@ -208,8 +208,12 @@ test_dir =
|
|
|
208
208
|
is_directory_with_tests?('spec') ? 'spec' :
|
|
209
209
|
'test'
|
|
210
210
|
|
|
211
|
-
prev =
|
|
212
|
-
|
|
211
|
+
prev =
|
|
212
|
+
begin; Kernel.eval(File.read(Probatio.opath))
|
|
213
|
+
rescue Exception; { failures: [] }; end
|
|
214
|
+
fails =
|
|
215
|
+
prev[:failures].collect { |f| "#{f[:p]}:#{f[:l]}" }
|
|
216
|
+
|
|
213
217
|
#print 'fails:'; pp fails
|
|
214
218
|
#
|
|
215
219
|
tpoint = File.exist?(Probatio.tpath) ? File.read(Probatio.tpath).strip : nil
|
data/lib/probatio/assertions.rb
CHANGED
|
@@ -283,14 +283,18 @@ class Probatio::Context
|
|
|
283
283
|
|
|
284
284
|
def do_assert_(as, &block)
|
|
285
285
|
|
|
286
|
-
|
|
286
|
+
ameloc = [
|
|
287
|
+
extract_assert_method(caller),
|
|
288
|
+
extract_file_and_line(caller) ]
|
|
289
|
+
|
|
290
|
+
Probatio.despatch(:assertion_enter, self, @__child, ameloc)
|
|
287
291
|
|
|
288
292
|
case r =
|
|
289
293
|
begin; block.call; rescue => err; err; end
|
|
290
294
|
|
|
291
295
|
when StandardError, Hash, String
|
|
292
296
|
|
|
293
|
-
aerr =
|
|
297
|
+
aerr = Probatio::AssertionError.new(ameloc, as, r, @__child)
|
|
294
298
|
|
|
295
299
|
Probatio.despatch(:test_fail, self, @__child, aerr)
|
|
296
300
|
|
|
@@ -298,7 +302,7 @@ class Probatio::Context
|
|
|
298
302
|
|
|
299
303
|
when Exception
|
|
300
304
|
|
|
301
|
-
Probatio.despatch(:test_exception, self, @__child, r)
|
|
305
|
+
Probatio.despatch(:test_exception, self, @__child, r, ameloc)
|
|
302
306
|
|
|
303
307
|
raise r
|
|
304
308
|
|
|
@@ -313,19 +317,7 @@ class Probatio::Context
|
|
|
313
317
|
|
|
314
318
|
ensure
|
|
315
319
|
|
|
316
|
-
|
|
317
|
-
Probatio.despatch(:assertion_leave, self, @__child)
|
|
318
|
-
end
|
|
319
|
-
|
|
320
|
-
def make_assertion_error(arguments, result)
|
|
321
|
-
|
|
322
|
-
Probatio::AssertionError
|
|
323
|
-
.new(
|
|
324
|
-
extract_assert_method(caller),
|
|
325
|
-
arguments,
|
|
326
|
-
result,
|
|
327
|
-
@__child,
|
|
328
|
-
*extract_file_and_line(caller))
|
|
320
|
+
Probatio.despatch(:assertion_leave, self, @__child, ameloc)
|
|
329
321
|
end
|
|
330
322
|
|
|
331
323
|
def extract_file_and_line(backtrace)
|
data/lib/probatio/errors.rb
CHANGED
|
@@ -11,15 +11,15 @@ module Probatio
|
|
|
11
11
|
|
|
12
12
|
alias path file
|
|
13
13
|
|
|
14
|
-
def initialize(
|
|
14
|
+
def initialize(ameloc, arguments, error_or_message, test)
|
|
15
|
+
|
|
16
|
+
@assertion = ameloc[0]
|
|
17
|
+
@file, @line = ameloc[1]
|
|
15
18
|
|
|
16
|
-
@assertion = assertion
|
|
17
19
|
@arguments = arguments
|
|
18
20
|
|
|
19
21
|
@test = test
|
|
20
22
|
|
|
21
|
-
@file = file
|
|
22
|
-
@line = line
|
|
23
23
|
|
|
24
24
|
if error_or_message.is_a?(String)
|
|
25
25
|
@msg = error_or_message
|
|
@@ -35,6 +35,7 @@ module Probatio
|
|
|
35
35
|
|
|
36
36
|
[ @file, @line ]
|
|
37
37
|
end
|
|
38
|
+
alias loca location
|
|
38
39
|
|
|
39
40
|
def loc
|
|
40
41
|
|
data/lib/probatio/plugins.rb
CHANGED
|
@@ -218,9 +218,12 @@ class Probatio::ProbaOutputter
|
|
|
218
218
|
' ')
|
|
219
219
|
|
|
220
220
|
File.open(Probatio.opath, 'wb') do |o|
|
|
221
|
+
|
|
221
222
|
o << '# ' << Probatio.opath << "\n"
|
|
222
223
|
o << "{\n"
|
|
223
|
-
o <<
|
|
224
|
+
o << 'argv: ' << Cerata.horizontal_a_to_s(ARGV) << ",\n"
|
|
225
|
+
o << 'seed: ' << Probatio.seed.to_s << ",\n"
|
|
226
|
+
o << 'aseed: " --seed ' << Probatio.seed.to_s << " \",\n"
|
|
224
227
|
o << "failures:\n"
|
|
225
228
|
#o << " [\n"
|
|
226
229
|
#fls.each { |fl| o << ' ' << fl << ",\n" }
|
|
@@ -267,6 +270,28 @@ class Probatio::Exitter
|
|
|
267
270
|
end
|
|
268
271
|
end
|
|
269
272
|
|
|
273
|
+
class Probatio::Tracer
|
|
274
|
+
|
|
275
|
+
def initialize
|
|
276
|
+
|
|
277
|
+
File.open(Probatio.cpath, 'wb') do |f|
|
|
278
|
+
f.puts("aa Probatio #{Probatio::VERSION} Tracer")
|
|
279
|
+
f.puts("aa ARGV #{ARGV.inspect}")
|
|
280
|
+
end
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
def on_pre(ev)
|
|
284
|
+
|
|
285
|
+
File.open(Probatio.cpath, 'ab') { |f| f.puts "PP --seed #{Probatio.seed}" }
|
|
286
|
+
end
|
|
287
|
+
|
|
288
|
+
def record(ev)
|
|
289
|
+
|
|
290
|
+
File.open(Probatio.cpath, 'ab') { |f| ev.trace(f) }
|
|
291
|
+
#puts; puts File.read(Probatio.cpath)
|
|
292
|
+
end
|
|
293
|
+
end
|
|
294
|
+
|
|
270
295
|
Probatio.plug(Probatio::Recorder.new)
|
|
271
296
|
Probatio.plug(Probatio::Chronometer.new)
|
|
272
297
|
Probatio.plug(Probatio::DotReporter.new)
|
|
@@ -274,4 +299,5 @@ Probatio.plug(Probatio::VanillaSummarizer.new)
|
|
|
274
299
|
Probatio.plug(Probatio::ProbaOutputter.new)
|
|
275
300
|
Probatio.plug(Probatio::Beeper.new)
|
|
276
301
|
Probatio.plug(Probatio::Exitter.new)
|
|
302
|
+
Probatio.plug(Probatio::Tracer.new)
|
|
277
303
|
|
data/lib/probatio.rb
CHANGED
|
@@ -18,7 +18,7 @@ require 'probatio/more'
|
|
|
18
18
|
|
|
19
19
|
module Probatio
|
|
20
20
|
|
|
21
|
-
VERSION = '1.
|
|
21
|
+
VERSION = '1.7.0'
|
|
22
22
|
|
|
23
23
|
class << self
|
|
24
24
|
|
|
@@ -173,6 +173,7 @@ module Probatio
|
|
|
173
173
|
|
|
174
174
|
def epath; '.probatio-environments.rb'; end
|
|
175
175
|
def opath; '.probatio-output.rb'; end
|
|
176
|
+
def cpath; '.probatio-trace.log'; end
|
|
176
177
|
def tpath; '.test-point'; end
|
|
177
178
|
|
|
178
179
|
protected
|
|
@@ -323,6 +324,11 @@ module Probatio
|
|
|
323
324
|
"#{@path}:#{line}"
|
|
324
325
|
end
|
|
325
326
|
|
|
327
|
+
def loca
|
|
328
|
+
|
|
329
|
+
[ @path, line ]
|
|
330
|
+
end
|
|
331
|
+
|
|
326
332
|
def to_s(opts={})
|
|
327
333
|
|
|
328
334
|
col = Probatio.c
|
|
@@ -617,6 +623,11 @@ module Probatio
|
|
|
617
623
|
|
|
618
624
|
@children << Probatio::Test.new(self, @path, name.to_s, opts, block)
|
|
619
625
|
end
|
|
626
|
+
|
|
627
|
+
def park(*args)
|
|
628
|
+
|
|
629
|
+
# simply ignore...
|
|
630
|
+
end
|
|
620
631
|
end
|
|
621
632
|
|
|
622
633
|
class Leaf < Node
|
|
@@ -797,12 +808,13 @@ module Probatio
|
|
|
797
808
|
|
|
798
809
|
class Event
|
|
799
810
|
|
|
800
|
-
attr_reader :tstamp, :delta
|
|
801
|
-
attr_reader :name, :opts, :context, :group, :leaf, :error
|
|
811
|
+
attr_reader :wstamp, :tstamp, :delta
|
|
812
|
+
attr_reader :name, :opts, :context, :group, :leaf, :ameloc, :error
|
|
802
813
|
attr_accessor :leave_delta
|
|
803
814
|
|
|
804
815
|
def initialize(name, details)
|
|
805
816
|
|
|
817
|
+
@wstamp = Time.now
|
|
806
818
|
@tstamp, @delta = Probatio.monow_and_delta
|
|
807
819
|
|
|
808
820
|
@name = name.to_s
|
|
@@ -810,6 +822,7 @@ module Probatio
|
|
|
810
822
|
details.each do |d|
|
|
811
823
|
case d
|
|
812
824
|
when Hash then @opts = d
|
|
825
|
+
when Array then @ameloc = d
|
|
813
826
|
when Exception then @error = d
|
|
814
827
|
when Probatio::Leaf then @leaf = d
|
|
815
828
|
when Probatio::Group then @group = d
|
|
@@ -827,6 +840,20 @@ module Probatio
|
|
|
827
840
|
#
|
|
828
841
|
# which, in the case of assertion != self.node.type ...
|
|
829
842
|
|
|
843
|
+
def typ
|
|
844
|
+
|
|
845
|
+
case type
|
|
846
|
+
when 'test' then 'tst'
|
|
847
|
+
when 'group' then 'grp'
|
|
848
|
+
when 'setup' then 'sup'
|
|
849
|
+
when 'before' then 'bfr'
|
|
850
|
+
when 'teardown' then 'tdo'
|
|
851
|
+
when 'assertion' then 'ast'
|
|
852
|
+
when 'start' then 'STA'
|
|
853
|
+
when 'over' then 'OVR'
|
|
854
|
+
else @name[0, 3]; end
|
|
855
|
+
end
|
|
856
|
+
|
|
830
857
|
def node_full_name; node && node.full_name; end
|
|
831
858
|
|
|
832
859
|
def enter?; direction == :enter; end
|
|
@@ -847,13 +874,28 @@ module Probatio
|
|
|
847
874
|
|
|
848
875
|
def location
|
|
849
876
|
|
|
850
|
-
(error && error.
|
|
851
|
-
(
|
|
877
|
+
(error && error.loca) ||
|
|
878
|
+
(ameloc && ameloc[1]) ||
|
|
879
|
+
(node && node.loca) ||
|
|
880
|
+
[ '', -1 ]
|
|
852
881
|
end
|
|
882
|
+
alias loca location
|
|
853
883
|
|
|
854
884
|
def path
|
|
855
885
|
|
|
856
|
-
node && node.path
|
|
886
|
+
#node && node.path
|
|
887
|
+
loca[0]
|
|
888
|
+
end
|
|
889
|
+
|
|
890
|
+
def na
|
|
891
|
+
|
|
892
|
+
n = @name.split('_').map { |e| e[0, 1] }.join('').upcase
|
|
893
|
+
n.length > 1 ? n : n * 2
|
|
894
|
+
end
|
|
895
|
+
|
|
896
|
+
def wstamp_s
|
|
897
|
+
|
|
898
|
+
'%s.%03d' % [ @wstamp.strftime('%Y%m%d %H:%M:%S'), @wstamp.usec / 1000 ]
|
|
857
899
|
end
|
|
858
900
|
|
|
859
901
|
def to_s
|
|
@@ -866,7 +908,8 @@ module Probatio
|
|
|
866
908
|
o << "\n node=#{node.full_name.inspect}" if node
|
|
867
909
|
o << "\n node_type=#{node.type.inspect}" if node
|
|
868
910
|
o << "\n error=#{error.to_s.inspect}" if error
|
|
869
|
-
o << "\n location=#{
|
|
911
|
+
o << "\n location=#{loca.map(&:to_s).join(':').inspect}" if node
|
|
912
|
+
o << "\n wstamp=\"#{wstamp.iso8601(3)}\""
|
|
870
913
|
o << "\n delta=\"#{Probatio.to_time_s(delta)}\"" if delta
|
|
871
914
|
o << "\n leave_delta=\"#{Probatio.to_time_s(led)}\"" if led
|
|
872
915
|
o << " />"
|
|
@@ -876,7 +919,28 @@ module Probatio
|
|
|
876
919
|
|
|
877
920
|
def to_h
|
|
878
921
|
|
|
879
|
-
{ n: name, p:
|
|
922
|
+
{ n: name, p: loca[0], l: loca[1], t: delta_s, w: wstamp_s }
|
|
923
|
+
end
|
|
924
|
+
|
|
925
|
+
def trace(out)
|
|
926
|
+
|
|
927
|
+
out << na << ' ' << wstamp_s << ' '
|
|
928
|
+
out << typ << ' ' if node
|
|
929
|
+
out << loca[0] << ':' << loca[1] << ' '
|
|
930
|
+
|
|
931
|
+
out << ameloc[0] << ' ' if ameloc
|
|
932
|
+
out << node.full_name.inspect << ' ' if node && ! ameloc
|
|
933
|
+
|
|
934
|
+
out << 'ERROR:' << error.to_s.inspect << ' ' if error
|
|
935
|
+
|
|
936
|
+
out << 'd:' << Probatio.to_time_s(delta) << ' ' if delta
|
|
937
|
+
|
|
938
|
+
led = determine_leave_delta
|
|
939
|
+
out << 'ld:' << Probatio.to_time_s(led) << ' ' if led
|
|
940
|
+
|
|
941
|
+
out << "\n"
|
|
942
|
+
|
|
943
|
+
out
|
|
880
944
|
end
|
|
881
945
|
end
|
|
882
946
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: probatio
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- John Mettraux
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-10-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: stringio
|