minitest-keyword 1.0.2 → 2.0.0

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: 70d8098146612cfca7688027b68ad119cec7304cf2d57e4a53917d1c6768de4b
4
- data.tar.gz: e42b3dc2b49e40ce56fd354cba7bf00de356c9204e9e4bdf1819db86ad47a9d3
3
+ metadata.gz: 4b569537ff4f2eacfd9b0e3dfdbb4ba8d0864eed8e3c3c0fab016ab865c308c2
4
+ data.tar.gz: e77fefde1103684177cbcd645cde4eb74d1002ecbf7ec6cd3cb9752ff4af90ac
5
5
  SHA512:
6
- metadata.gz: bfbf23bf6c7e1d70c39b67280c48eb5384133af034f6da161a4fd1e7dc6a8bf9cf1661d73eee722779cad1a755e743f1490c01d1a51584340697a87dcca7719e
7
- data.tar.gz: 96ee9c50998942a3b4f9f3c7f2dca57b9373efe73d13899866c8e1ba3eb6f68e3e3f954b34bd4125dca89dace6edf4e42df6d7e93b47eaba3cae68270586e913
6
+ metadata.gz: 8cee286ebf8de7e7c68695604998ce3bd93a9451d7eb1a52eb69489a000b3a5220ba46b404e81a59ac65877eb46e62ec9343f8e8bd0339b1cde92c4480b43678
7
+ data.tar.gz: 35ad6969492e0bb920897e0b2e85d0e415be703c98f0d5f30fbdda8100877f4a402880aac9958e93ef6ca0532d8be2780f8eb23f3b970d0da8939b878338e7ce
@@ -14,10 +14,11 @@ jobs:
14
14
  - uses: actions/checkout@master
15
15
  - uses: ruby/setup-ruby@v1
16
16
  with:
17
- ruby-version: '3.2'
17
+ ruby-version: '3.3'
18
18
  bundler-cache: true
19
19
  - name: Lint and test
20
20
  run: |
21
21
  bundle exec rake stree:check
22
22
  bundle exec rubocop --parallel
23
23
  bundle exec rake test
24
+ bin/readme
data/CHANGELOG.md CHANGED
@@ -6,7 +6,15 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
- ## [1.0.2] - 2024-01-23
9
+ ## [2.0.0] - 2024-01-23
10
+
11
+ ### Changed
12
+
13
+ - `assert_send` is no longer decorated, since it is deprecated.
14
+ - `assert_operator` and `refute_operator` have changed their keywords from `o1`, `op`, and `o2` to `receiver`, `operator`, and `argument`, respectively.
15
+ - `assert_predicate` and `refute_predicate` have changed their keywords from `o1` and `op` to `receiver` and `operator`, respectively.
16
+
17
+ ## [1.0.2] - 2024-01-12
10
18
 
11
19
  ### Changed
12
20
 
@@ -24,7 +32,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
24
32
 
25
33
  - The name of the underlying parameter changed for `assert_in_epsilon` from `a` and `b` to `exp` and `act`. As such, in order to normalize, those were aliased to `expected` and `actual` as well.
26
34
 
27
- [unreleased]: https://github.com/kddnewton/minitest-keyword/compare/v1.0.2...HEAD
35
+ [unreleased]: https://github.com/kddnewton/minitest-keyword/compare/v2.0.0...HEAD
36
+ [2.0.0]: https://github.com/kddnewton/minitest-keyword/compare/v1.0.2...v2.0.0
28
37
  [1.0.2]: https://github.com/kddnewton/minitest-keyword/compare/v1.0.1...v1.0.2
29
38
  [1.0.1]: https://github.com/kddnewton/minitest-keyword/compare/v1.0.0...v1.0.1
30
39
  [1.0.0]: https://github.com/kddnewton/minitest-keyword/compare/846f1f...v1.0.0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- minitest-keyword (1.0.2)
4
+ minitest-keyword (2.0.0)
5
5
  minitest (~> 5.0)
6
6
 
7
7
  GEM
@@ -11,9 +11,9 @@ GEM
11
11
  docile (1.4.0)
12
12
  json (2.7.1)
13
13
  language_server-protocol (3.17.0.3)
14
- minitest (5.21.1)
14
+ minitest (5.21.2)
15
15
  parallel (1.24.0)
16
- parser (3.3.0.3)
16
+ parser (3.3.0.4)
17
17
  ast (~> 2.4.1)
18
18
  racc
19
19
  prettier_print (1.2.1)
@@ -22,11 +22,11 @@ GEM
22
22
  rake (13.1.0)
23
23
  regexp_parser (2.9.0)
24
24
  rexml (3.2.6)
25
- rubocop (1.59.0)
25
+ rubocop (1.60.1)
26
26
  json (~> 2.3)
27
27
  language_server-protocol (>= 3.17.0)
28
28
  parallel (~> 1.10)
29
- parser (>= 3.2.2.4)
29
+ parser (>= 3.3.0.2)
30
30
  rainbow (>= 2.2.2, < 4.0)
31
31
  regexp_parser (>= 1.8, < 3.0)
32
32
  rexml (>= 3.2.5, < 4.0)
data/README.md CHANGED
@@ -45,18 +45,19 @@ The actual keyword method creation is done through introspection, but the equiva
45
45
  assert test:, message: nil
46
46
  assert_empty object:, message: nil
47
47
  assert_equal expected:, actual:, message: nil
48
- assert_in_delta expected:, actual:, delta:, message: nil
49
- assert_in_epsilon expected:, actual:, epsilon:, message: nil
48
+ assert_in_delta expected:, actual:, delta: 0.001, message: nil
49
+ assert_in_epsilon expected:, actual:, epsilon: 0.001, message: nil
50
50
  assert_includes collection:, object:, message: nil
51
51
  assert_instance_of class:, object:, message: nil
52
52
  assert_kind_of class:, object:, message: nil
53
53
  assert_match matcher:, object:, message: nil
54
54
  assert_nil object:, message: nil
55
- assert_operator o1:, op:, o2:, message: nil
56
- assert_output stdout:, stderr:
57
- assert_predicate o1:, op:, message: nil
58
- assert_raises expected:
59
- assert_respond_to object:, method:, message: nil
55
+ assert_operator receiver:, operator:, argument: UNDEFINED, message: nil
56
+ assert_output stdout: nil, stderr: nil
57
+ assert_path_exists path:, message: nil
58
+ assert_predicate receiver:, operator:, message: nil
59
+ assert_raises expected: []
60
+ assert_respond_to object:, method:, message: nil, include_all: false
60
61
  assert_same expected:, actual:, message: nil
61
62
  assert_throws symbol:, message: nil
62
63
  ```
@@ -67,16 +68,17 @@ The associated refutations are also overridden, with the below signatures.
67
68
  refute test:, message: nil
68
69
  refute_empty object:, message: nil
69
70
  refute_equal expected:, actual:, message: nil
70
- refute_in_delta expected:, actual:, delta:, message: nil
71
- refute_in_epsilon expected:, actual:, epsilon:, message: nil
71
+ refute_in_delta expected:, actual:, delta: 0.001, message: nil
72
+ refute_in_epsilon expected:, actual:, epsilon: 0.001, message: nil
72
73
  refute_includes collection:, object:, message: nil
73
74
  refute_instance_of class:, object:, message: nil
74
75
  refute_kind_of class:, object:, message: nil
75
76
  refute_match matcher:, object:, message: nil
76
77
  refute_nil object:, message: nil
77
- refute_operator o1:, op:, o2:, message: nil
78
- refute_predicate o1:, op:, message: nil
79
- refute_respond_to object:, method:, message: nil
78
+ refute_operator receiver:, operator:, argument: UNDEFINED, message: nil
79
+ refute_path_exists path:, message: nil
80
+ refute_predicate receiver:, operator:, message: nil
81
+ refute_respond_to object:, method:, message: nil, include_all: false
80
82
  refute_same expected:, actual:, message: nil
81
83
  ```
82
84
 
data/bin/readme ADDED
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "minitest/keyword"
6
+
7
+ aliases = Hash.new { |hash, key| hash[key] = key }
8
+ aliases.merge!(Minitest::Keyword::ALIASES)
9
+
10
+ source = Minitest::Assertions
11
+ source.instance_methods.grep(/^(assert|refute)/).sort.each do |method_name|
12
+ method = source.instance_method(method_name)
13
+ parameters = method.parameters
14
+
15
+ next if parameters.empty? || method_name == :assert_send
16
+
17
+ iseq = RubyVM::InstructionSequence.of(method).to_a
18
+ opt_index = 0
19
+
20
+ values =
21
+ parameters.map do |(parameter_type, parameter_name)|
22
+ name = aliases[parameter_name]
23
+
24
+ case parameter_type
25
+ in :req
26
+ "#{name}:"
27
+ in :opt
28
+ stack = []
29
+ iseq[13][iseq[13].index(iseq[11][:opt][opt_index])..].each do |insn|
30
+ case insn
31
+ in Symbol | Integer
32
+ next
33
+ in [:opt_getconstant_path, path]
34
+ stack << path.join("::")
35
+ in [:putobject, object]
36
+ stack << object.inspect
37
+ in [:putnil]
38
+ stack << "nil"
39
+ in [/^setlocal/, Integer]
40
+ break
41
+ end
42
+ end
43
+
44
+ opt_index += 1
45
+ "#{name}: #{stack.pop}"
46
+ in :key
47
+ "#{name}: #{iseq[11][:keyword].assoc(parameter_name)[1]}"
48
+ in :rest
49
+ "#{name}: []"
50
+ end
51
+ end
52
+
53
+ puts "%-18s %s" % [method_name, values.join(", ")]
54
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Minitest
4
4
  module Keyword
5
- VERSION = "1.0.2"
5
+ VERSION = "2.0.0"
6
6
  end
7
7
  end
@@ -17,6 +17,9 @@ module Minitest
17
17
  meth: :method,
18
18
  msg: :message,
19
19
  obj: :object,
20
+ op: :operator,
21
+ o1: :receiver,
22
+ o2: :argument,
20
23
  sym: :symbol
21
24
  }.freeze
22
25
 
@@ -47,7 +50,7 @@ module Minitest
47
50
  .grep(/assert|refute/)
48
51
  .each do |method_name|
49
52
  parameters = Assertions.instance_method(method_name).parameters
50
- next if parameters.empty?
53
+ next if parameters.empty? || method_name == :assert_send
51
54
 
52
55
  define_method(method_name) do |*args, **kwargs, &block|
53
56
  passed_args = []
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-keyword
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Newton
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-01-12 00:00:00.000000000 Z
11
+ date: 2024-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -114,6 +114,7 @@ files:
114
114
  - README.md
115
115
  - Rakefile
116
116
  - bin/console
117
+ - bin/readme
117
118
  - bin/setup
118
119
  - lib/minitest/keyword.rb
119
120
  - lib/minitest/keyword/version.rb
@@ -123,7 +124,7 @@ licenses:
123
124
  - MIT
124
125
  metadata:
125
126
  bug_tracker_uri: https://github.com/kddnewton/minitest-keyword/issues
126
- changelog_uri: https://github.com/kddnewton/minitest-keyword/blob/v1.0.2/CHANGELOG.md
127
+ changelog_uri: https://github.com/kddnewton/minitest-keyword/blob/v2.0.0/CHANGELOG.md
127
128
  source_code_uri: https://github.com/kddnewton/minitest-keyword
128
129
  rubygems_mfa_required: 'true'
129
130
  post_install_message: