probatio 1.4.1 → 1.4.2

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/lib/probatio.rb +37 -6
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c910c5674405102137f008c16c94908088831536430f839c39a4802509c8a709
4
- data.tar.gz: b32eab00ef03d092f94aba817d0c537eeb0d5e39b816b22dce0bed9137bd825c
3
+ metadata.gz: cb5913d7a89604bdcb77a726382d5b50c333df3be906872e1484d540f04d162b
4
+ data.tar.gz: 176cd56812b6aee807da7fedce98243e9a0bbc8e1a2b835a251dc406e4b4920d
5
5
  SHA512:
6
- metadata.gz: 22f07a3b6ee491c3c2e580dd04d11ad379ea9f05ab4bd7ed39446bc7bb600af1c6dba17001a5d61f2cd6f4b36a4ab8803e5f8de9c9788443e5ceb915e8b7bac8
7
- data.tar.gz: 0ae5c5537465bffa1b4fe8de09836a6f67c6a0499952e9684ef060e6d66c83aeba8ec35249c91d847d7f40035431ea4227859d56cceb8cf69fc7aca9a7e2037a
6
+ metadata.gz: 857a906c0174eb4501b641db7da24ca8685c4b6062c5d7366db1287118228a2371731781d818a4edcf33f3333f8dd5a781193ccd8c42cffc5dbb3bb612aa1c17
7
+ data.tar.gz: 15650e10842cbcfd0b81747ba46bd222a4d4b9a42720ade1b25cdb8ee6972b1c4d5fd09a73b49778f8a1311c4b0245e5bc345be66527c0cdc49528815ca81d99
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
  # CHANGELOG.md
3
3
 
4
4
 
5
+ ## probatio 1.4.2 released 2025-11-26
6
+
7
+ * Allow pointing at a group with a line number between tests
8
+
9
+
5
10
  ## probatio 1.4.1 released 2025-11-16
6
11
 
7
12
  * Fixed assert_error versus no errors
data/lib/probatio.rb CHANGED
@@ -18,7 +18,7 @@ require 'probatio/more'
18
18
 
19
19
  module Probatio
20
20
 
21
- VERSION = '1.4.1'
21
+ VERSION = '1.4.2'
22
22
 
23
23
  class << self
24
24
 
@@ -101,6 +101,8 @@ module Probatio
101
101
  read_test_file(root_group, fpath)
102
102
  end
103
103
 
104
+ rework_line_numbers(root_group)
105
+
104
106
  run_opts[:filen] = rework_filen(root_group, run_opts)
105
107
 
106
108
  dbg_s { Cerata.vertical_h_to_s(run_opts, ' run_opts| ') }
@@ -200,7 +202,9 @@ module Probatio
200
202
  fmap = map[fn[0]]
201
203
  fline = fn[1]
202
204
 
203
- n = fmap.find { |l0, l1, n| fline >= l0 && (fline <= l1 || l1 < 1) }
205
+ n = fmap
206
+ .select { |l0, l1, n| fline >= l0 && (fline <= l1 || l1 < 1) }
207
+ .last
204
208
 
205
209
  return [ fn ] if n && n[2].is_a?(Probatio::Test)
206
210
 
@@ -235,6 +239,32 @@ module Probatio
235
239
 
236
240
  fs.any? ? fs : do_locate(File.dirname(dir), suffixes)
237
241
  end
242
+
243
+ def rework_line_numbers(root_group)
244
+
245
+ # if the start line is 0, set it to the end line
246
+ # if the end line is 0, set it to the file's last line
247
+ #
248
+ root_group.map.each do |path, groups|
249
+ groups.each do |llg|
250
+ llg[0] = llg[1] if llg[0] == 0
251
+ llg[1] = File.readlines(path).count if llg[1] == 0
252
+ end
253
+ end
254
+
255
+ # ensure that group end lines are their last child's end line
256
+ #
257
+ root_group
258
+ .map
259
+ .inject([]) { |a, (_, groups)|
260
+ groups.each { |llg| a << llg if llg[2].is_a?(Probatio::Group) }
261
+ a }
262
+ .reverse
263
+ .each { |llg|
264
+ g = llg[2]; next if g.name == '_'
265
+ lc = g.children.last
266
+ llg[1] = lc.last_line if lc }
267
+ end
238
268
  end
239
269
 
240
270
  class Node
@@ -348,6 +378,7 @@ module Probatio
348
378
 
349
379
  f0 = f.last
350
380
  f0[1] = (l == 0 ? f0[0] : l - 1) if f0
381
+ # sets the last line of the previous node...
351
382
 
352
383
  f << [ l, 0, self ]
353
384
  end
@@ -582,6 +613,8 @@ module Probatio
582
613
 
583
614
  def test(name, opts={}, &block)
584
615
 
616
+ opts[:pending] = true if block.nil?
617
+
585
618
  @children << Probatio::Test.new(self, @path, name.to_s, opts, block)
586
619
  end
587
620
  end
@@ -660,10 +693,8 @@ module Probatio
660
693
 
661
694
  def path_and_line_match?(fpath, fline)
662
695
 
663
- #p [ path, line, last_line, '<-->', fpath, fline ]
664
- line &&
665
- path == fpath &&
666
- fline >= line && fline <= last_line
696
+ path == fpath &&
697
+ fline && line && fline >= line && fline <= last_line
667
698
  end
668
699
 
669
700
  def in_setup?
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.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Mettraux
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-11-16 00:00:00.000000000 Z
11
+ date: 2025-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: stringio