prop_check 0.18.2 → 1.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: 4c85d7bb545c99b3953f68f42a7e37e14b96ddde115b42670689aa7094dfef42
4
- data.tar.gz: efe151cb45c09d94d7e987d490096a321488832bc8d8041ab513ee64b71335d9
3
+ metadata.gz: d97039234e58c965b91cba40c589808d7ac1e4b559355fd4df719edb89f7b837
4
+ data.tar.gz: a87f0c2377918f4d05c6b1d06838b0581a01b21ddba4a1e74929e046cc33f5d0
5
5
  SHA512:
6
- metadata.gz: b5d180fe6141074ef202fba5c251a96492c2e5ad9706491ec615df1e5010c12623e3c5b53b8adaa5e75435df9ec48a464543672e33c81af4b18528da6f184860
7
- data.tar.gz: a4b2e62dee58f53bc291202cbae157119eba7858f24b70ea5eb8790e578eceb0f2b140c1e5707c68037fcc09c2dddd17f57970de45fb3271503322a4de25fe05
6
+ metadata.gz: 6821b9be704593dcf577c8b9e29191e731009358faf0f3f4405b8333e8246681cbc76327bbb4f74d9a748f255ba65e2379cdadf51b3fa601746f2db89ba5e906
7
+ data.tar.gz: 3aa1b4d7313e5713ec9a2960461f89b7b14f265dabe57fe8c5040ce99450f66a61280e903df50879176a5850c56e802d9650f4c952968ab69c5b0030c1349d74
@@ -15,8 +15,9 @@ jobs:
15
15
  runs-on: ubuntu-latest
16
16
  strategy:
17
17
  matrix:
18
- # NOTE: Ruby 3.2 is not in here, as `doctest-core` first needs to be updated to support it
19
- ruby-version: ['2.6', '2.7', '3.0', '3.1', '3.2']
18
+ # NOTE: We're stopping testing Ruby < 3.0 since prop_check version 1.0.0
19
+ # It will _probably_ still work but as they're end-of-life, no guarantees!
20
+ ruby-version: ['3.0', '3.1', '3.2']
20
21
 
21
22
  steps:
22
23
  - uses: actions/checkout@v3
data/.tool-versions CHANGED
@@ -1 +1 @@
1
- ruby 2.7.6
1
+ ruby 3.1.3
data/CHANGELOG.md CHANGED
@@ -1,7 +1,10 @@
1
+ - 1.0.0
2
+ - Changes:
3
+ - Pretty-print failures using Ruby's builtin `PP`, so `prop_check` no longer depends on the `awesome_print` gem. (c.f. #19)
1
4
  - 0.18.2
2
5
  - Documentation updates:
3
- - PR #18: Adding an example of using prop_check with the `test-unit` testing framework to the README. Thank you, @niku!
4
- - PR #17, #18, #21: fixing typos in various parts of the documentation. Thank you, @meganemura, @niku and @harlantwood!
6
+ - Adding an example of using prop_check with the `test-unit` testing framework to the README. (c.f. #18, thank you, @niku!)
7
+ - Fixing typos in various parts of the documentation. (c.f. #16, #17, #21. Thank you, @meganemura, @niku and @harlantwood!)
5
8
  - 0.18.1
6
9
  - Fixes:
7
10
  - Compatibility with Ruby 3.2:
data/README.md CHANGED
@@ -5,7 +5,7 @@ PropCheck allows you to do Property Testing in Ruby.
5
5
  [![Gem](https://img.shields.io/gem/v/prop_check.svg)](https://rubygems.org/gems/prop_check)
6
6
  [![Ruby RSpec tests build status](https://github.com/Qqwy/ruby-prop_check/actions/workflows/run_tests.yaml/badge.svg)](https://github.com/Qqwy/ruby-prop_check/actions/workflows/run_tests.yaml)
7
7
  [![Maintainability](https://api.codeclimate.com/v1/badges/71897f5e6193a5124a53/maintainability)](https://codeclimate.com/github/Qqwy/ruby-prop_check/maintainability)
8
- [![RubyDoc](https://img.shields.io/badge/%F0%9F%93%9ARubyDoc-documentation-informational.svg)](https://www.rubydoc.info/github/Qqwy/ruby-prop_check/master/)
8
+ [![RubyDoc](https://img.shields.io/badge/%F0%9F%93%9ARubyDoc-documentation-informational.svg)](https://www.rubydoc.info/github/Qqwy/ruby-prop_check/main/)
9
9
 
10
10
  It features:
11
11
 
@@ -14,6 +14,8 @@ It features:
14
14
  - Shrinking to a minimal counter-example on failure.
15
15
  - Hooks to perform extra set-up/cleanup logic before/after every example case.
16
16
 
17
+ It requires _no_ external dependencies, and integrates well with all common test frameworks (see below).
18
+
17
19
  ## What is PropCheck?
18
20
 
19
21
  PropCheck is a Ruby library to create unit tests which are simpler to write and more powerful when run, finding edge-cases in your code you wouldn't have thought to look for.
@@ -218,16 +220,15 @@ For instance, when a failure happens with the input `x = 100`,
218
220
  PropCheck will see if the failure still happens with `x = 50`.
219
221
  If it does , it will try `x = 25`. If not, it will try `x = 75`, and so on.
220
222
 
221
- This means if something only goes wrong for `x = 2`, the program will try:
223
+ This means for example that if something only goes for wrong for `x >= 8`, the program will try:
222
224
  - `x = 100`(fails),
223
225
  - `x = 50`(fails),
224
226
  - `x = 25`(fails),
225
227
  - `x = 12`(fails),
226
- - `x = 6`(fails),
227
- - `x = 3`(fails),
228
- - `x = 1` (succeeds), `x = 2` (fails).
228
+ - `x = 6`(succeeds), `x = 9` (fails)
229
+ - `x = 7`(succeeds), `x = 8` (fails).
229
230
 
230
- and thus the simplified case of `x = 2` is shown in the output.
231
+ and thus the simplified case of `x = 8` is shown in the output.
231
232
 
232
233
  The documentation of the provided generators explain how they shrink.
233
234
  A short summary:
@@ -239,7 +240,7 @@ A short summary:
239
240
 
240
241
  ### Builtin Generators
241
242
 
242
- PropCheck comes with [many builtin generators in the PropCheck::Generators](https://www.rubydoc.info/github/Qqwy/ruby-prop_check/master/PropCheck/Generators) module.
243
+ PropCheck comes with [many builtin generators in the PropCheck::Generators](https://www.rubydoc.info/github/Qqwy/ruby-prop_check/main/PropCheck/Generators) module.
243
244
 
244
245
  It contains generators for:
245
246
  - (any, positive, negative, etc.) integers,
@@ -305,8 +306,8 @@ you can use `Generators.frequency` which takes a hash of (integer_frequency => g
305
306
  There are even more functions in the `Generator` class and the `Generators` module that you might want to use,
306
307
  although above are the most generally useful ones.
307
308
 
308
- [PropCheck::Generator documentation](https://www.rubydoc.info/github/Qqwy/ruby-prop_check/master/PropCheck/Generator)
309
- [PropCheck::Generators documentation](https://www.rubydoc.info/github/Qqwy/ruby-prop_check/master/PropCheck/Generators)
309
+ [PropCheck::Generator documentation](https://www.rubydoc.info/github/Qqwy/ruby-prop_check/main/PropCheck/Generator)
310
+ [PropCheck::Generators documentation](https://www.rubydoc.info/github/Qqwy/ruby-prop_check/main/PropCheck/Generators)
310
311
 
311
312
 
312
313
  ## Usage within Rails / with a database
@@ -348,7 +349,7 @@ The gem is available as open source under the terms of the [MIT License](https:/
348
349
 
349
350
  ## Code of Conduct
350
351
 
351
- Everyone interacting in the PropCheck project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/Qqwy/ruby-prop_check/blob/master/CODE_OF_CONDUCT.md).
352
+ Everyone interacting in the PropCheck project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/Qqwy/ruby-prop_check/blob/main/CODE_OF_CONDUCT.md).
352
353
 
353
354
  ## Attribution and Thanks
354
355
 
@@ -1,5 +1,7 @@
1
1
  ##
2
2
  # @api private
3
+ require 'pp'
4
+
3
5
  module PropCheck::Property::OutputFormatter
4
6
  extend self
5
7
 
@@ -32,10 +34,13 @@ module PropCheck::Property::OutputFormatter
32
34
  end
33
35
 
34
36
  def print_roots(lazy_tree_val)
35
- if lazy_tree_val.is_a?(Array) && lazy_tree_val.length == 1 && lazy_tree_val[0].is_a?(Hash)
36
- lazy_tree_val[0].ai
37
- else
38
- lazy_tree_val.ai
39
- end
37
+ data =
38
+ if lazy_tree_val.is_a?(Array) && lazy_tree_val.length == 1 && lazy_tree_val[0].is_a?(Hash)
39
+ lazy_tree_val[0]
40
+ else
41
+ lazy_tree_val
42
+ end
43
+
44
+ PP.pp(data, '')
40
45
  end
41
46
  end
@@ -1,5 +1,4 @@
1
1
  require 'stringio'
2
- require 'amazing_print'
3
2
 
4
3
  require 'prop_check/property/configuration'
5
4
  require 'prop_check/property/output_formatter'
@@ -1,3 +1,3 @@
1
1
  module PropCheck
2
- VERSION = '0.18.2'
2
+ VERSION = '1.0.0'
3
3
  end
data/prop_check.gemspec CHANGED
@@ -6,7 +6,7 @@ require "prop_check/version"
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "prop_check"
8
8
  spec.version = PropCheck::VERSION
9
- spec.authors = ["Qqwy/Wiebe-Marten Wijnja"]
9
+ spec.authors = ["Qqwy/Marten Wijnja"]
10
10
  spec.email = ["w-m@wmcode.nl"]
11
11
 
12
12
  spec.summary = %q{PropCheck allows you to do property-based testing, including shrinking.}
@@ -35,6 +35,4 @@ Gem::Specification.new do |spec|
35
35
  spec.require_paths = ["lib"]
36
36
 
37
37
  spec.required_ruby_version = '>= 2.5.1'
38
-
39
- spec.add_dependency 'amazing_print', '~> 1.2'
40
38
  end
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prop_check
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.2
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
- - Qqwy/Wiebe-Marten Wijnja
8
- autorequire:
7
+ - Qqwy/Marten Wijnja
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
11
  date: 2024-02-17 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: amazing_print
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.2'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.2'
12
+ dependencies: []
27
13
  description: PropCheck allows you to do property-based testing, including shrinking.
28
14
  (akin to Haskell's QuickCheck, Erlang's PropEr, Elixir's StreamData). This means
29
15
  that your test are run many times with different, autogenerated inputs, and as soon
@@ -69,7 +55,7 @@ metadata:
69
55
  homepage_uri: https://github.com/Qqwy/ruby-prop_check/
70
56
  source_code_uri: https://github.com/Qqwy/ruby-prop_check/
71
57
  changelog_uri: https://github.com/Qqwy/ruby-prop_check/CHANGELOG.md
72
- post_install_message:
58
+ post_install_message:
73
59
  rdoc_options: []
74
60
  require_paths:
75
61
  - lib
@@ -84,8 +70,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
70
  - !ruby/object:Gem::Version
85
71
  version: '0'
86
72
  requirements: []
87
- rubygems_version: 3.1.6
88
- signing_key:
73
+ rubygems_version: 3.3.26
74
+ signing_key:
89
75
  specification_version: 4
90
76
  summary: PropCheck allows you to do property-based testing, including shrinking.
91
77
  test_files: []