sus 0.12.1 → 0.12.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 215e58e8a6634f65126546c43a66bd8479bf844fac053807d7d4094634fdc0ee
4
- data.tar.gz: b85ff11efcd467c8f101a4051d83012f74bc134a17f2eafc37b0248e2da95260
3
+ metadata.gz: 2d505d424da315b800a7343985c211d2cfdb9a74217fb81bd6025edec186e419
4
+ data.tar.gz: 5e94dbc0566760d20f937a87c09fa958152c79fb06656827f66e7a189dc40a0a
5
5
  SHA512:
6
- metadata.gz: 7981aa6fe18a62ae576537bd46375809e1d52d0a5362e729069e7f30ac56d6507b135490bd3bd3bb0d22143bbdd7d8a3c95d89838d4adb6071d4c8f723656eb2
7
- data.tar.gz: 1940a4dc0cd0c955a657303f4c218a9ec771d361e000d99e9b7c0b01f9fc09ab13bb36329e81491ea92b6b590e135a3316b054213785f7ff6a59c52249fc7e9f
6
+ metadata.gz: 5866a210c3427c7afa83ccd6b45c2915fdff79cd0c3cec8941f8a26f7ebe32d453911be4bbd08375c78bda93ae827a840669d1d9657465feff84cfef1488db7f
7
+ data.tar.gz: 87092d555eab03db7ff1993bfea058fdb1a628cb22a2f57dc3bd63341dc29697c1444575664432d8fb277039faa6d4cbd2e78c3ab3f4fc7435be9229711eab64
checksums.yaml.gz.sig CHANGED
Binary file
data/bin/sus CHANGED
@@ -1,5 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ # require 'stackprof'
4
+ # StackProf.start(mode: :wall, interval: 10)
5
+
3
6
  require_relative '../lib/sus/config'
4
7
  config = Sus::Config.load
5
8
 
@@ -20,6 +23,11 @@ config.before_tests(assertions)
20
23
  registry.call(assertions)
21
24
  config.after_tests(assertions)
22
25
 
26
+ # StackProf.stop
27
+ # StackProf.results('sus.stackprof')
28
+ #
29
+ # $ stackprof sus.stackprof --text --limit 10
30
+
23
31
  if assertions.failed.any?
24
32
  exit(1)
25
33
  end
@@ -24,7 +24,7 @@ module Sus
24
24
  @verbose = verbose
25
25
 
26
26
  if measure
27
- @clock = Clock.new
27
+ @clock = Clock.start!
28
28
  else
29
29
  @clock = nil
30
30
  end
@@ -181,44 +181,23 @@ module Sus
181
181
 
182
182
  assertions = self.class.new(identity: identity, target: target, output: output, isolated: isolated, inverted: inverted, verbose: @verbose, **options)
183
183
 
184
- @clock&.start!
185
-
186
184
  output.indented do
187
185
  begin
188
186
  result = yield(assertions)
189
187
  rescue StandardError => error
190
188
  assertions.fail(error)
191
- ensure
192
- @clock&.stop!
193
189
  end
194
190
  end
195
191
 
196
- self.add(assertions)
192
+ # Some assertions are deferred until the end of the test, e.g. expecting a method to be called. This scope is managed by the {add} method. If there are no deferred assertions, then we can add the child assertions right away. Otherwise, we append the child assertions to our own list of deferred assertions. When an assertions instance is marked as `isolated`, it will force all deferred assertions to be resolved. It's also at this time, we should conclude measuring the duration of the test.
193
+ assertions.resolve_into(self)
197
194
 
198
195
  return result
199
196
  end
200
197
 
198
+ # Add the child assertions which were nested to this instance.
201
199
  def add(assertions)
202
- # If the assertions should be an isolated group, make sure any deferred assertions are resolved:
203
- if assertions.isolated and assertions.deferred?
204
- assertions.resolve!
205
- end
206
-
207
- if assertions.deferred?
208
- self.defer do
209
- output.puts(:indent, assertions.target)
210
- assertions.resolve!
211
-
212
- self.add!(assertions)
213
- end
214
- else
215
- self.add!(assertions)
216
- end
217
- end
218
-
219
- private
220
-
221
- def add!(assertions)
200
+ # All child assertions should be resolved by this point:
222
201
  raise "Nested assertions must be fully resolved!" if assertions.deferred?
223
202
 
224
203
  if assertions.isolated or assertions.inverted
@@ -230,6 +209,29 @@ module Sus
230
209
  end
231
210
  end
232
211
 
212
+ def resolve_into(parent)
213
+ # If the assertions should be an isolated group, make sure any deferred assertions are resolved:
214
+ if @isolated and self.deferred?
215
+ self.resolve!
216
+ end
217
+
218
+ # Check if the child assertions are deferred, and if so, add them to our own list of deferred assertions:
219
+ if self.deferred?
220
+ parent.defer do
221
+ output.puts(:indent, @target)
222
+ self.resolve!
223
+
224
+ @clock&.stop!
225
+ parent.add(self)
226
+ end
227
+ else
228
+ @clock&.stop!
229
+ parent.add(self)
230
+ end
231
+ end
232
+
233
+ private
234
+
233
235
  def merge!(assertions)
234
236
  @count += assertions.count
235
237
 
data/lib/sus/version.rb CHANGED
@@ -4,5 +4,5 @@
4
4
  # Copyright, 2021-2022, by Samuel Williams.
5
5
 
6
6
  module Sus
7
- VERSION = "0.12.1"
7
+ VERSION = "0.12.2"
8
8
  end
data.tar.gz.sig CHANGED
@@ -1,3 +1 @@
1
- >���0 ˽WV�н&'y��W�y��eci#Ts�!�/�8�-��̞Vj�s��!� T]ó#��]����j;��R��r�ԞRzpn���Uh�D��~�0I-g.Zj�����|;�H��5CQUrꪏ����2����.'
2
- m*�=�jᕷB�J�,��ƞ������s��Ȕ��;�n��O2Q7��9d�`��ijErm �K.�9�0��`��������1����.����i��i�ʏ��&��6�B���2�z����x�]U8�f}�C�+8��+��Y���-�6 W�ɬ��5D�
3
- <�4/�Lŭ�<�z��Mё�A�:73��>h�e1i�S�Q '�
1
+ r�؇��L����J�����7��Ѥ�)X k�W�Em]�,��iY;�y"����9�|���9lH+�+P<%��S��@���s)x�q���5;�$FP٭�2������S �e�$��-���s>� Ć�ҐB�p�5�,]Pߦ�#���5<����}�&�1Xk,%�����=k�А�����ȐW��MX���ZDS�b=j��ԍ�z02Q��L��J)������H��#�]�a��k~��#-��)\;K ��fW��o{��W�@K�HT�?��P�M��� �nu͆��n+��(�h��"͛�b1+l9�Y����-\�j���_N�:W��+� ��5S=BW(zť���;~��\��h�>�+ɛ�8�&V_��U
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.12.1
4
+ version: 0.12.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -37,8 +37,50 @@ cert_chain:
37
37
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
38
38
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
39
39
  -----END CERTIFICATE-----
40
- date: 2022-08-27 00:00:00.000000000 Z
41
- dependencies: []
40
+ date: 2022-08-28 00:00:00.000000000 Z
41
+ dependencies:
42
+ - !ruby/object:Gem::Dependency
43
+ name: bake-test
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '0.1'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '0.1'
56
+ - !ruby/object:Gem::Dependency
57
+ name: bake-test-external
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '0.1'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '0.1'
70
+ - !ruby/object:Gem::Dependency
71
+ name: covered
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: 0.16.6
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: 0.16.6
42
84
  description:
43
85
  email:
44
86
  executables:
@@ -109,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
151
  - !ruby/object:Gem::Version
110
152
  version: '0'
111
153
  requirements: []
112
- rubygems_version: 3.1.6
154
+ rubygems_version: 3.3.7
113
155
  signing_key:
114
156
  specification_version: 4
115
157
  summary: A fast and scalable test runner.
metadata.gz.sig CHANGED
Binary file