parameterized_testing 0.2.0 → 1.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1338c0068efe487efdfbebcd74a333b124ade9f650b32bb95bbafb89c58cd902
4
- data.tar.gz: 7767f2a41cbe53eeffc2f20a28930eb323c13b7d7366c4ce10a37d64d66daf13
3
+ metadata.gz: 4ac040fafe4e49c4d604aafa09159f3d6ea4d0cb801f80f53b17fa37e2a17ad0
4
+ data.tar.gz: 47a4dfbb70f253e4c6b594c862d9cded03844f66e88e2e8bb31dab305587112d
5
5
  SHA512:
6
- metadata.gz: 4c54e9ebf7945ffd4b721ff71085dbe25e2059e8424fb68d0c5b5786006a1f437769a467fa3409f8355784659e5e92fdf7add45d0f0b321ef7c773e73e052db0
7
- data.tar.gz: 6e78907450a1555e590e19758c2387f1ca9ee5927133dd0c1f4002bbd5eddc15095c542a7c154dc45ae138b1bee92270025e87dc4283ff40c31c4cad40d3e754
6
+ metadata.gz: f89846d6843b254c8dad150713124cfdd9b4d0f141d7df3051a930076a05b1266c0ca52cb6d112c8bef588ae82ff4381ddf6dd9ab904f5c9cee8ff2f88919fdc
7
+ data.tar.gz: e39ee9330c7a83d10c90a216b370d085beaeb46581445b760cfc462fc4cd5cfaa12f9b93996f4ba517af73ef81fd61314529cc5074c0277dd066e62ebf6c5461
@@ -9,17 +9,20 @@ module ParameterizedTesting
9
9
  attr_reader :location
10
10
  # @return [Proc] the block to compute the value of this input
11
11
  attr_reader :initializer
12
+ # @return [String, nil] description of the input
13
+ attr_reader :description
12
14
 
13
- def initialize(index:, location:, initializer:)
15
+ def initialize(index:, location:, initializer:, description:)
14
16
  @index = index
15
17
  @location = location
16
18
  @initializer = initializer
19
+ @description = description
17
20
  end
18
21
 
19
- # Gets a human-readable label string.
22
+ # Returns a human-readable label string.
20
23
  # @return [String]
21
24
  def label
22
- "input[#{index}] at line #{location.lineno}"
25
+ "#{@description || "input[#{index}]"} (at line #{location.lineno})"
23
26
  end
24
27
 
25
28
  # Collects all <code>input { ... }</code> in a block.
@@ -39,11 +42,11 @@ module ParameterizedTesting
39
42
  @next_index = 0
40
43
  end
41
44
 
42
- def input(&initializer)
45
+ def input(description = nil, &initializer)
43
46
  index = @next_index
44
47
  @next_index += 1
45
48
  location = caller_locations(1, 1).first
46
- @inputs << Input.new(index:, location:, initializer:)
49
+ @inputs << Input.new(index:, location:, initializer:, description:)
47
50
  end
48
51
 
49
52
  def method_missing(_name, ...)
@@ -7,7 +7,7 @@ module ParameterizedTesting
7
7
  attr_reader :params
8
8
 
9
9
  def initialize(*params)
10
- raise ArgumentError, "parameter name must be a symbol" if params.any? { !_1.is_a?(Symbol) }
10
+ raise TypeError, "parameter name must be a symbol" if params.any? { !_1.is_a?(Symbol) }
11
11
  raise ArgumentError, "parameter names must be unique" if params.uniq.size != params.size
12
12
 
13
13
  @params = params
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ParameterizedTesting
4
- VERSION = "0.2.0"
4
+ VERSION = "1.0.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parameterized_testing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - yubrot
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-05-10 00:00:00.000000000 Z
11
+ date: 2024-11-22 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Parameterized testing utility
14
14
  email:
@@ -46,7 +46,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  requirements: []
49
- rubygems_version: 3.5.9
49
+ rubygems_version: 3.5.22
50
50
  signing_key:
51
51
  specification_version: 4
52
52
  summary: Parameterized testing utility