sus 0.21.1 → 0.21.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: 8653cb936d27d9e33250698daac7861a3235699ae90e6263a6d79d33dd24b4bd
4
- data.tar.gz: '0516931df8c4f34c61ab56cd75d65e29adc414e8d39797d79e8ba273af356e6e'
3
+ metadata.gz: 9c9d5cda23334b97833ed1a604e83b02e40082a954090b534c40308d6bd311c3
4
+ data.tar.gz: 758aff4bbafb00ed7587d281f26a7c0ee8922f5a8e24156c1e5647da7268d6f1
5
5
  SHA512:
6
- metadata.gz: 8c8a8fd1d650280a873af340909fc55bfe3a3fa6fc510fb55dfc42a696a58beee78450d88d11340785d084e94c9a5bfedb85751f9f13cc0d61697cb7bfb2738c
7
- data.tar.gz: ebb26520158d23db914fc931afd6e001e2839fcaeff3f20b6734ab2f0a0c7d644a61f1f74f84ccf3af2f7e302954aa1244d792320e25dcc5f30e7e866b3e38a6
6
+ metadata.gz: 27c8d2c7e7547f69799e7d078076abc6a629c2e8c7c29d7c37bc40bbcaff207ef253477de12818429f6543db07be95738c39371d7f6b1329179a6eca0b4cc190
7
+ data.tar.gz: 5e6746be0bbe69a8698903cb7a95a4ce5e61598b1744bf0b85095c3de6e47a3523855ba8d82f07071f0bfd5fba4463800b510107b4ed9534c8c88f7f629c56b1
checksums.yaml.gz.sig CHANGED
Binary file
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2021-2022, by Samuel Williams.
4
+ # Copyright, 2021-2023, by Samuel Williams.
5
5
 
6
6
  require_relative 'output'
7
7
  require_relative 'clock'
@@ -42,9 +42,16 @@ module Sus
42
42
  @count = 0
43
43
  end
44
44
 
45
+ # The identity that is used to identify this set of assertions.
45
46
  attr :identity
47
+
48
+ # The specific target of the assertions, e.g. the test case or nested test assertions.
46
49
  attr :target
50
+
51
+ # The output buffer used to capture output from the assertions.
47
52
  attr :output
53
+
54
+ # The nesting level of this set of assertions.
48
55
  attr :level
49
56
 
50
57
  # Whether this aset of assertions is inverted, i.e. the assertions are expected to fail relative to the parent. Used for grouping assertions and ensuring they are added to the parent passed/failed array correctly.
@@ -288,7 +295,7 @@ module Sus
288
295
  @output.error(error, @identity)
289
296
  end
290
297
 
291
- def nested(target, identity: nil, isolated: false, distinct: false, inverted: false, **options)
298
+ def nested(target, identity: @identity, isolated: false, distinct: false, inverted: false, **options)
292
299
  result = nil
293
300
 
294
301
  # Isolated assertions need to have buffered output so they can be replayed if they fail:
@@ -387,6 +394,8 @@ module Sus
387
394
  # self.print(@output, verbose: false)
388
395
  # @output.puts
389
396
  end
397
+
398
+ @skipped.concat(assertions.skipped)
390
399
  end
391
400
 
392
401
  # Concatenate the child assertions into this instance.
data/lib/sus/base.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2021-2022, by Samuel Williams.
4
+ # Copyright, 2021-2023, by Samuel Williams.
5
5
 
6
6
  require_relative 'context'
7
7
 
@@ -45,6 +45,7 @@ module Sus
45
45
  base.extend(Context)
46
46
  base.identity = Identity.new(root) if root
47
47
  base.description = description
48
+ base.set_temporary_name("#{self}[#{description}]")
48
49
 
49
50
  return base
50
51
  end
data/lib/sus/be_truthy.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2022, by Samuel Williams.
4
+ # Copyright, 2022-2023, by Samuel Williams.
5
5
 
6
6
  module Sus
7
7
  module BeTruthy
data/lib/sus/clock.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2022, by Samuel Williams.
4
+ # Copyright, 2022-2023, by Samuel Williams.
5
5
 
6
6
  module Sus
7
7
  class Clock
data/lib/sus/config.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2022, by Samuel Williams.
4
+ # Copyright, 2022-2023, by Samuel Williams.
5
5
 
6
6
  require_relative 'clock'
7
7
  require_relative 'registry'
data/lib/sus/context.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2021-2022, by Samuel Williams.
4
+ # Copyright, 2021-2023, by Samuel Williams.
5
5
 
6
6
  require_relative 'assertions'
7
7
  require_relative 'identity'
@@ -16,15 +16,21 @@ module Sus
16
16
  base.children = Hash.new
17
17
  end
18
18
 
19
- def to_s
20
- self.description || self.name
21
- end
22
-
23
- def inspect
24
- if description = self.description
25
- "\#<#{self.name || "Context"} #{self.description}>"
26
- else
27
- self.name
19
+ unless respond_to?(:set_temporary_name)
20
+ def set_temporary_name(name)
21
+ # No-op.
22
+ end
23
+
24
+ def to_s
25
+ (self.description || self.name).to_s
26
+ end
27
+
28
+ def inspect
29
+ if description = self.description
30
+ "\#<#{self.name || "Context"} #{self.description}>"
31
+ else
32
+ self.name
33
+ end
28
34
  end
29
35
  end
30
36
 
data/lib/sus/describe.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2021-2022, by Samuel Williams.
4
+ # Copyright, 2021-2023, by Samuel Williams.
5
5
 
6
6
  require_relative 'context'
7
7
 
@@ -18,6 +18,8 @@ module Sus
18
18
  base.subject = subject
19
19
  base.description = subject.to_s
20
20
  base.identity = Identity.nested(parent.identity, base.description, unique: unique)
21
+ base.set_temporary_name("#{self}[#{base.description}]")
22
+
21
23
  base.define_method(:subject, ->{subject})
22
24
 
23
25
  if block_given?
data/lib/sus/expect.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2021-2022, by Samuel Williams.
4
+ # Copyright, 2021-2023, by Samuel Williams.
5
5
 
6
6
  module Sus
7
7
  class Expect
data/lib/sus/file.rb CHANGED
@@ -24,6 +24,10 @@ module Sus
24
24
  module File
25
25
  extend Context
26
26
 
27
+ def self.[] path
28
+ self.build(Sus.base, path)
29
+ end
30
+
27
31
  def self.extended(base)
28
32
  base.children = Hash.new
29
33
  end
@@ -34,6 +38,7 @@ module Sus
34
38
  base.extend(File)
35
39
  base.description = path
36
40
  base.identity = Identity.file(parent.identity, path)
41
+ base.set_temporary_name("#{self}[#{path}]")
37
42
 
38
43
  begin
39
44
  TOPLEVEL_CLASS_EVAL.call(base, path)
data/lib/sus/filter.rb CHANGED
@@ -1,9 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2021-2022, by Samuel Williams.
4
+ # Copyright, 2021-2023, by Samuel Williams.
5
5
 
6
6
  module Sus
7
+ # Provides a way to filter the registry according to the suffix on loaded paths.
8
+ #
9
+ # A test has an identity, e.g. the file and line number on which it's defined.
10
+ #
11
+ # A filter takes an identity, decomposes it into a file and suffix, loads the file, and registers the filter suffix.
12
+ #
13
+ # When the filter is used to enumerate the registry, it will only return the tests that match the suffix.
7
14
  class Filter
8
15
  class Index
9
16
  def initialize
data/lib/sus/identity.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2021-2022, by Samuel Williams.
4
+ # Copyright, 2021-2023, by Samuel Williams.
5
5
 
6
6
  module Sus
7
7
  class Identity
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2021-2022, by Samuel Williams.
4
+ # Copyright, 2021-2023, by Samuel Williams.
5
5
 
6
6
  require_relative 'context'
7
7
 
data/lib/sus/it.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2021-2022, by Samuel Williams.
4
+ # Copyright, 2021-2023, by Samuel Williams.
5
5
 
6
6
  require_relative 'context'
7
7
 
@@ -12,6 +12,7 @@ module Sus
12
12
  base.extend(It)
13
13
  base.description = description
14
14
  base.identity = Identity.nested(parent.identity, base.description, unique: unique)
15
+ base.set_temporary_name("#{self}[#{description}]")
15
16
 
16
17
  if block_given?
17
18
  base.define_method(:call, &block)
@@ -64,5 +65,17 @@ module Sus
64
65
  @__assertions__.skip(reason)
65
66
  throw :skip, reason
66
67
  end
68
+
69
+ def skip_unless_method_defined(method, target)
70
+ unless target.method_defined?(method)
71
+ skip "Method #{method} is not defined in #{target}!"
72
+ end
73
+ end
74
+
75
+ def skip_unless_constant_defined(constant, target = Object)
76
+ unless target.const_defined?(constant)
77
+ skip "Constant #{constant} is not defined in #{target}!"
78
+ end
79
+ end
67
80
  end
68
81
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2021-2022, by Samuel Williams.
4
+ # Copyright, 2021-2023, by Samuel Williams.
5
5
 
6
6
  require_relative 'context'
7
7
 
@@ -17,6 +17,7 @@ module Sus
17
17
  base.children = Hash.new
18
18
  base.description = shared.name
19
19
  base.identity = Identity.nested(parent.identity, base.description, unique: unique)
20
+ base.set_temporary_name("#{self}[#{base.description}]")
20
21
 
21
22
  # User provided block is evaluated first, so that it can provide default behaviour for the shared context:
22
23
  if block_given?
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2021-2022, by Samuel Williams.
4
+ # Copyright, 2021-2023, by Samuel Williams.
5
5
 
6
6
  require 'io/console'
7
7
  require 'stringio'
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2021-2022, by Samuel Williams.
4
+ # Copyright, 2021-2023, by Samuel Williams.
5
5
 
6
6
  require_relative 'messages'
7
7
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2021-2022, by Samuel Williams.
4
+ # Copyright, 2021-2023, by Samuel Williams.
5
5
 
6
6
  require_relative 'messages'
7
7
  require_relative 'buffered'
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2021-2022, by Samuel Williams.
4
+ # Copyright, 2021-2023, by Samuel Williams.
5
5
 
6
6
  module Sus
7
7
  class RaiseException
data/lib/sus/registry.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2021-2022, by Samuel Williams.
4
+ # Copyright, 2021-2023, by Samuel Williams.
5
5
  # Copyright, 2022, by Brad Schrag.
6
6
 
7
7
  require_relative 'base'
@@ -35,7 +35,7 @@ module Sus
35
35
  end
36
36
 
37
37
  def to_s
38
- @base.identity.to_s
38
+ @base&.identity&.to_s || self.class.name
39
39
  end
40
40
 
41
41
  def load(path)
data/lib/sus/tree.rb CHANGED
@@ -1,3 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2023, by Samuel Williams.
5
+
1
6
  module Sus
2
7
  class Tree
3
8
  def initialize(context)
data/lib/sus/version.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2021-2022, by Samuel Williams.
4
+ # Copyright, 2021-2023, by Samuel Williams.
5
5
 
6
6
  module Sus
7
- VERSION = "0.21.1"
7
+ VERSION = "0.21.2"
8
8
  end
data/lib/sus/with.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2021-2022, by Samuel Williams.
4
+ # Copyright, 2021-2023, by Samuel Williams.
5
5
 
6
6
  require_relative 'context'
7
7
 
@@ -19,6 +19,8 @@ module Sus
19
19
  base.subject = subject
20
20
  base.description = subject
21
21
  base.identity = Identity.nested(parent.identity, base.description, unique: unique)
22
+ base.set_temporary_name("#{self}[#{base.description}]")
23
+
22
24
  base.variables = variables
23
25
 
24
26
  base.define_method(:description, ->{subject})
data/lib/sus.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2021-2022, by Samuel Williams.
4
+ # Copyright, 2021-2023, by Samuel Williams.
5
5
 
6
6
  require_relative 'sus/version'
7
7
  require_relative 'sus/config'
data/readme.md CHANGED
@@ -1,4 +1,4 @@
1
- # Sus(picious) \[working name\]
1
+ # Sus(picious)
2
2
 
3
3
  An opinionated test framework designed with several goals:
4
4
 
@@ -38,8 +38,18 @@ Check `test` directory for examples.
38
38
 
39
39
  ## Contributing
40
40
 
41
+ We welcome contributions to this project.
42
+
41
43
  1. Fork it.
42
44
  2. Create your feature branch (`git checkout -b my-new-feature`).
43
45
  3. Commit your changes (`git commit -am 'Add some feature'`).
44
46
  4. Push to the branch (`git push origin my-new-feature`).
45
47
  5. Create new Pull Request.
48
+
49
+ ### Developer Certificate of Origin
50
+
51
+ This project uses the [Developer Certificate of Origin](https://developercertificate.org/). All contributors to this project must agree to this document to have their contributions accepted.
52
+
53
+ ### Contributor Covenant
54
+
55
+ This project is governed by [Contributor Covenant](https://www.contributor-covenant.org/). All contributors and participants agree to abide by its terms.
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.21.1
4
+ version: 0.21.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -38,50 +38,8 @@ cert_chain:
38
38
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
39
39
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
40
40
  -----END CERTIFICATE-----
41
- date: 2023-06-14 00:00:00.000000000 Z
42
- dependencies:
43
- - !ruby/object:Gem::Dependency
44
- name: bake-test
45
- requirement: !ruby/object:Gem::Requirement
46
- requirements:
47
- - - "~>"
48
- - !ruby/object:Gem::Version
49
- version: '0.1'
50
- type: :development
51
- prerelease: false
52
- version_requirements: !ruby/object:Gem::Requirement
53
- requirements:
54
- - - "~>"
55
- - !ruby/object:Gem::Version
56
- version: '0.1'
57
- - !ruby/object:Gem::Dependency
58
- name: bake-test-external
59
- requirement: !ruby/object:Gem::Requirement
60
- requirements:
61
- - - "~>"
62
- - !ruby/object:Gem::Version
63
- version: '0.1'
64
- type: :development
65
- prerelease: false
66
- version_requirements: !ruby/object:Gem::Requirement
67
- requirements:
68
- - - "~>"
69
- - !ruby/object:Gem::Version
70
- version: '0.1'
71
- - !ruby/object:Gem::Dependency
72
- name: covered
73
- requirement: !ruby/object:Gem::Requirement
74
- requirements:
75
- - - "~>"
76
- - !ruby/object:Gem::Version
77
- version: '0.18'
78
- type: :development
79
- prerelease: false
80
- version_requirements: !ruby/object:Gem::Requirement
81
- requirements:
82
- - - "~>"
83
- - !ruby/object:Gem::Version
84
- version: '0.18'
41
+ date: 2023-07-21 00:00:00.000000000 Z
42
+ dependencies: []
85
43
  description:
86
44
  email:
87
45
  executables:
@@ -155,14 +113,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
155
113
  requirements:
156
114
  - - ">="
157
115
  - !ruby/object:Gem::Version
158
- version: 2.7.0
116
+ version: '3.0'
159
117
  required_rubygems_version: !ruby/object:Gem::Requirement
160
118
  requirements:
161
119
  - - ">="
162
120
  - !ruby/object:Gem::Version
163
121
  version: '0'
164
122
  requirements: []
165
- rubygems_version: 3.4.7
123
+ rubygems_version: 3.4.10
166
124
  signing_key:
167
125
  specification_version: 4
168
126
  summary: A fast and scalable test runner.
metadata.gz.sig CHANGED
Binary file