sus 0.22.0 → 0.22.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 49e0b28d22be1c2142e9868d47de8e0e39447874bb5e17a4a9c513c723656617
4
- data.tar.gz: 85e6348661715455dcec9ea552e59b788dd7637d79b32126c3e456e68b4d6998
3
+ metadata.gz: c70a977a33735903d76e45646448e680ad8c296d5a78b82c8cb06d597f79764b
4
+ data.tar.gz: 724ed6df638cc6871340b0f716f1a30f5c02952fb915889f31666c56f03d3c7d
5
5
  SHA512:
6
- metadata.gz: f079bb5a6e5d3ff4f9f27f25f93675111754fbcc92f95b59209d981a370adbe2008ecb07acd7fb280db0f0d47705ae3254d55791f473e78891552cfebf7ba044
7
- data.tar.gz: 99dde477c93576abf2ff664a3fd8bc31eda8be9280c6cd79aa6f831d68f4ae004ef9a6815ce6bcd49e718c64d4745a0b040c90b0b67fcb1be7886664823c6769
6
+ metadata.gz: 74683ea93689e366705fa06bd54f179901fe6b6c275c8898c5e4def4efba00f27f6bc0d4ec1931546efadaa0478a47a1a19c16f6a8635f3859eee340a05d2383
7
+ data.tar.gz: dc51defc2fd29cd488037fae3411ccddd93c58d9a124264ba03bb4369253aec2721ea4f3b62c863ff853a83d7a250aec6c22e3daa4d68baeb69d211b27c408b1
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/sus/config.rb CHANGED
@@ -202,9 +202,7 @@ module Sus
202
202
  output.puts title
203
203
 
204
204
  assertions.each do |assertion|
205
- assertions.each do |failure|
206
- output.append(failure.output)
207
- end
205
+ output.append(assertion.output)
208
206
  end
209
207
  end
210
208
  end
data/lib/sus/identity.rb CHANGED
@@ -15,6 +15,10 @@ module Sus
15
15
  self.new(location.path, name, location.lineno, parent, **options)
16
16
  end
17
17
 
18
+ def self.current
19
+ self.nested(nil, nil, caller_locations(1...2).first)
20
+ end
21
+
18
22
  # @parameter unique [Boolean | Symbol] Whether this identity is unique or needs a unique key/line number suffix.
19
23
  def initialize(path, name = nil, line = nil, parent = nil, unique: true)
20
24
  @path = path
@@ -15,7 +15,7 @@ module Sus
15
15
  def self.for(exception, identity = nil)
16
16
  # I've disabled the root filter here, because partial backtraces are not very useful.
17
17
  # We might want to do something to improve presentation of the backtrace based on the root instead.
18
- self.new(exception.backtrace_locations) # , identity&.path)
18
+ self.new(exception.backtrace_locations, identity&.path)
19
19
  end
20
20
 
21
21
  def initialize(stack, root = nil, limit = nil)
@@ -24,20 +24,26 @@ module Sus
24
24
  @limit = limit
25
25
  end
26
26
 
27
- def filter(root = @root)
28
- if @root
29
- stack = @stack.select do |frame|
30
- frame.path.start_with?(@root)
27
+ attr :stack
28
+ attr :root
29
+ attr :limit
30
+
31
+ def filter(root: @root, limit: @limit)
32
+ if root
33
+ if limit
34
+ return @stack.lazy.select do |frame|
35
+ frame.path.start_with?(root)
36
+ end.first(limit)
37
+ else
38
+ return up_to_and_matching(@stack) do |frame|
39
+ frame.path.start_with?(root)
40
+ end
31
41
  end
42
+ elsif limit
43
+ return @stack.first(limit)
32
44
  else
33
- stack = @stack
45
+ return @stack
34
46
  end
35
-
36
- if @limit
37
- stack = stack.take(@limit)
38
- end
39
-
40
- return stack
41
47
  end
42
48
 
43
49
  def print(output)
@@ -53,6 +59,22 @@ module Sus
53
59
  end
54
60
  end
55
61
  end
62
+
63
+ private def up_to_and_matching(things, &block)
64
+ preface = true
65
+ things.select do |thing|
66
+ if preface
67
+ if yield(thing)
68
+ preface = false
69
+ end
70
+ true
71
+ elsif yield(thing)
72
+ true
73
+ else
74
+ false
75
+ end
76
+ end
77
+ end
56
78
  end
57
79
  end
58
80
  end
data/lib/sus/version.rb CHANGED
@@ -4,5 +4,5 @@
4
4
  # Copyright, 2021-2023, by Samuel Williams.
5
5
 
6
6
  module Sus
7
- VERSION = "0.22.0"
7
+ VERSION = "0.22.2"
8
8
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.22.0
4
+ version: 0.22.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -38,7 +38,7 @@ cert_chain:
38
38
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
39
39
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
40
40
  -----END CERTIFICATE-----
41
- date: 2023-07-22 00:00:00.000000000 Z
41
+ date: 2023-08-01 00:00:00.000000000 Z
42
42
  dependencies: []
43
43
  description:
44
44
  email:
metadata.gz.sig CHANGED
Binary file