From 2d5b5c7c747dace3cd3cc924823e96505be880b2 Mon Sep 17 00:00:00 2001 From: bbrucezhang Date: Wed, 21 May 2025 14:36:04 +0800 Subject: [PATCH] Upgrade to version 6.104.2, Remove the hypothesis ruby directory --- ...Remove-the-hypothesis-ruby-directory.patch | 3540 +++++++++++++++++ python-hypothesis.spec | 9 +- sources | 2 +- 3 files changed, 3548 insertions(+), 3 deletions(-) create mode 100644 5001-Remove-the-hypothesis-ruby-directory.patch diff --git a/5001-Remove-the-hypothesis-ruby-directory.patch b/5001-Remove-the-hypothesis-ruby-directory.patch new file mode 100644 index 0000000..dce3d6a --- /dev/null +++ b/5001-Remove-the-hypothesis-ruby-directory.patch @@ -0,0 +1,3540 @@ +From 4dd1975f7da6962b29c1e0a733292e0277043e92 Mon Sep 17 00:00:00 2001 +From: bbrucezhang +Date: Wed, 21 May 2025 11:22:47 +0800 +Subject: [PATCH] Remove the hypothesis-ruby directory + +--- + hypothesis-ruby/.gitignore | 13 - + hypothesis-ruby/.rspec | 2 - + hypothesis-ruby/.rubocop.yml | 30 -- + hypothesis-ruby/.ruby-version | 1 - + hypothesis-ruby/CHANGELOG.md | 143 ----- + hypothesis-ruby/Cargo.toml | 14 - + hypothesis-ruby/Gemfile | 17 - + hypothesis-ruby/Gemfile.lock | 68 --- + hypothesis-ruby/LICENSE.txt | 8 - + hypothesis-ruby/README.markdown | 86 --- + hypothesis-ruby/Rakefile | 111 ---- + hypothesis-ruby/docs/debt.md | 92 ---- + hypothesis-ruby/docs/design.md | 123 ----- + hypothesis-ruby/ext/Makefile | 7 - + hypothesis-ruby/ext/extconf.rb | 5 - + hypothesis-ruby/hypothesis-specs.gemspec | 21 - + hypothesis-ruby/lib/hypothesis.rb | 286 ---------- + hypothesis-ruby/lib/hypothesis/engine.rb | 109 ---- + hypothesis-ruby/lib/hypothesis/errors.rb | 61 --- + hypothesis-ruby/lib/hypothesis/junkdrawer.rb | 31 -- + hypothesis-ruby/lib/hypothesis/possible.rb | 370 ------------- + hypothesis-ruby/lib/hypothesis/testcase.rb | 46 -- + hypothesis-ruby/lib/hypothesis/world.rb | 9 - + .../minitests/test_multiple_failures.rb | 29 -- + .../minitests/test_stable_identifier.rb | 12 - + hypothesis-ruby/scripts/run-tests-isolated.sh | 22 - + hypothesis-ruby/secrets.tar.enc | Bin 10256 -> 0 bytes + hypothesis-ruby/spec/arrays_spec.rb | 15 - + hypothesis-ruby/spec/backtrace_spec.rb | 20 - + hypothesis-ruby/spec/bad_usage_spec.rb | 35 -- + hypothesis-ruby/spec/basic_examples_spec.rb | 51 -- + hypothesis-ruby/spec/boolean_spec.rb | 13 - + hypothesis-ruby/spec/choice_spec.rb | 19 - + hypothesis-ruby/spec/database_spec.rb | 67 --- + hypothesis-ruby/spec/debug_spec.rb | 14 - + .../spec/example_discovery_spec.rb | 13 - + hypothesis-ruby/spec/example_printing_spec.rb | 73 --- + .../spec/example_shrinking_spec.rb | 63 --- + hypothesis-ruby/spec/hashes_spec.rb | 25 - + hypothesis-ruby/spec/integer_spec.rb | 31 -- + hypothesis-ruby/spec/mixing_spec.rb | 17 - + .../spec/multiple_failures_spec.rb | 42 -- + .../spec/phase_specification_spec.rb | 33 -- + hypothesis-ruby/spec/provided_list_spec.rb | 28 - + hypothesis-ruby/spec/spec_helper.rb | 120 ----- + .../spec/stable_identifier_spec.rb | 22 - + hypothesis-ruby/spec/strings_spec.rb | 35 -- + hypothesis-ruby/src/lib.rs | 492 ------------------ + 48 files changed, 2944 deletions(-) + delete mode 100644 hypothesis-ruby/.gitignore + delete mode 100644 hypothesis-ruby/.rspec + delete mode 100644 hypothesis-ruby/.rubocop.yml + delete mode 100644 hypothesis-ruby/.ruby-version + delete mode 100644 hypothesis-ruby/CHANGELOG.md + delete mode 100644 hypothesis-ruby/Cargo.toml + delete mode 100644 hypothesis-ruby/Gemfile + delete mode 100644 hypothesis-ruby/Gemfile.lock + delete mode 100644 hypothesis-ruby/LICENSE.txt + delete mode 100644 hypothesis-ruby/README.markdown + delete mode 100644 hypothesis-ruby/Rakefile + delete mode 100644 hypothesis-ruby/docs/debt.md + delete mode 100644 hypothesis-ruby/docs/design.md + delete mode 100644 hypothesis-ruby/ext/Makefile + delete mode 100644 hypothesis-ruby/ext/extconf.rb + delete mode 100644 hypothesis-ruby/hypothesis-specs.gemspec + delete mode 100644 hypothesis-ruby/lib/hypothesis.rb + delete mode 100644 hypothesis-ruby/lib/hypothesis/engine.rb + delete mode 100644 hypothesis-ruby/lib/hypothesis/errors.rb + delete mode 100644 hypothesis-ruby/lib/hypothesis/junkdrawer.rb + delete mode 100644 hypothesis-ruby/lib/hypothesis/possible.rb + delete mode 100644 hypothesis-ruby/lib/hypothesis/testcase.rb + delete mode 100644 hypothesis-ruby/lib/hypothesis/world.rb + delete mode 100644 hypothesis-ruby/minitests/test_multiple_failures.rb + delete mode 100644 hypothesis-ruby/minitests/test_stable_identifier.rb + delete mode 100755 hypothesis-ruby/scripts/run-tests-isolated.sh + delete mode 100644 hypothesis-ruby/secrets.tar.enc + delete mode 100644 hypothesis-ruby/spec/arrays_spec.rb + delete mode 100644 hypothesis-ruby/spec/backtrace_spec.rb + delete mode 100644 hypothesis-ruby/spec/bad_usage_spec.rb + delete mode 100644 hypothesis-ruby/spec/basic_examples_spec.rb + delete mode 100644 hypothesis-ruby/spec/boolean_spec.rb + delete mode 100644 hypothesis-ruby/spec/choice_spec.rb + delete mode 100644 hypothesis-ruby/spec/database_spec.rb + delete mode 100644 hypothesis-ruby/spec/debug_spec.rb + delete mode 100644 hypothesis-ruby/spec/example_discovery_spec.rb + delete mode 100644 hypothesis-ruby/spec/example_printing_spec.rb + delete mode 100644 hypothesis-ruby/spec/example_shrinking_spec.rb + delete mode 100644 hypothesis-ruby/spec/hashes_spec.rb + delete mode 100644 hypothesis-ruby/spec/integer_spec.rb + delete mode 100644 hypothesis-ruby/spec/mixing_spec.rb + delete mode 100644 hypothesis-ruby/spec/multiple_failures_spec.rb + delete mode 100644 hypothesis-ruby/spec/phase_specification_spec.rb + delete mode 100644 hypothesis-ruby/spec/provided_list_spec.rb + delete mode 100644 hypothesis-ruby/spec/spec_helper.rb + delete mode 100644 hypothesis-ruby/spec/stable_identifier_spec.rb + delete mode 100644 hypothesis-ruby/spec/strings_spec.rb + delete mode 100644 hypothesis-ruby/src/lib.rs + +diff --git a/hypothesis-ruby/.gitignore b/hypothesis-ruby/.gitignore +deleted file mode 100644 +index 2cd5000..0000000 +--- a/hypothesis-ruby/.gitignore ++++ /dev/null +@@ -1,13 +0,0 @@ +-*.sw* +-spec/examples.txt +-target/ +-**/*.rs.bk +-Cargo.lock +-*.so +-coverage +-.yardoc +-isolated +-doc +-*.gem +-secrets +-secrets.tar +diff --git a/hypothesis-ruby/.rspec b/hypothesis-ruby/.rspec +deleted file mode 100644 +index 3687797..0000000 +--- a/hypothesis-ruby/.rspec ++++ /dev/null +@@ -1,2 +0,0 @@ +---require spec_helper +---color +diff --git a/hypothesis-ruby/.rubocop.yml b/hypothesis-ruby/.rubocop.yml +deleted file mode 100644 +index 5d977ee..0000000 +--- a/hypothesis-ruby/.rubocop.yml ++++ /dev/null +@@ -1,30 +0,0 @@ +-Metrics/BlockLength: +- ExcludedMethods: ['describe', 'context'] +-Documentation: +- Enabled: false +-Metrics/MethodLength: +- Enabled: false +-Metrics/CyclomaticComplexity: +- Enabled: false +-Metrics/PerceivedComplexity: +- Enabled: false +-Metrics/AbcSize: +- Enabled: false +-Lint/RescueException: +- Enabled: false +-Style/MixinUsage: +- Enabled: false +-Style/MultilineBlockChain: +- Enabled: false +-Style/MethodMissing: +- Enabled: false +-Style/MultilineBlockChain: +- Enabled: false +-Metrics/ModuleLength: +- Enabled: false +-Metrics/BlockLength: +- Enabled: false +-Lint/HandleExceptions: +- Enabled: false +-Style/GuardClause: +- Enabled: false +diff --git a/hypothesis-ruby/.ruby-version b/hypothesis-ruby/.ruby-version +deleted file mode 100644 +index 8e8299d..0000000 +--- a/hypothesis-ruby/.ruby-version ++++ /dev/null +@@ -1 +0,0 @@ +-2.4.2 +diff --git a/hypothesis-ruby/CHANGELOG.md b/hypothesis-ruby/CHANGELOG.md +deleted file mode 100644 +index 8602f75..0000000 +--- a/hypothesis-ruby/CHANGELOG.md ++++ /dev/null +@@ -1,143 +0,0 @@ +-# Hypothesis for Ruby 0.7.1 (2021-03-27) +- +-This patch fixes some internal typos. There is no user-visible change. +- +-# Hypothesis for Ruby 0.7.0 (2021-03-12) +- +-Moves rake from being a a runtime dependency to being a development dependency. Rake is used to run tests but is not required for consumers of hypothesis-ruby. +- +-# Hypothesis for Ruby 0.6.1 (2021-02-01) +- +-This patch contains minor performance improvements for `HypothesisCoreIntegers` class instantiation. +- +-# Hypothesis for Ruby 0.6.0 (2021-01-27) +- +-Adds support for skipping shrinking. While shrinking is extremely helpful and important in general, it has the potential to be quite time consuming. It can be useful to observe a raw failure before choosing to allow the engine to try to shrink. [hypothesis-python](https://hypothesis.readthedocs.io/en/latest/settings.html#phases) already provides the ability to skip shrinking, so there is precedent for this being useful. While `hypothesis-ruby` does not have the concept of other "Phases" yet, we can still start off the API by using this concept. +- +-Usage: +- +-``` +-hypothesis(phases: Phase.excluding(:shrink)) do +- # Failures here will be displayed directly and shrinking will be avoided +-end +-``` +- +-# Hypothesis for Ruby 0.5.0 (2021-01-25) +- +-Adds support for skipping shrinking. While shrinking is extremely helpful and important in general, it has the potential to be quite time consuming. It can be useful to observe a raw failure before choosing to allow the engine to try to shrink. [hypothesis-python](https://hypothesis.readthedocs.io/en/latest/settings.html#phases) already provides the ability to skip shrinking, so there is precedent for this being useful. While `hypothesis-ruby` does not have the concept of other "Phases" yet, we can still start off the API by using this concept. +- +-Usage: +- +-``` +-hypothesis(phases: Phase.excluding(:shrink)) do +- # Failures here will be displayed directly and shrinking will be avoided +-end +-``` +- +-# Hypothesis for Ruby 0.4.0 (2021-01-12) +- +-This removes hypothesis-ruby's dependence on RSpec. Now, it can be used with any Ruby test runner. +- +-# Hypothesis for Ruby 0.3.0 (2021-01-08) +- +-This release converts Hypothesis for Ruby to use [RuTie](https://github.com/danielpclark/rutie) +-instead of the deprecated [Helix](https://github.com/tildeio/helix), restoring compatibility +-with recent versions of Rust. Thanks to Alex Weisberger for taking this on! +- +-# Hypothesis for Ruby 0.2.0 (2018-10-24) +- +-This release adds an example database to Hypothesis for Ruby. This means that when a test fails, +-it will automatically reuse the previously shown example when you rerun it, without having to +-manually pass a seed. +- +-# Hypothesis for Ruby 0.1.2 (2018-09-24) +- +-This release makes the code usable via a direct require. +-I.e. no need for rubygems or any special LOAD_PATH. +- +-For example, if the base directory were in /opt, you'd just say: +-require "/opt/hypothesis/hypothesis-ruby/lib/hypothesis" +- +-# Hypothesis for Ruby 0.1.1 (2018-08-31) +- +-This release fixes minor documentation issues. +- +-Thanks to Tessa Bradbury for this contribution. +- +-# Hypothesis for Ruby 0.1.0 (2018-07-16) +- +-This release adds support for reporting multiple exceptions when Hypothesis +-finds more than one way for the test to fail. +- +-# Hypothesis for Ruby 0.0.15 (2018-06-25) +- +-This release fixes an occasional `RuntimeError` that could occur +-when shrinking a failing test. +- +-# Hypothesis for Ruby 0.0.14 (2018-06-25) +- +-This release updates the release date to the correct date, as part of fixing a +-bug which caused the last couple of releases (0.0.11, 0.0.12, and 0.0.13) to +-have an incorrect date. +- +-# Hypothesis for Ruby 0.0.13 (2018-06-25) +- +-This release moves the core Rust engine into the separate Conjecture crate. It +-should have no user visible effect. +- +-# Hypothesis for Ruby 0.0.12 (2018-06-23) +- +-This release is the beginning of splitting out the Rust core of Hypothesis +-Ruby into a separate `conjecture` crate for the non-Ruby-specific components +-of it. +- +-It should have no user visible impact. +- +-# Hypothesis for Ruby 0.0.11 (2018-06-22) +- +-This release has no user-visible changes other than updating the gemspec's +-homepage attribute. +- +-## Hypothesis for Ruby 0.0.10 (2018-04-26) +- +-This release is another update to shrinking: +- +-* Cases where the value may be simplified without necessarily +- becoming smaller will have better results. +-* Duplicated values can now sometimes be simultaneously shrunk. +- +-## Hypothesis for Ruby 0.0.9 (2018-04-20) +- +-This improves Hypothesis for Ruby's shrinking to be much closer +-to Hypothesis for Python's. It's still far from complete, and even +-in cases where it has the same level of quality it will often be +-significantly slower, but examples should now be much more consistent, +-especially in cases where you are using e.g. `built_as`. +- +-## Hypothesis for Ruby 0.0.8 (2018-02-20) +- +-This release fixes the dependency on Rake to be in a more sensible range. +- +-## Hypothesis for Ruby 0.0.7 (2018-02-19) +- +-This release updates an error in the README. +- +-## Hypothesis for Ruby 0.0.6 (2018-02-19) +- +-This release just updates the gem description. +- +-## Hypothesis for Ruby 0.0.5 (2018-02-19) +- +-This is a trivial release to test the release automation. +-It should have no user visible impact. +- +-## Hypothesis for Ruby 0.0.3 (2018-02-19) +- +-This is an initial developer preview of Hypothesis for Ruby. +-It's ready to use, but isn't yet stable and has significant +-limitations. It is mostly released so that people can easily give +-feedback on the API and implementation, and is likely to change +-substantially before a stable release. +- +-Note that while there were some earlier release numbers internally, +-these were pulled. This is the first official release. +diff --git a/hypothesis-ruby/Cargo.toml b/hypothesis-ruby/Cargo.toml +deleted file mode 100644 +index 803603f..0000000 +--- a/hypothesis-ruby/Cargo.toml ++++ /dev/null +@@ -1,14 +0,0 @@ +-[package] +-name = "hypothesis-ruby" +-version = "0.1.0" +-authors = ["David R. MacIver ", "Alex Weisberger "] +- +-[lib] +-name="hypothesis_ruby_core" +-crate-type = ["cdylib"] +- +-[dependencies] +-rutie = {version="0.8.1"} +-lazy_static = "1.4.0" +-rand = '0.3' +-conjecture = { path = '../conjecture-rust' } +diff --git a/hypothesis-ruby/Gemfile b/hypothesis-ruby/Gemfile +deleted file mode 100644 +index 3fda5e2..0000000 +--- a/hypothesis-ruby/Gemfile ++++ /dev/null +@@ -1,17 +0,0 @@ +-# frozen_string_literal: true +- +-source 'https://rubygems.org' +- +-gemspec +- +-gem 'rubocop', '~> 0.51.0' +-gem 'simplecov', '~> 0.15.1' +-gem 'yard', '~> 0.9.12' +-gem 'rake', '>= 10.0', '< 14.0' +-gem 'redcarpet', '~> 3.4.0' +-gem 'rutie', '~> 0.0.3' +-gem 'minitest', '~> 5.8.4' +- +-group(:rspec) do +- gem 'rspec', '~> 3.0' +-end +diff --git a/hypothesis-ruby/Gemfile.lock b/hypothesis-ruby/Gemfile.lock +deleted file mode 100644 +index 4ebefcf..0000000 +--- a/hypothesis-ruby/Gemfile.lock ++++ /dev/null +@@ -1,68 +0,0 @@ +-PATH +- remote: . +- specs: +- hypothesis-specs (0.7.0) +- rutie (~> 0.0.3) +- +-GEM +- remote: https://rubygems.org/ +- specs: +- ast (2.4.0) +- diff-lcs (1.3) +- docile (1.1.5) +- json (2.1.0) +- minitest (5.8.5) +- parallel (1.12.1) +- parser (2.5.1.0) +- ast (~> 2.4.0) +- powerpack (0.1.1) +- rainbow (2.2.2) +- rake +- rake (12.3.1) +- redcarpet (3.4.0) +- rspec (3.7.0) +- rspec-core (~> 3.7.0) +- rspec-expectations (~> 3.7.0) +- rspec-mocks (~> 3.7.0) +- rspec-core (3.7.1) +- rspec-support (~> 3.7.0) +- rspec-expectations (3.7.0) +- diff-lcs (>= 1.2.0, < 2.0) +- rspec-support (~> 3.7.0) +- rspec-mocks (3.7.0) +- diff-lcs (>= 1.2.0, < 2.0) +- rspec-support (~> 3.7.0) +- rspec-support (3.7.1) +- rubocop (0.51.0) +- parallel (~> 1.10) +- parser (>= 2.3.3.1, < 3.0) +- powerpack (~> 0.1) +- rainbow (>= 2.2.2, < 3.0) +- ruby-progressbar (~> 1.7) +- unicode-display_width (~> 1.0, >= 1.0.1) +- ruby-progressbar (1.9.0) +- rutie (0.0.4) +- simplecov (0.15.1) +- docile (~> 1.1.0) +- json (>= 1.8, < 3) +- simplecov-html (~> 0.10.0) +- simplecov-html (0.10.2) +- unicode-display_width (1.3.2) +- yard (0.9.12) +- +-PLATFORMS +- ruby +- +-DEPENDENCIES +- hypothesis-specs! +- minitest (~> 5.8.4) +- rake (>= 10.0, < 14.0) +- redcarpet (~> 3.4.0) +- rspec (~> 3.0) +- rubocop (~> 0.51.0) +- rutie (~> 0.0.3) +- simplecov (~> 0.15.1) +- yard (~> 0.9.12) +- +-BUNDLED WITH +- 2.2.15 +diff --git a/hypothesis-ruby/LICENSE.txt b/hypothesis-ruby/LICENSE.txt +deleted file mode 100644 +index 28835eb..0000000 +--- a/hypothesis-ruby/LICENSE.txt ++++ /dev/null +@@ -1,8 +0,0 @@ +-Copyright (c) 2018, David R. MacIver +- +-All code in this repository except where explicitly noted otherwise is released +-under the Mozilla Public License v 2.0. You can obtain a copy at https://mozilla.org/MPL/2.0/. +- +-Some code in this repository may come from other projects. Where applicable, the +-original copyright and license are noted and any modifications made are released +-dual licensed with the original license. +diff --git a/hypothesis-ruby/README.markdown b/hypothesis-ruby/README.markdown +deleted file mode 100644 +index b00f5ab..0000000 +--- a/hypothesis-ruby/README.markdown ++++ /dev/null +@@ -1,86 +0,0 @@ +-# Hypothesis for Ruby +- +-Hypothesis is a powerful, flexible, and easy to use library for *property-based testing*. +- +-In property-based testing, +-in contrast to traditional *example-based testing*, +-a test is written not against a single example but as a statement that should hold for any of a range of possible values. +- +-## Usage +- +-In Hypothesis for Ruby, a test looks something like this: +- +-```ruby +-require "hypothesis" +- +-RSpec.configure do |config| +- config.include(Hypothesis) +- config.include(Hypothesis::Possibilities) +-end +- +-RSpec.describe "removing an element from a list" do +- it "results in the element no longer being in the list" do +- hypothesis do +- # Or lists(of: integers, min_size: 1), but this lets us +- # demonstrate assume. +- values = any array(of: integers) +- +- # If this is not true then the test will stop here. +- assume values.size > 0 +- +- to_remove = any element_of(values) +- +- values.delete_at(values.index(to_remove)) +- +- # Will fail if the value was duplicated in the list. +- expect(values.include?(to_remove)).to be false +- +- end +- end +-end +-``` +- +-This would then fail with: +- +-``` +- 1) removing an element from a list results in the element no longer being in the list +- Failure/Error: expect(values.include?(to_remove)).to be false +- +- Given #1: [0, 0] +- Given #2: 0 +- +- expected false +- got true +-``` +- +-The use of RSpec here is incidental: +-Hypothesis for Ruby works just as well with minitest, +-and should work with anything else you care to use. +- +-## Getting Started +- +-Hypothesis is available on rubygems.org as a developer preview. +-If you want to try it today you can use the current development branch by adding the following to your Gemfile: +- +-```ruby +-gem 'hypothesis-specs' +-``` +- +-The API is still in flux, so be warned that you should expect it to break on upgrades! +-Right now this is really more to allow you to try it out and provide feedback than something you should expect to rely on. +-The more feedback we get, the sooner it will get there! +- +-Note that in order to use Hypothesis for Ruby, you will need a rust toolchain installed. +-Please go to [https://www.rustup.rs](https://www.rustup.rs) and follow the instructions if you do not already have one. You will most likely need to compile your Ruby executable with the `--enable-shared` option. See [here](https://github.com/danielpclark/rutie#dynamic-vs-static-builds). +- +-## Project Status +- +-Hypothesis for Ruby is currently in an *early alpha* stage. +-It works, and has a solid core set of features, but you should expect to find rough edges, +-it is far from feature complete, and the API makes no promises of backwards compatibility. +- +-Right now you should consider it to be more in the spirit of a developer preview. +-You can and should try it out, and hopefully you will find all sorts of interesting bugs in your code by doing so! +-But you'll probably find interesting bugs in Hypothesis too, +-and we'd appreciate you reporting them, +-as well as any just general usability issues or points of confusion you have. +diff --git a/hypothesis-ruby/Rakefile b/hypothesis-ruby/Rakefile +deleted file mode 100644 +index 72fb2dd..0000000 +--- a/hypothesis-ruby/Rakefile ++++ /dev/null +@@ -1,111 +0,0 @@ +-# frozen_string_literal: true +- +-require 'rubygems' +-require 'date' +-require 'open3' +- +-task :build do +- sh('cargo build --release') +-end +- +-begin +- require 'rspec/core/rake_task' +- RSpec::Core::RakeTask.new(:spec) +- +- require 'rake/testtask' +- +- Rake::TestTask.new(minitests: :build) do |t| +- t.test_files = FileList['minitests/**/test_*.rb'] +- t.verbose = true +- end +- +- task test: %i[build spec minitests] +- task rspec: %i[build spec] +- task minitest: %i[build without_rspec] do +- begin +- Rake::Task['minitests'].execute +- ensure +- Rake::Task['with_rspec'].execute +- end +- end +-rescue LoadError +-end +- +-task :without_rspec do +- sh('bundle config set without rspec') +-end +- +-task :with_rspec do +- sh('bundle config unset without') +-end +- +-def rubocop(fix:) +- sh "bundle exec rubocop #{'-a' if fix} lib spec minitests " \ +- 'Rakefile hypothesis-specs.gemspec' +-end +- +-task :checkformat do +- rubocop(fix: false) +-end +- +-task :format do +- rubocop(fix: true) +-end +- +-begin +- require 'yard' +- +- YARD::Rake::YardocTask.new(:runyard) do |t| +- t.files = [ +- 'lib/hypothesis.rb', 'lib/hypothesis/errors.rb', +- 'lib/hypothesis/possible.rb' +- ] +- t.options = ['--markup=markdown', '--no-private'] +- end +- +- task doc: :runyard do +- YARD::Registry.load +- +- objs = YARD::Registry.select do |o| +- is_private = false +- t = o +- until t.root? +- if t.visibility != :public +- is_private = true +- break +- end +- t = t.parent +- end +- +- !is_private && o.docstring.blank? +- end +- +- objs.sort_by! { |o| o.name.to_s } +- +- unless objs.empty? +- abort "Undocumented objects: #{objs.map(&:name).join(', ')}" +- end +- end +-rescue LoadError +-end +- +-GEMSPEC = 'hypothesis-specs.gemspec' +- +-RELEASE_FILE = 'RELEASE.md' +-CHANGELOG = 'CHANGELOG.md' +- +-def run_for_output(*args) +- out, result = Open3.capture2(*args) +- abort if result.exitstatus != 0 +- out.strip +-end +- +-task :clean do +- sh 'git clean -fdx lib' +- sh 'rm -rf hypothesis-specs*.gem' +- sh 'rm -rf ../target' +-end +- +-task gem: :clean do +- sh 'gem build hypothesis-specs.gemspec' +-end +diff --git a/hypothesis-ruby/docs/debt.md b/hypothesis-ruby/docs/debt.md +deleted file mode 100644 +index 1173ea5..0000000 +--- a/hypothesis-ruby/docs/debt.md ++++ /dev/null +@@ -1,92 +0,0 @@ +-# A Series of Unfortunate Implementation Choices +- +-## In Which The Narrator Seeks To Justify Himself +- +-This project is currently in a somewhat expeditionary state, +-where its goal is not to produce wonderful software that will +-stand the test of time, but instead to prove its concept +-valid and get something working enough for me to decide +-whether it's worth it to continue down this route, and +-to decide whether it's worth it to continue funding it. +- +-As such, whenever presented with the question "Do we want it +-good or do we want it soon?" I am mostly choosing soon. +- +-BUT I am optimistic about the long-term viability of this +-project, and I do not wish to find future-David cursing the +-very name of past-David. In aid of squaring this particular +-circle, I am choosing to document every terrible thing that +-I knowingly do. +- +-The goals of this documentation are: +- +-* To make me feel bad, so that I'm less likely to do things +- that are awful but not actually needed. +-* To explain the reasoning to future-me and those who come +- after. +-* To make explicit the conditions under which the awful hack +- may be removed. +- +-## Awful Hacks +- +-### Threads as a Control Flow Mechanism +- +-Rather than attempt to encode the generation state machine +-explicitly, which was proving to be absolutely awful, I +-decided to continue to write it synchronously. The Rust side +-of the equation does not control calling the test function, +-which makes this tricky (and having the asynchronous interface +-as the main API entry point is a long term good anyway). +- +-The ideal way of doing this would be with something lightweight, +-like a coroutines. The ideal way of doing coroutines would be +-[Rust generators](https://doc.rust-lang.org/nightly/unstable-book/language-features/generators.html). +- +-Unfortunately this suffers from two problems: +- +-* It requires rust nightly. I would be prepared to live with this, +- but it's sub-par. +-* The current implementation is one-way only: resume does not take +- an argument. +- +-Alternate things tried: +- +-* [libfringe](https://github.com/edef1c/libfringe) seems lovely, +- but also requires rust-nightly and the released version doesn't +- actually build on rust nightly +-* I didn't really look into [may](https://github.com/Xudong-Huang/may/) +- after a) getting vaguely warned off it and b) Honestly having +- coroutine implementation exhaustion at this point. +- +-So at this point I said "Screw it, threads work on stable, and the +-context switching overhead isn't going to be *that* large compared +-to all the other mess that's in this chain, so..." +- +-So, yeah, that's why the main loop runs in a separate thread and +-communicates with the main thread via a synchronous channel. +- +-Can be removed when one of: +- +-* Generators are on stable and support resuming with an argument. +-* libfringe works on stable +-* Either of the above but on unstable, and my frustration with +- threading bugs (but fearless concurrency, David!) outweighs +- my desire to not use nightly. +- +-### Stable identifiers from RSpec +- +-Another "I did terrible things to RSpec" entry, sorry. RSpec's +-design here is totally reasonable and sensible and honestly +-probably *is* how you should pass state around, but seems +-to make it impossible to get access to the Example object from +-inside an it block without actually being the definer of the +-block. +- +-See `hypothesis_stable_identifier` for details, but basically I +-couldn't figure out how to get the name of a currently executing +-spec in RSPec from a helper function without some fairly brutal +-hacks where we extract information badly from self.inspect, because +-it's there stored as a string that gets passed in for inspection. +- +-Can be removed when: Someone shows me a better way, or a +-feature is added to RSpec to make this easier. +diff --git a/hypothesis-ruby/docs/design.md b/hypothesis-ruby/docs/design.md +deleted file mode 100644 +index 95db34c..0000000 +--- a/hypothesis-ruby/docs/design.md ++++ /dev/null +@@ -1,123 +0,0 @@ +-# Design Notes +- +-The current goals of the Hypothesis for Ruby project are: +- +-* To provide a useful but not wholly feature complete version of +- [Hypothesis](https://hypothesis.works/) for Ruby, that works with +- RSpec (and ideally minitest, but if that at any point proves to +- be a lot of work this may be dropped. It's not an explicit +- requirement, but supporting it now makes it much easier to find +- the right shape of the project design). +-* To provide a mostly feature complete version of the Conjecture +- engine that powers Hypothesis in Rust, as decoupled from that +- Ruby front-end as possible. +- +-Hypothesis for Ruby is not intended to be an exact feature for +-feature copy of the Python version. It will have a lot of the same +-underlying functionality, but with a number of changes driven by: +- +-* Trying to make it feel as "ruby native" as possible. +-* The ability to design an API from scratch that lacks many of the +- constraints imposed both by the earlier much more limited functionality +- of Hypothesis and the specifics of Python decorators and test +- frameworks. +- +-## Differences +- +-The most fundamental API differences between Hypothesis +-for Python and Hypothesis for Ruby are: +- +-* In Python we do a whole giant song and dance about exposing +- functions for the test runner to call, while in Ruby we just +- have a function which repeatedly calls a block and then fails. +-* In Python you specify a bunch of given parameters up front, +- and then if you want values inline in the test you [explicitly +- opt in to it](https://hypothesis.readthedocs.io/en/latest/data.html#drawing-interactively-in-tests), +- while in Ruby this is not only the default but the only way to +- get those values. +-* Strategies are called Possibles because strategy is a terrible +- name that was originally intended to be internal and then leaked +- into the public API because I wasn't thinking hard about naming. +-* Many of the Possible implementations have different names than +- the corresponding +- names in hypothesis-python. There is also a weird dual naming +- convention for Possibles where there is both e.g. `integers` and +- `integer` as aliases for each other. +- +-So for example: +- +-```ruby +-RSPec.describe "integer addition" do +- it "commutes" do +- hypothesis do +- m = any integer +- n = any integer +- expect(m + n).to eq(n + m) +- end +- end +-end +-``` +- +-```python +-@given(integers(), integers()) +-def test_integers_commute(m, n): +- assert m + n == n + m +-``` +- +-The in-line style is slightly more verbose, but vastly more flexible +-and (I think) reads better. Also mixing in-line and up-front +-styles looks weird, and if we're going to have just one then +-the in-line approach is a strict superset of the functionality +-of the other. +- +-The main reason for these differences are: +- +-* Ruby blocks (and their relation to testing) make this approach +- much more natural. +-* This functionality was not actually possible when the Hypothesis +- for Python API was originally designed, which informed the way +- its API looks. +- +-## Deliberate omissions +- +-The following are currently *not* part of the intended feature set +-of Hypothesis for Ruby: +- +-* Calls to `hypothesis` may not be nested. +-* There will be no equivalent to the [stateful testing](https://hypothesis.readthedocs.io/en/latest/stateful.html) +- (but the very interactive nature of tests in the Ruby API means that +- the generic state machine stuff is just something you can write in +- your normal tests). +-* Testing will not be coverage guided (to be fair, it's barely coverage +- guided in the Python version right now...) +-* There will probably not be a health check system as part of the initial +- release, or if there is it will be much more basic. +-* Any equivalent to [`@reproduce_failure`](https://hypothesis.readthedocs.io/en/latest/reproducing.html#reproducing-an-example-with-with-reproduce-failure) +- +-## Possible omissions +- +-The following will be in this initial project on a "time permitting" basis: +-If everything else is going well and we've got plenty of time, I'll do them, +-but I'm currently anticipating a tightish schedule so these are probably +-for a future release: +- +-* Reporting multiple failing examples per test (this will definitely be supported +- in the core engine, and if it's easy to support it then it will +- also be included in the front-end. I currently think it will be +- easy, but if it's not it will be dropped). +-* [adding explicit examples](https://hypothesis.readthedocs.io/en/latest/reproducing.html#providing-explicit-examples). +- +-## Current Project State +- +-The current state is best described as "nascent" - it demonstrates +-a lot of the right moving parts, but has rough edges that you will +-hit almost immediately if you try to use it. Those rough edges need +-to be filed off before it can be built. +- +-Things that don't work yet but will: +- +-* The Possible library is limited, and most of what is there is bad. +-* The shrinker is *very* primitive in comparison to in Python. +-* The example database does not yet exist. +-* It can't actually be installed as a gem! Note that even once it is +- installable you will need a rust compiler and cargo. +diff --git a/hypothesis-ruby/ext/Makefile b/hypothesis-ruby/ext/Makefile +deleted file mode 100644 +index 218ec43..0000000 +--- a/hypothesis-ruby/ext/Makefile ++++ /dev/null +@@ -1,7 +0,0 @@ +-all: +- cd .. +- rake build +-clean: +- rm -rf ../target +- +-install: ; +diff --git a/hypothesis-ruby/ext/extconf.rb b/hypothesis-ruby/ext/extconf.rb +deleted file mode 100644 +index c3fa975..0000000 +--- a/hypothesis-ruby/ext/extconf.rb ++++ /dev/null +@@ -1,5 +0,0 @@ +-if !system('cargo --version') +- raise 'Hypothesis requires cargo to be installed (https://www.rust-lang.org/)' +-end +- +-require 'rake' +diff --git a/hypothesis-ruby/hypothesis-specs.gemspec b/hypothesis-ruby/hypothesis-specs.gemspec +deleted file mode 100644 +index c00a987..0000000 +--- a/hypothesis-ruby/hypothesis-specs.gemspec ++++ /dev/null +@@ -1,21 +0,0 @@ +-# frozen_string_literal: true +- +-Gem::Specification.new do |s| +- s.name = 'hypothesis-specs' +- s.version = '0.7.1' +- s.date = '2021-03-27' +- s.description = <<~DESCRIPTION +- Hypothesis is a powerful, flexible, and easy to use library for property-based testing. +-DESCRIPTION +- s.summary = s.description +- s.authors = ['David R. Maciver', 'Alex Weisberger'] +- s.email = 'david@drmaciver.com' +- s.files = Dir['{ext/*,src/**/*,lib/**/*}'] + [ +- 'Cargo.toml', 'LICENSE.txt', 'README.markdown', 'Rakefile', +- 'CHANGELOG.md' +- ] +- s.homepage = 'https://github.com/HypothesisWorks/hypothesis/tree/master/hypothesis-ruby' +- s.license = 'MPL-2.0' +- s.extensions = Dir['ext/extconf.rb'] +- s.add_dependency 'rutie', '~> 0.0.3' +-end +diff --git a/hypothesis-ruby/lib/hypothesis.rb b/hypothesis-ruby/lib/hypothesis.rb +deleted file mode 100644 +index 75d349f..0000000 +--- a/hypothesis-ruby/lib/hypothesis.rb ++++ /dev/null +@@ -1,286 +0,0 @@ +-# frozen_string_literal: true +- +-require_relative 'hypothesis/junkdrawer' +-require_relative 'hypothesis/errors' +-require_relative 'hypothesis/possible' +-require_relative 'hypothesis/testcase' +-require_relative 'hypothesis/engine' +-require_relative 'hypothesis/world' +- +-module Phase +- SHRINK = :shrink +- +- module_function +- +- def all +- [SHRINK] +- end +- +- def excluding(*phases) +- unknown_phases = phases.reject { |phase| Phase.all.include?(phase) } +- unless unknown_phases.empty? +- raise( +- ArgumentError, +- "Attempting to exclude unknown phases: #{unknown_phases}" +- ) +- end +- +- all - phases +- end +-end +- +-# This is the main module for using Hypothesis. +-# It is expected that you will include this in your +-# tests, but its methods are also available on the +-# module itself. +-# +-# The main entry point for using this is the +-# {Hypothesis#hypothesis} method. All of the other +-# methods make sense only inside blocks passed to +-# it. +-module Hypothesis +- # @!visibility private +- HYPOTHESIS_LOCATION = File.dirname(__FILE__) +- # rubocop:disable ClassVars +- @@setup_called = false +- # rubocop:enable RuleByName +- +- def self.setup_called +- @@setup_called == true +- end +- +- def self.included(*) +- if setup_called == false +- Rutie.new(:hypothesis_ruby_core).init( +- 'Init_rutie_hypothesis_core', +- __dir__ +- ) +- end +- @@setup_called = true +- end +- +- # @!visibility private +- def hypothesis_stable_identifier +- # Attempt to get a "stable identifier" for any any +- # call into hypothesis. We use these to create +- # database keys (or will when we have a database) that +- # are stable across runs, so that when a test that +- # previously failed is rerun, we can fetch and reuse +- # the previous examples. +- +- # Note that essentially any answer to this method is +- # "fine" in that the failure mode is that sometimes we +- # just won't run the same test, but it's nice to keep +- # this as stable as possible if the code isn't changing. +- +- # Minitest makes it nice and easy to create a stable +- # test identifier, because it follows the classic xunit +- # pattern where a test is just a method invocation on a +- # fresh test class instance and it's easy to find out +- # which invocation that was. +- return "#{self.class.name}::#{@NAME}" if defined? @NAME +- +- # If we are running in an rspec example then, sadly, +- # rspec take the entirely unreasonable stance that +- # the correct way to pass data to a test is by passing +- # it as a function argument. Honestly, what is this, +- # Haskell? Ahem. Perfectly reasonable design decisions +- # on rspec's part, this creates some annoying difficulties +- # for us. We solve this through brute force and ignorance +- # by relying on the information we want being in the +- # inspect for the Example object, even if it's just there +- # as a string. +- begin +- is_rspec = is_a? RSpec::Core::ExampleGroup +- # We do our coverage testing inside rspec, so this will +- # never trigger! Though we also don't currently have a +- # test that covers it outside of rspec... +- # :nocov: +- rescue NameError +- is_rspec = false +- end +- # :nocov: +- +- if is_rspec +- return [ +- self.class.description, +- inspect.match(/"([^"]+)"/)[1] +- ].join(' ') +- end +- +- # Fallback time! We just walk the stack until we find the +- # entry point into code we control. This will typically be +- # where "hypothesis" was called. +- Thread.current.backtrace.each do |line| +- return line unless line.include?(Hypothesis::HYPOTHESIS_LOCATION) +- end +- # This should never happen unless something very strange is +- # going on. +- # :nocov: +- raise 'BUG: Somehow we have no caller!' +- # :nocov: +- end +- +- # Run a test using Hypothesis. +- # +- # For example: +- # +- # ```ruby +- # hypothesis do +- # x = any integer +- # y = any integer(min: x) +- # expect(y).to be >= x +- # end +- # ``` +- # +- # The arguments to `any` are `Possible` instances which +- # specify the range of value values for it to return. +- # +- # Typically you would include this inside some test in your +- # normal testing framework - e.g. in an rspec it block or a +- # minitest test method. +- # +- # This will run the block many times with integer values for +- # x and y, and each time it will pass because we specified that +- # y had a minimum value of x. +- # If we changed it to `expect(y).to be > x` we would see output +- # like the following: +- # +- # ``` +- # Failure/Error: expect(y).to be > x +- # +- # Given #1: 0 +- # Given #2: 0 +- # expected: > 0 +- # got: 0 +- # ``` +- # +- # In more detail: +- # +- # hypothesis calls its provided block many times. Each invocation +- # of the block is a *test case*. +- # A test case has three important features: +- # +- # * *givens* are the result of a call to self.any, and are the +- # values that make up the test case. These might be values such +- # as strings, integers, etc. or they might be values specific to +- # your application such as a User object. +- # * *assumptions*, where you call `self.assume(some_condition)`. If +- # an assumption fails (`some_condition` is false), then the test +- # case is considered invalid, and is discarded. +- # * *assertions* are anything that will raise an error if the test +- # case should be considered a failure. These could be e.g. RSpec +- # expectations or minitest matchers, but anything that throws an +- # exception will be treated as a failed assertion. +- # +- # A test case which satisfies all of its assumptions and assertions +- # is *valid*. A test-case which satisfies all of its assumptions but +- # fails one of its assertions is *failing*. +- # +- # A call to hypothesis does the following: +- # +- # 1. It first tries to *reuse* failing test cases for previous runs. +- # 2. If there were no previous failing test cases then it tries to +- # *generate* new failing test cases. +- # 3. If either of the first two phases found failing test cases then +- # it will *shrink* those failing test cases. +- # 4. Finally, it will *display* the shrunk failing test case by +- # the error from its failing assertion, modified to show the +- # givens of the test case. +- # +- # Reuse uses an internal representation of the test case, so examples +- # from previous runs will obey all of the usual invariants of generation. +- # However, this means that if you change your test then reuse may not +- # work. Test cases that have become invalid or passing will be cleaned +- # up automatically. +- # +- # Generation consists of randomly trying test cases until one of +- # three things has happened: +- # +- # 1. It has found a failing test case. At this point it will start +- # *shrinking* the test case (see below). +- # 2. It has found enough valid test cases. At this point it will +- # silently stop. +- # 3. It has found so many invalid test cases that it seems unlikely +- # that it will find any more valid ones in a reasonable amount of +- # time. At this point it will either silently stop or raise +- # `Hypothesis::Unsatisfiable` depending on how many valid +- # examples it found. +- # +- # *Shrinking* is when Hypothesis takes a failing test case and tries +- # to make it easier to understand. It does this by replacing the givens +- # in the test case with smaller and simpler values. These givens will +- # still come from the possible values, and will obey all the usual +- # constraints. +- # In general, shrinking is automatic and you shouldn't need to care +- # about the details of it. If the test case you're shown at the end +- # is messy or needlessly large, please file a bug explaining the problem! +- # +- # @param max_valid_test_cases [Integer] The maximum number of valid test +- # cases to run without finding a failing test case before stopping. +- # +- # @param database [String, nil, false] A path to a directory where Hypothesis +- # should store previously failing test cases. If it is nil, Hypothesis +- # will use a default of .hypothesis/examples in the current directory. +- # May also be set to false to disable the database functionality. +- def hypothesis( +- max_valid_test_cases: 200, +- phases: Phase.all, +- database: nil, +- &block +- ) +- unless World.current_engine.nil? +- raise UsageError, 'Cannot nest hypothesis calls' +- end +- +- begin +- World.current_engine = Engine.new( +- hypothesis_stable_identifier, +- max_examples: max_valid_test_cases, +- phases: phases, +- database: database +- ) +- World.current_engine.run(&block) +- ensure +- World.current_engine = nil +- end +- end +- +- # Supplies a value to be used in your hypothesis. +- # @note It is invalid to call this method outside of a hypothesis block. +- # @return [Object] A value provided by the possible argument. +- # @param possible [Possible] A possible that specifies the possible values +- # to return. +- # @param name [String, nil] An optional name to show next to the result on +- # failure. This can be helpful if you have a lot of givens in your +- # hypothesis, as it makes it easier to keep track of which is which. +- def any(possible, name: nil, &block) +- if World.current_engine.nil? +- raise UsageError, 'Cannot call any outside of a hypothesis block' +- end +- +- World.current_engine.current_source.any( +- possible, name: name, &block +- ) +- end +- +- # Specify an assumption of your test case. Only test cases which satisfy +- # their assumptions will treated as valid, and all others will be +- # discarded. +- # @note It is invalid to call this method outside of a hypothesis block. +- # @note Try to use this only with "easy" conditions. If the condition is +- # too hard to satisfy this can make your testing much worse, because +- # Hypothesis will have to retry the test many times and will struggle +- # to find "interesting" test cases. For example `assume(x != y)` is +- # typically fine, and `assume(x == y)` is rarely a good idea. +- # @param condition [Boolean] The condition to assume. If this is false, +- # the current test case will be treated as invalid and the block will +- # exit by throwing an exception. The next test case will then be run +- # as normal. +- def assume(condition) +- if World.current_engine.nil? +- raise UsageError, 'Cannot call assume outside of a hypothesis block' +- end +- World.current_engine.current_source.assume(condition) +- end +-end +diff --git a/hypothesis-ruby/lib/hypothesis/engine.rb b/hypothesis-ruby/lib/hypothesis/engine.rb +deleted file mode 100644 +index cd9bb87..0000000 +--- a/hypothesis-ruby/lib/hypothesis/engine.rb ++++ /dev/null +@@ -1,109 +0,0 @@ +-# frozen_string_literal: true +- +-require 'rutie' +- +-module Hypothesis +- DEFAULT_DATABASE_PATH = File.join(Dir.pwd, '.hypothesis', 'examples') +- +- class Engine +- attr_reader :current_source +- attr_accessor :is_find +- +- def initialize(name, options) +- seed = Random.rand(2**64 - 1) +- +- database = options.fetch(:database, nil) +- +- database = DEFAULT_DATABASE_PATH if database.nil? +- +- database = nil if database == false +- +- @core_engine = HypothesisCoreEngine.new( +- name, +- database, +- seed, +- options.fetch(:max_examples), +- options.fetch(:phases) +- ) +- +- @exceptions_to_tags = Hash.new { |h, k| h[k] = h.size } +- end +- +- def run +- loop do +- core = @core_engine.new_source +- break if core.nil? +- @current_source = TestCase.new(core) +- begin +- result = yield(@current_source) +- if is_find && result +- @core_engine.finish_interesting(core, 0) +- else +- @core_engine.finish_valid(core) +- end +- rescue UnsatisfiedAssumption +- @core_engine.finish_invalid(core) +- rescue DataOverflow +- @core_engine.finish_overflow(core) +- rescue Exception => e +- raise if is_find +- key = [ +- e.class, +- HypothesisJunkDrawer.find_first_relevant_line(e.backtrace) +- ] +- @core_engine.finish_interesting(core, @exceptions_to_tags[key]) +- end +- end +- if @core_engine.count_failing_examples.zero? +- raise Unsatisfiable if @core_engine.was_unsatisfiable +- @current_source = nil +- return +- end +- +- if is_find +- core = @core_engine.failing_example(0) +- @current_source = TestCase.new(core, record_draws: true) +- yield @current_source +- else +- exceptions = [] +- (0...@core_engine.count_failing_examples).each do |example| +- core = @core_engine.failing_example(example) +- @current_source = TestCase.new(core, print_draws: true) +- +- begin +- yield @current_source +- rescue Exception => e +- givens = @current_source.print_log +- given_str = givens.each_with_index.map do |(name, s), i| +- name = "##{i + 1}" if name.nil? +- "Given #{name}: #{s}" +- end.to_a +- +- if e.respond_to? :hypothesis_data +- e.hypothesis_data[0] = given_str +- else +- original_to_s = e.to_s +- original_inspect = e.inspect +- +- class < 0 +- # i = any element_of(ls) +- # [ls, i] +- # end +- # ``` +- # +- # @return [Possible] A Possible whose possible values are +- # any result from the passed block. +- def built_as(&block) +- Hypothesis::Possible::Implementations::CompositePossible.new(block) +- end +- +- alias values_built_as built_as +- +- # A Possible boolean value +- # @return [Possible] +- def booleans +- integers(min: 0, max: 1).map { |i| i == 1 } +- end +- +- alias boolean booleans +- +- # A Possible unicode codepoint. +- # @return [Possible] +- # @param min [Integer] The smallest codepoint to provide +- # @param max [Integer] The largest codepoint to provide +- def codepoints(min: 1, max: 1_114_111) +- base = integers(min: min, max: max) +- if min <= 126 +- from(integers(min: min, max: [126, max].min), base) +- else +- base +- end +- end +- +- alias codepoint codepoints +- +- # A Possible String +- # @return [Possible] +- # @param codepoints [Possible, nil] The Possible codepoints +- # that can be found in the string. If nil, +- # will default to self.codepoints. These +- # will be further filtered to ensure the generated string is +- # valid. +- # @param min_size [Integer] The smallest valid length for a +- # provided string +- # @param max_size [Integer] The largest valid length for a +- # provided string +- def strings(codepoints: nil, min_size: 0, max_size: 10) +- codepoints = self.codepoints if codepoints.nil? +- codepoints = codepoints.select do |i| +- begin +- [i].pack('U*').codepoints +- true +- rescue ArgumentError +- false +- end +- end +- arrays(of: codepoints, min_size: min_size, max_size: max_size).map do |ls| +- ls.pack('U*') +- end +- end +- +- alias string strings +- +- # A Possible Hash, where all possible values have a fixed +- # shape. +- # This is used for hashes where you know exactly what the +- # keys are, and different keys may have different possible values. +- # For example, hashes_of_shape(a: integers, b: booleans) +- # will give you values like `{a: 11, b: false}`. +- # @return [Possible] +- # @param hash [Hash] A hash describing the values to provide. +- # The keys will be present unmodified in the provided hashes, +- # mapping to their Possible value in the result. +- def hashes_of_shape(hash) +- built_as do +- result = {} +- hash.each { |k, v| result[k] = any(v) } +- result +- end +- end +- +- alias hash_of_shape hashes_of_shape +- +- # A Possible Hash of variable shape. +- # @return [Possible] +- # @param keys [Possible] the possible keys +- # @param values [Possible] the possible values +- def hashes_with(keys:, values:, min_size: 0, max_size: 10) +- built_as do +- result = {} +- rep = HypothesisCoreRepeatValues.new( +- min_size, max_size, (min_size + max_size) * 0.5 +- ) +- source = World.current_engine.current_source +- while rep.should_continue(source) +- key = any keys +- if result.include?(key) +- rep.reject +- else +- result[key] = any values +- end +- end +- result +- end +- end +- +- alias hash_with hashes_with +- +- # A Possible Arrays of a fixed shape. +- # This is used for arrays where you know exactly how many +- # elements there are, and different values may be possible +- # at different positions. +- # For example, arrays_of_shape(strings, integers) +- # will give you values like ["a", 1] +- # @return [Possible] +- # @param elements [Array] A variable number of Possible. +- # values. The provided array will have this many values, with +- # each value possible for the corresponding argument. If elements +- # contains an array it will be flattened first, so e.g. +- # arrays_of_shape(a, b) is equivalent to arrays_of_shape([a, b]) +- def arrays_of_shape(*elements) +- elements = elements.flatten +- built_as do +- elements.map { |e| any e }.to_a +- end +- end +- +- alias array_of_shape arrays_of_shape +- +- # A Possible Array of variable shape. +- # This is used for arrays where the size may vary and the same values +- # are possible at any position. +- # For example, arrays(of: booleans) might provide [false, true, false]. +- # @return [Possible] +- # @param of [Possible] The possible elements of the array. +- # @param min_size [Integer] The smallest valid size of a provided array +- # @param max_size [Integer] The largest valid size of a provided array +- def arrays(of:, min_size: 0, max_size: 10) +- built_as do +- result = [] +- rep = HypothesisCoreRepeatValues.new( +- min_size, max_size, (min_size + max_size) * 0.5 +- ) +- source = World.current_engine.current_source +- result.push any(of) while rep.should_continue(source) +- result +- end +- end +- +- alias array arrays +- +- # A Possible where the possible values are any one of a number +- # of other possible values. +- # For example, from(strings, integers) could provide either of "a" +- # or 1. +- # @note This has a slightly non-standard aliasing. It reads more +- # nicely if you write `any from(a, b, c)` but e.g. +- # `arrays(of: mix_of(a, b, c))`. +- # +- # @return [Possible] +- # @param components [Array] A number of Possible values, +- # where the result will include any value possible from any of +- # them. If components contains an +- # array it will be flattened first, so e.g. from(a, b) +- # is equivalent to from([a, b]) +- def from(*components) +- components = components.flatten +- indexes = from_hypothesis_core( +- HypothesisCoreBoundedIntegers.new(components.size - 1) +- ) +- built_as do +- i = any indexes +- any components[i] +- end +- end +- +- alias mix_of from +- +- # A Possible where any one of a fixed array of values is possible. +- # @note these values are provided as is, so if the provided +- # values are mutated in the test you should be careful to make +- # sure each test run gets a fresh value (if you use this Possible +- # in line in the test you don't need to worry about this, this +- # is only a problem if you define the Possible outside of your +- # hypothesis block). +- # @return [Possible] +- # @param values [Enumerable] A collection of possible values. +- def element_of(values) +- values = values.to_a +- indexes = from_hypothesis_core( +- HypothesisCoreBoundedIntegers.new(values.size - 1) +- ) +- built_as do +- values.fetch(any(indexes)) +- end +- end +- +- alias elements_of element_of +- +- # A Possible integer +- # @return [Possible] +- # @param min [Integer] The smallest value integer to provide. +- # @param max [Integer] The largest value integer to provide. +- def integers(min: nil, max: nil) +- base = from_hypothesis_core HypothesisCoreIntegers.new +- if min.nil? && max.nil? +- base +- elsif min.nil? +- built_as { max - any(base).abs } +- elsif max.nil? +- built_as { min + any(base).abs } +- else +- bounded = from_hypothesis_core( +- HypothesisCoreBoundedIntegers.new(max - min) +- ) +- if min.zero? +- bounded +- else +- built_as { min + any(bounded) } +- end +- end +- end +- +- alias integer integers +- +- private +- +- def from_hypothesis_core(core) +- Hypothesis::Possible::Implementations::PossibleFromCore.new( +- core +- ) +- end +- end +-end +diff --git a/hypothesis-ruby/lib/hypothesis/testcase.rb b/hypothesis-ruby/lib/hypothesis/testcase.rb +deleted file mode 100644 +index b83b450..0000000 +--- a/hypothesis-ruby/lib/hypothesis/testcase.rb ++++ /dev/null +@@ -1,46 +0,0 @@ +-# frozen_string_literal: true +- +-module Hypothesis +- # A TestCase class provides a concrete representation of +- # an executing test case. You do not normally need to use this +- # within the body of the test, but it exists to be used as +- # an argument to {Hypothesis::Possibilities::built_as}. +- # @!visibility private +- class TestCase +- # @!visibility private +- attr_reader :draws, :print_log, :print_draws, :wrapped_data +- +- # @!visibility private +- def initialize(wrapped_data, print_draws: false, record_draws: false) +- @wrapped_data = wrapped_data +- +- @draws = [] if record_draws +- @print_log = [] if print_draws +- @depth = 0 +- end +- +- def assume(condition) +- raise UnsatisfiedAssumption unless condition +- end +- +- # @!visibility private +- def any(possible = nil, name: nil, &block) +- top_level = @depth.zero? +- +- begin +- @depth += 1 +- possible ||= block +- @wrapped_data.start_draw +- result = possible.provide(&block) +- @wrapped_data.stop_draw +- if top_level +- draws&.push(result) +- print_log&.push([name, result.inspect]) +- end +- result +- ensure +- @depth -= 1 +- end +- end +- end +-end +diff --git a/hypothesis-ruby/lib/hypothesis/world.rb b/hypothesis-ruby/lib/hypothesis/world.rb +deleted file mode 100644 +index bd200c4..0000000 +--- a/hypothesis-ruby/lib/hypothesis/world.rb ++++ /dev/null +@@ -1,9 +0,0 @@ +-# frozen_string_literal: true +- +-module Hypothesis +- module World +- class << self +- attr_accessor :current_engine +- end +- end +-end +diff --git a/hypothesis-ruby/minitests/test_multiple_failures.rb b/hypothesis-ruby/minitests/test_multiple_failures.rb +deleted file mode 100644 +index 3b12ad4..0000000 +--- a/hypothesis-ruby/minitests/test_multiple_failures.rb ++++ /dev/null +@@ -1,29 +0,0 @@ +-# frozen_string_literal: true +- +-require 'minitest/autorun' +-require 'hypothesis' +- +-class TestMultipleFailures < Minitest::Test +- include Hypothesis +- include Hypothesis::Possibilities +- +- def test_multiple_failures +- assert_raises(Hypothesis::MultipleExceptionError) do +- @initial = nil +- +- hypothesis do +- x = any integers +- if @initial.nil? +- if x >= 1000 +- @initial = x +- else +- next +- end +- end +- +- assert(x != @initial) +- raise 'Nope' +- end +- end +- end +-end +diff --git a/hypothesis-ruby/minitests/test_stable_identifier.rb b/hypothesis-ruby/minitests/test_stable_identifier.rb +deleted file mode 100644 +index fb301eb..0000000 +--- a/hypothesis-ruby/minitests/test_stable_identifier.rb ++++ /dev/null +@@ -1,12 +0,0 @@ +-# frozen_string_literal: true +- +-require 'minitest/autorun' +-require 'hypothesis' +- +-class TestIdentifiers < Minitest::Test +- include Hypothesis +- +- def test_abc +- assert_equal hypothesis_stable_identifier, 'TestIdentifiers::test_abc' +- end +-end +diff --git a/hypothesis-ruby/scripts/run-tests-isolated.sh b/hypothesis-ruby/scripts/run-tests-isolated.sh +deleted file mode 100755 +index 8f82c73..0000000 +--- a/hypothesis-ruby/scripts/run-tests-isolated.sh ++++ /dev/null +@@ -1,22 +0,0 @@ +-#!/usr/bin/env bash +- +-set -e -o xtrace +- +-rm -rf isolated +-mkdir isolated +- +-bundle exec rake gem +- +-mv hypothesis-specs*.gem isolated +-cp -Rl .rspec spec isolated +- +-cd isolated +- +-mkdir gems +-export GEM_HOME="$PWD"/gems +-export GEM_PATH="$GEM_HOME" +- +-gem install ./hypothesis-specs*.gem +-gem install rspec simplecov +- +-gems/bin/rspec spec +diff --git a/hypothesis-ruby/secrets.tar.enc b/hypothesis-ruby/secrets.tar.enc +deleted file mode 100644 +index 9858cdb6492f7541a829cfbd6fea51783f373312..0000000000000000000000000000000000000000 +GIT binary patch +literal 0 +HcmV?d00001 + +literal 10256 +zcmV+rDDT&)oGiva5SrWcKhBr+@&b-W_TZS{HyAqXaazzO00G~+qLxQv%k9>}@B?}s +zdC_+phze_2s-c^)^X}ogX~Em&`t>=baC{Pf-vr!G_5|)8H6D;o?F^6{3w8J3t(!YH= +z^FRbqpf0%@9L90vC&d_dCi`a(hbzD0K0WQh2^SVWzdA4v@l;^uk+3sIDeM7B8zTgh +zP%aKvN=7$49SJq`(jA;nc%lau-(sfWHP>o5$cv^&gMj&JbZ~i3FrIa@mPPZUeQAz_ +zUtBFH97%;#z~o>nA)lN3mLw_#tCJ9=f2u$>KZN;s?UB!Pcj7ltk~ChDGm;!I8G_P^ +zW_T!!h7M$mRICcC$2d;6gqJ^*+qHs5sa!AwJcRsd$>WOWR(R9OLbjmxj$=vb;~sWz +z(LqYFCu+$X;81tfdRPtDT#}pAaMT2PNe~eK83}M!1W79(e{WTf8S_n<0>alujay3( +zWuLg6a>-_fQy$QP3GwoEIg+UQYnWgSA)qIuQi6zQHIDRXh)J!#8f#M;B4DVqX`pL~>Nhk8Hs^yAA +z1)^R9>u5L6hL-cwmA{D__^>bRJFjLrvy$74%+N+HQ>8|6)8YnF8S^;3EO=-kQ +zGF#KYdNnzk1utegHuEk^)n@BJkf*EC0d6hvBkGV8SR!3te;85kGcN4}s$cjK{Zv52xq2r3OcuMJLXFT!>A3%tAbB_h`qyyE +z4ns=j81mv###4mCDDf+|0a@2eAB*vxe+Hy%Qr=?J)UnIb>!}w42>WXwUPQpsyhxyJ +zXY8Z7LZ-iOT^P6|hM>4%dp{>CsGNNDJGHpGWtgfnF+$z`p)POgNc%fBFFqJ74?DPj +zFSJM@n=Ew{w0zEsOQNM(a$BF3+CJ5X1MmwrL0SxH`vqrTRO&nangSo&rO(JWKh8b{ +z?Cm8mOdV4e8ob!oQRY2bUz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vOpb({1GS@DR +zaFKvdWSRlQjDU)4Ecdp$$#ZHLb6>+vtGGPtLc|7mA*PJ_$p5}wBRC~f8!vf1Tu+i| +zvBoQ}x=D!%U2GNs<;VqgsU*IW$H*xjd8yRY6QFebzA@;}*xhD{bKQd4HWU6%bmP!o +z;desZs#l&oaOApDfWm5}A0c{)H1x?bL5ilrcQ_Q-4%&0g*?P@u9bzoHB=K1c*ih-bp7G_5L +z?ZrBADdW8Yz11a%pLo&VT$)ifsta$!mz`83$!m3P1qr2Xh)$!lc&M`rg>d%Jk|=q=YrdAa+q5F3svcr@WA6Mo+8C!{y2TJi2*ob;OGmGWHz4=J%Fyt+yk+H=POLK!*Y)9oTbxsETmZfx=1g +zQzcW3VFTI6a)u!AD(rb?G@%9OFS8vW1aOa^Un|jB7pWN4nb+nNiNaTOi~?)uxI=(j +z-Dp5wghRpXT!JvYB_wt!`toI(uLnE7S=*DfmN(|M&5X!>Hl1Ii#w_;ip7XgidrK_> +z!xxvMkDE8P1BWD0*~@qMA_Z4A88R$X#-Y^FXVi7QzU)`eWysed?on0EF9(~-dfjxo +zt8q#b*uU*qiH+fd*cGuv!U|WnL7dYz-hU=Ht$H>M#!NDmjtrJ@b3inOZuu8nbxz9} +zQ#AJ^8Bb!D;9E1yBQn}ma>c{Se{7)hjy)5Uz`F_C?tlTQfQ_7r9gx15-KmbL2v|TT +z6g$i8DDHa1yZ^H=8u(+ZMD0;0;jIPHRd#Y{AVQqTP?nwNF~gcg!>@y7A(uUW(`@sO +zYL#Zr*`$EB%?`^D##hBu{vwW`eca~d@X?|kSRQHYXq0{hsrT}17bS-?3pEu= 0 } +- end +- end +- end +-end +diff --git a/hypothesis-ruby/spec/basic_examples_spec.rb b/hypothesis-ruby/spec/basic_examples_spec.rb +deleted file mode 100644 +index b2a1df9..0000000 +--- a/hypothesis-ruby/spec/basic_examples_spec.rb ++++ /dev/null +@@ -1,51 +0,0 @@ +-# frozen_string_literal: true +- +-def expect_failure(&block) +- expect(&block).to raise_exception(RSpec::Expectations::ExpectationNotMetError) +-end +- +-RSpec.describe 'basic hypothesis tests' do +- they 'think integer addition is commutative' do +- hypothesis do +- x = any integers +- y = any integers +- expect(x + y).to eq(y + x) +- end +- end +- +- they 'are able to find zero values' do +- expect_failure do +- hypothesis do +- x = any integers +- expect(x).not_to eq(0) +- end +- end +- end +- +- they 'are able to filter out values' do +- hypothesis do +- x = any integers +- assume x != 0 +- 1 / x +- end +- end +- +- they 'find that string addition is not commutative' do +- expect_failure do +- hypothesis do +- x = any strings +- y = any strings +- expect(x + y).to be == y + x +- end +- end +- end +- +- they 'raise unsatisfiable when all assumptions fail' do +- expect do +- hypothesis do +- any integers +- assume false +- end +- end.to raise_exception(Hypothesis::Unsatisfiable) +- end +-end +diff --git a/hypothesis-ruby/spec/boolean_spec.rb b/hypothesis-ruby/spec/boolean_spec.rb +deleted file mode 100644 +index a46ba18..0000000 +--- a/hypothesis-ruby/spec/boolean_spec.rb ++++ /dev/null +@@ -1,13 +0,0 @@ +-# frozen_string_literal: true +- +-RSpec.describe 'booleans' do +- include Hypothesis::Debug +- +- they 'can be true' do +- find_any { any booleans } +- end +- +- they 'can be false' do +- find_any { !any(booleans) } +- end +-end +diff --git a/hypothesis-ruby/spec/choice_spec.rb b/hypothesis-ruby/spec/choice_spec.rb +deleted file mode 100644 +index b957573..0000000 +--- a/hypothesis-ruby/spec/choice_spec.rb ++++ /dev/null +@@ -1,19 +0,0 @@ +-# frozen_string_literal: true +- +-RSpec.describe 'element_of possible' do +- include Hypothesis::Debug +- +- it 'includes the first argument' do +- find_any do +- m = any element_of([0, 1]) +- m == 0 +- end +- end +- +- it 'includes the last argument' do +- find_any do +- m = any element_of([0, 1, 2, 3]) +- m == 3 +- end +- end +-end +diff --git a/hypothesis-ruby/spec/database_spec.rb b/hypothesis-ruby/spec/database_spec.rb +deleted file mode 100644 +index 1d8abda..0000000 +--- a/hypothesis-ruby/spec/database_spec.rb ++++ /dev/null +@@ -1,67 +0,0 @@ +-# frozen_string_literal: true +- +-RSpec.describe 'database usage' do +- it 'saves a minimal failing example' do +- expect do +- hypothesis do +- n = any integer +- expect(n).to be < 10 +- end +- end.to raise_exception(RSpec::Expectations::ExpectationNotMetError) +- +- saved = Dir.glob("#{Hypothesis::DEFAULT_DATABASE_PATH}/*/*") +- expect(saved.length).to be == 1 +- end +- +- it 'can be disabled' do +- expect do +- hypothesis(database: false) do +- n = any integer +- expect(n).to be < 10 +- end +- end.to raise_exception(RSpec::Expectations::ExpectationNotMetError) +- expect(File.exist?(Hypothesis::DEFAULT_DATABASE_PATH)).to be false +- end +- +- it 'replays a previously failing example' do +- # This is a very unlikely value to be hit on by random. The first +- # time we run the test we fail for any value larger than it. +- # This then shrinks to exactly equal to magic. The second time we +- # run the test we only fail in this exact magic value. This +- # demonstrates replay from the previous test is working. +- magic = 17_658 +- +- expect do +- hypothesis do +- n = any integer +- expect(n).to be < magic +- end +- end.to raise_exception(RSpec::Expectations::ExpectationNotMetError) +- +- expect do +- hypothesis do +- n = any integer +- expect(n).not_to be == magic +- end +- end.to raise_exception(RSpec::Expectations::ExpectationNotMetError) +- end +- +- it 'cleans out passing examples' do +- expect do +- hypothesis do +- n = any integer +- expect(n).to be < 10 +- end +- end.to raise_exception(RSpec::Expectations::ExpectationNotMetError) +- +- saved = Dir.glob("#{Hypothesis::DEFAULT_DATABASE_PATH}/*/*") +- expect(saved.length).to be == 1 +- +- hypothesis do +- any integer +- end +- +- saved = Dir.glob("#{Hypothesis::DEFAULT_DATABASE_PATH}/*/*") +- expect(saved.length).to be == 0 +- end +-end +diff --git a/hypothesis-ruby/spec/debug_spec.rb b/hypothesis-ruby/spec/debug_spec.rb +deleted file mode 100644 +index 547f240..0000000 +--- a/hypothesis-ruby/spec/debug_spec.rb ++++ /dev/null +@@ -1,14 +0,0 @@ +-# frozen_string_literal: true +- +-RSpec.describe 'find' do +- include Hypothesis::Debug +- +- it "raises an error if it can't find anything" do +- expect do +- find do +- any integers +- false +- end +- end.to raise_exception(Hypothesis::Debug::NoSuchExample) +- end +-end +diff --git a/hypothesis-ruby/spec/example_discovery_spec.rb b/hypothesis-ruby/spec/example_discovery_spec.rb +deleted file mode 100644 +index 208571b..0000000 +--- a/hypothesis-ruby/spec/example_discovery_spec.rb ++++ /dev/null +@@ -1,13 +0,0 @@ +-# frozen_string_literal: true +- +-RSpec.describe 'hypothesis' do +- include Hypothesis::Debug +- +- it 'can find mid sized integers' do +- n, = find do +- m = any(integers) +- m >= 100 && m <= 1000 +- end +- expect(n).to eq(100) +- end +-end +diff --git a/hypothesis-ruby/spec/example_printing_spec.rb b/hypothesis-ruby/spec/example_printing_spec.rb +deleted file mode 100644 +index 2e59248..0000000 +--- a/hypothesis-ruby/spec/example_printing_spec.rb ++++ /dev/null +@@ -1,73 +0,0 @@ +-# frozen_string_literal: true +- +-RSpec.describe 'printing examples' do +- it 'adds a statement to the exceptions string' do +- expect do +- hypothesis do +- n = any integers +- expect(n).to eq(0) +- end +- end.to raise_exception(/Given #1/) +- end +- +- it 'adds multiple statements to the exceptions string' do +- expect do +- hypothesis do +- n = any integers +- m = any integers +- expect(n).to eq(m) +- end +- end.to raise_exception(/Given #1.+Given #2/m) +- end +- +- it 'includes the name in the Given' do +- expect do +- hypothesis do +- n = any integers, name: 'fred' +- expect(n).to eq(1) +- end +- end.to raise_exception(/Given fred:/) +- end +- +- it 'does not mangle names if you reuse exceptions' do +- shared = Exception.new('Stuff') +- 3.times do +- expect do +- hypothesis do +- any integers +- raise shared +- end +- end.to raise_exception do |ex| +- expect(ex).to equal(shared) +- expect(ex.to_s.scan(/Given/).count).to eq(1) +- expect(ex.to_s.scan(/Stuff/).count).to eq(1) +- end +- end +- end +- +- it 'does not include nested anys in printing' do +- expect do +- hypothesis do +- value = any built_as do +- any integers +- any integers +- any integers +- end +- expect(value).to eq(0) +- end +- end.to raise_exception(RSpec::Expectations::ExpectationNotMetError) do |ex| +- expect(ex.to_s.scan(/Given/).count).to eq(1) +- end +- end +- +- it 'includes Given in inspect as well as to_s' do +- expect do +- hypothesis do +- n = any integers +- expect(n).to eq(0) +- end +- end.to raise_exception do |ex| +- expect(ex.inspect).to match(/Given #1/) +- end +- end +-end +diff --git a/hypothesis-ruby/spec/example_shrinking_spec.rb b/hypothesis-ruby/spec/example_shrinking_spec.rb +deleted file mode 100644 +index cc3157a..0000000 +--- a/hypothesis-ruby/spec/example_shrinking_spec.rb ++++ /dev/null +@@ -1,63 +0,0 @@ +-# frozen_string_literal: true +- +-require 'set' +- +-RSpec.describe 'shrinking' do +- include Hypothesis::Debug +- +- it 'finds lower bounds on integers' do +- n, = find { any(integers) >= 10 } +- expect(n).to eq(10) +- end +- +- it 'iterates to a fixed point' do +- @original = nil +- +- a, b = find do +- m = any integers +- n = any integers +- m > n && n > 0 +- end +- +- expect(a).to eq(2) +- expect(b).to eq(1) +- end +- +- it 'can shrink through a chain' do +- ls, = find do +- x = any built_as do +- n = any integers(min: 1, max: 100) +- any arrays(of: integers(min: 0, max: 10), min_size: n, max_size: n) +- end +- x.sum >= 50 +- end +- +- expect(ls).to_not include(0) +- end +- +- it 'can shrink through a chain without deleting first element' do +- 10.times do +- ls, = find do +- x = any built_as do +- n = any integers(min: 1, max: 100) +- any arrays(of: integers(min: 0, max: 10), min_size: n, max_size: n) +- end +- assume x[0] > 0 +- x.sum >= 50 +- end +- +- expect(ls).to_not include(0) +- end +- end +- +- it 'can shrink duplicate elements' do +- 10.times do +- ls, = find do +- x = any array(of: integers(min: 0, max: 100)) +- significant = x.select { |n| n > 0 } +- Set.new(significant).length < significant.length +- end +- expect(ls).to eq([1, 1]) +- end +- end +-end +diff --git a/hypothesis-ruby/spec/hashes_spec.rb b/hypothesis-ruby/spec/hashes_spec.rb +deleted file mode 100644 +index 32a333e..0000000 +--- a/hypothesis-ruby/spec/hashes_spec.rb ++++ /dev/null +@@ -1,25 +0,0 @@ +-# frozen_string_literal: true +- +-RSpec.describe 'fixed hash possibles' do +- they 'include all the keys' do +- hypothesis do +- x = any hash_of_shape(a: integers, b: integers) +- expect(x.size).to eq(2) +- expect(x[:a]).to be_a(Integer) +- expect(x[:b]).to be_a(Integer) +- end +- end +-end +- +-RSpec.describe 'variable hash possibles' do +- they 'respect lower bounds' do +- hypothesis do +- x = any hash_with( +- keys: integers(min: 0, max: 4), +- values: strings, +- min_size: 4 +- ) +- expect(x.size).to be >= 4 +- end +- end +-end +diff --git a/hypothesis-ruby/spec/integer_spec.rb b/hypothesis-ruby/spec/integer_spec.rb +deleted file mode 100644 +index d919aec..0000000 +--- a/hypothesis-ruby/spec/integer_spec.rb ++++ /dev/null +@@ -1,31 +0,0 @@ +-# frozen_string_literal: true +- +-RSpec.describe 'integer possibles' do +- they 'respect upper bounds' do +- hypothesis do +- expect(any(integers(max: 100))).to be <= 100 +- end +- end +- +- they 'respect lower bounds' do +- hypothesis do +- expect(any(integers(min: -100))).to be >= -100 +- end +- end +- +- they 'respect both bounds at once when lower bound is zero' do +- hypothesis do +- n = any integers(min: 0, max: 100) +- expect(n).to be <= 100 +- expect(n).to be >= 0 +- end +- end +- +- they 'respect both bounds at once when lower bound is non-zero' do +- hypothesis do +- n = any integers(min: 1, max: 100) +- expect(n).to be <= 100 +- expect(n).to be >= 1 +- end +- end +-end +diff --git a/hypothesis-ruby/spec/mixing_spec.rb b/hypothesis-ruby/spec/mixing_spec.rb +deleted file mode 100644 +index c108858..0000000 +--- a/hypothesis-ruby/spec/mixing_spec.rb ++++ /dev/null +@@ -1,17 +0,0 @@ +-# frozen_string_literal: true +- +-RSpec.describe 'from possible' do +- include Hypothesis::Debug +- +- it 'includes the first argument' do +- find_any do +- any(from(integers, strings)).is_a? Integer +- end +- end +- +- it 'includes the second argument' do +- find_any do +- any(from(integers, strings)).is_a? String +- end +- end +-end +diff --git a/hypothesis-ruby/spec/multiple_failures_spec.rb b/hypothesis-ruby/spec/multiple_failures_spec.rb +deleted file mode 100644 +index 0bc1bd9..0000000 +--- a/hypothesis-ruby/spec/multiple_failures_spec.rb ++++ /dev/null +@@ -1,42 +0,0 @@ +-# frozen_string_literal: true +- +-RSpec.describe 'tests with multiple failures' do +- they 'show multiple failures' do +- expect do +- @initial = nil +- +- hypothesis do +- x = any integers +- if @initial.nil? +- if x >= 1000 +- @initial = x +- else +- next +- end +- end +- +- expect(x).to_not eq(@initial) +- raise 'Nope' +- end +- end.to raise_exception(Hypothesis::MultipleExceptionError) { |e| +- expect(e.all_exceptions.length).to eq(2) +- } +- end +-end +- +-RSpec.describe Hypothesis::MultipleExceptionError do +- it 'includes the message from each exception' do +- exceptions = [] +- %w[hello world].each do |m| +- begin +- raise m +- rescue Exception => e +- exceptions.push(e) +- end +- end +- +- e = Hypothesis::MultipleExceptionError.new(*exceptions) +- expect(e.message).to include('hello') +- expect(e.message).to include('world') +- end +-end +diff --git a/hypothesis-ruby/spec/phase_specification_spec.rb b/hypothesis-ruby/spec/phase_specification_spec.rb +deleted file mode 100644 +index eab7763..0000000 +--- a/hypothesis-ruby/spec/phase_specification_spec.rb ++++ /dev/null +@@ -1,33 +0,0 @@ +-# frozen_string_literal: true +- +-RSpec.describe 'specifying which phases to include' do +- include Hypothesis::Debug +- +- it 'alerts of improper phase names' do +- expect do +- hypothesis(phases: [:sHrInK]) +- end.to raise_exception( +- ArgumentError, +- 'Cannot convert to Phase: sHrInK is not a valid Phase' +- ) +- end +- +- it 'alerts of attempting to exclude an unknown phase' do +- expect do +- hypothesis(phases: Phase.excluding(:unknown)) +- end.to raise_exception( +- ArgumentError, +- 'Attempting to exclude unknown phases: [:unknown]' +- ) +- end +- +- it 'does not shrink when shrinking is skipped' do +- n = 0 +- 10.times do +- n, = find(phases: Phase.excluding(:shrink)) { any(integers) >= 10 } +- break if n != 10 +- end +- +- expect(n).to_not eq(10) +- end +-end +diff --git a/hypothesis-ruby/spec/provided_list_spec.rb b/hypothesis-ruby/spec/provided_list_spec.rb +deleted file mode 100644 +index a5ac0cc..0000000 +--- a/hypothesis-ruby/spec/provided_list_spec.rb ++++ /dev/null +@@ -1,28 +0,0 @@ +-# frozen_string_literal: true +- +-RSpec.describe 'shrinking' do +- include Hypothesis::Debug +- include Hypothesis::Possibilities +- +- it 'finds a small list' do +- ls, = find { any(arrays(of: integers)).length >= 2 } +- expect(ls).to eq([0, 0]) +- end +- +- it 'shrinks a list to its last element' do +- 10.times do +- @original_target = nil +- +- ls, = find do +- v = any(arrays(of: integers)) +- +- if v.length >= 5 && @original_target.nil? && v[-1] > 0 +- @original_target = v +- end +- !@original_target.nil? && v && v[-1] == @original_target[-1] +- end +- +- expect(ls.length).to eq(1) +- end +- end +-end +diff --git a/hypothesis-ruby/spec/spec_helper.rb b/hypothesis-ruby/spec/spec_helper.rb +deleted file mode 100644 +index dbf7091..0000000 +--- a/hypothesis-ruby/spec/spec_helper.rb ++++ /dev/null +@@ -1,120 +0,0 @@ +-# frozen_string_literal: true +- +-require 'simplecov' +-SimpleCov.minimum_coverage 100 +- +-class PrintingFormatter +- # Takes a SimpleCov::Result and generates a string out of it +- def format(result) +- bad = [] +- result.files.each do |file| +- bad.push file if file.covered_percent < 100.0 +- end +- +- unless bad.empty? +- puts 'Files with missing coverage!' +- bad.each do |file| +- lines = file.source_lines.select { |l| l.coverage == 0 } +- .map(&:line_number).sort +- s = lines[0] +- groups = [[s, s]] +- lines.each do |i| +- if i <= groups[-1][-1] + 1 +- groups[-1][-1] = i +- else +- groups.push([i, i]) +- end +- end +- markers = [] +- groups.each do |g| +- if g[0] == g[1] +- markers.push(g[0].to_s) +- else +- markers.push(g.join('-')) +- end +- end +- puts "#{file.filename}: #{markers.join(', ')}" +- end +- end +- end +-end +- +-SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new( +- [SimpleCov::Formatter::HTMLFormatter, PrintingFormatter] +-) +- +-SimpleCov.start do +- add_filter do |source_file| +- name = source_file.filename +- !(name.include?('/hypothesis-ruby/lib/') || name.end_with?('hypothesis.rb')) +- end +-end +- +-require 'hypothesis' +- +-module Hypothesis +- module Debug +- class NoSuchExample < HypothesisError +- end +- +- def find(options = {}, &block) +- unless Hypothesis::World.current_engine.nil? +- raise UsageError, 'Cannot nest hypothesis calls' +- end +- begin +- Hypothesis::World.current_engine = Hypothesis::Engine.new( +- 'find', +- max_examples: options.fetch(:max_examples, 1000), +- phases: options.fetch(:phases, Phase.all) +- ) +- Hypothesis::World.current_engine.is_find = true +- Hypothesis::World.current_engine.run(&block) +- source = Hypothesis::World.current_engine.current_source +- raise NoSuchExample if source.nil? +- source.draws +- ensure +- Hypothesis::World.current_engine = nil +- end +- end +- +- def find_any(options = {}, &block) +- # Currently the same as find, but once we have config +- # options for shrinking it will turn that off. +- find(options, &block) +- end +- end +-end +- +-RSpec.configure do |config| +- config.expect_with :rspec do |expectations| +- expectations.include_chain_clauses_in_custom_matcher_descriptions = true +- end +- +- config.alias_example_to :they +- +- config.mock_with :rspec do |mocks| +- mocks.verify_partial_doubles = true +- end +- +- config.shared_context_metadata_behavior = :apply_to_host_groups +- +- config.example_status_persistence_file_path = 'spec/examples.txt' +- config.disable_monkey_patching! +- +- config.warnings = true +- +- config.default_formatter = 'doc' +- +- config.profile_examples = 10 +- +- config.order = :random +- +- Kernel.srand config.seed +- +- config.include(Hypothesis) +- config.include(Hypothesis::Possibilities) +- +- config.before(:each) do +- FileUtils.rm_rf Hypothesis::DEFAULT_DATABASE_PATH +- end +-end +diff --git a/hypothesis-ruby/spec/stable_identifier_spec.rb b/hypothesis-ruby/spec/stable_identifier_spec.rb +deleted file mode 100644 +index 07e971e..0000000 +--- a/hypothesis-ruby/spec/stable_identifier_spec.rb ++++ /dev/null +@@ -1,22 +0,0 @@ +-# frozen_string_literal: true +- +-class SomeClass +- include Hypothesis +- def stuff +- hypothesis_stable_identifier +- end +-end +- +-RSpec.describe 'stable identifiers' do +- it 'are the full rspec string' do +- expect(hypothesis_stable_identifier).to eq( +- 'stable identifiers are the full rspec string' +- ) +- end +- +- it 'fall back to a traceback' do +- ident = SomeClass.new.stuff +- expect(ident).to include(__FILE__) +- expect(ident).to include('6') +- end +-end +diff --git a/hypothesis-ruby/spec/strings_spec.rb b/hypothesis-ruby/spec/strings_spec.rb +deleted file mode 100644 +index 8ed539e..0000000 +--- a/hypothesis-ruby/spec/strings_spec.rb ++++ /dev/null +@@ -1,35 +0,0 @@ +-# frozen_string_literal: true +- +-RSpec.describe 'strings' do +- they 'respect a non-ascii lower bound' do +- hypothesis do +- expect(any(codepoints(min: 127))).to be >= 127 +- end +- end +-end +- +-RSpec.describe 'strings' do +- include Hypothesis::Debug +- +- they 'can be ascii' do +- find_any do +- s = any(strings(min_size: 3, max_size: 3)) +- s.codepoints.all? { |c| c < 127 } +- end +- end +- +- they 'can be non-ascii' do +- find_any do +- any(strings).codepoints.any? { |c| c > 127 } +- end +- end +- +- they 'produce valid strings' do +- find do +- s = any(strings) +- # Shrinking will try and fail to move this into +- # an invalid codepoint range. +- !s.empty? && s.codepoints[0] >= 56_785 +- end +- end +-end +diff --git a/hypothesis-ruby/src/lib.rs b/hypothesis-ruby/src/lib.rs +deleted file mode 100644 +index 33f9e25..0000000 +--- a/hypothesis-ruby/src/lib.rs ++++ /dev/null +@@ -1,492 +0,0 @@ +-#[macro_use] +-extern crate rutie; +-#[macro_use] +-extern crate lazy_static; +-extern crate conjecture; +- +-use std::convert::TryFrom; +-use std::mem; +- +-use rutie::{ +- AnyException, AnyObject, Array, Boolean, Class, Exception, Float, Integer, NilClass, Object, +- RString, Symbol, VM, +-}; +- +-use conjecture::data::{DataSource, Status, TestResult}; +-use conjecture::database::{BoxedDatabase, DirectoryDatabase, NoDatabase}; +-use conjecture::distributions; +-use conjecture::distributions::Repeat; +-use conjecture::engine::{Engine, Phase}; +- +-pub struct HypothesisCoreDataSourceStruct { +- source: Option, +-} +- +-impl HypothesisCoreDataSourceStruct { +- fn new(engine: &mut HypothesisCoreEngineStruct) -> HypothesisCoreDataSourceStruct { +- HypothesisCoreDataSourceStruct { +- source: mem::take(&mut engine.pending), +- } +- } +- +- fn start_draw(&mut self) { +- if let Some(ref mut source) = self.source { +- source.start_draw(); +- } +- } +- +- fn stop_draw(&mut self) { +- if let Some(ref mut source) = self.source { +- source.stop_draw(); +- } +- } +-} +- +-wrappable_struct!( +- HypothesisCoreDataSourceStruct, +- HypothesisCoreDataSourceStructWrapper, +- HYPOTHESIS_CORE_DATA_SOURCE_STRUCT_WRAPPER +-); +- +-class!(HypothesisCoreDataSource); +- +-#[rustfmt::skip] +-methods!( +- HypothesisCoreDataSource, +- itself, +- fn ruby_hypothesis_core_data_source_start_draw() -> NilClass { +- itself +- .get_data_mut(&*HYPOTHESIS_CORE_DATA_SOURCE_STRUCT_WRAPPER) +- .start_draw(); +- +- NilClass::new() +- } +- fn ruby_hypothesis_core_data_source_stop_draw() -> NilClass { +- itself +- .get_data_mut(&*HYPOTHESIS_CORE_DATA_SOURCE_STRUCT_WRAPPER) +- .stop_draw(); +- +- NilClass::new() +- } +-); +- +-pub struct HypothesisCoreEngineStruct { +- engine: Engine, +- pending: Option, +- interesting_examples: Vec, +-} +- +-impl HypothesisCoreEngineStruct { +- fn new( +- name: String, +- database_path: Option, +- seed: u64, +- max_examples: u64, +- phases: Vec, +- ) -> HypothesisCoreEngineStruct { +- let xs: [u32; 2] = [seed as u32, (seed >> 32) as u32]; +- let db: BoxedDatabase = match database_path { +- None => Box::new(NoDatabase), +- Some(path) => Box::new(DirectoryDatabase::new(path)), +- }; +- +- HypothesisCoreEngineStruct { +- engine: Engine::new(name, max_examples, phases, &xs, db), +- pending: None, +- interesting_examples: Vec::new(), +- } +- } +- +- fn new_source(&mut self) -> Option { +- match self.engine.next_source() { +- None => { +- self.interesting_examples = self.engine.list_minimized_examples(); +- None +- } +- Some(source) => { +- self.pending = Some(source); +- Some(HypothesisCoreDataSourceStruct::new(self)) +- } +- } +- } +- +- fn count_failing_examples(&self) -> usize { +- self.interesting_examples.len() +- } +- +- fn failing_example(&mut self, i: usize) -> HypothesisCoreDataSourceStruct { +- self.pending = Some(DataSource::from_vec( +- self.interesting_examples[i].record.clone(), +- )); +- HypothesisCoreDataSourceStruct::new(self) +- } +- +- fn was_unsatisfiable(&mut self) -> bool { +- self.engine.was_unsatisfiable() +- } +- +- fn finish_overflow(&mut self, child: &mut HypothesisCoreDataSourceStruct) { +- mark_child_status(&mut self.engine, child, Status::Overflow); +- } +- +- fn finish_valid(&mut self, child: &mut HypothesisCoreDataSourceStruct) { +- mark_child_status(&mut self.engine, child, Status::Valid); +- } +- +- fn finish_invalid(&mut self, child: &mut HypothesisCoreDataSourceStruct) { +- mark_child_status(&mut self.engine, child, Status::Invalid); +- } +- +- fn finish_interesting(&mut self, child: &mut HypothesisCoreDataSourceStruct, label: u64) { +- mark_child_status(&mut self.engine, child, Status::Interesting(label)); +- } +-} +- +-wrappable_struct!( +- HypothesisCoreEngineStruct, +- HypothesisCoreEngineStructWrapper, +- HYPOTHESIS_CORE_ENGINE_STRUCT_WRAPPER +-); +- +-class!(HypothesisCoreEngine); +- +-#[rustfmt::skip] +-methods!( +- HypothesisCoreEngine, +- itself, +- fn ruby_hypothesis_core_engine_new( +- name: RString, +- database_path: RString, +- seed: Integer, +- max_example: Integer, +- phases: Array +- ) -> AnyObject { +- let rust_phases = safe_access(phases) +- .into_iter() +- .map(|ruby_phase| { +- let phase_sym = safe_access(ruby_phase.try_convert_to::()); +- let phase = Phase::try_from(phase_sym.to_str()) +- .map_err(|e| AnyException::new("ArgumentError", Some(&e))); +- +- safe_access(phase) +- }) +- .collect(); +- +- let core_engine = HypothesisCoreEngineStruct::new( +- safe_access(name).to_string(), +- database_path.ok().map(|p| p.to_string()), +- safe_access(seed).to_u64(), +- safe_access(max_example).to_u64(), +- rust_phases, +- ); +- +- Class::from_existing("HypothesisCoreEngine") +- .wrap_data(core_engine, &*HYPOTHESIS_CORE_ENGINE_STRUCT_WRAPPER) +- } +- fn ruby_hypothesis_core_engine_new_source() -> AnyObject { +- match itself +- .get_data_mut(&*HYPOTHESIS_CORE_ENGINE_STRUCT_WRAPPER) +- .new_source() +- { +- Some(ds) => Class::from_existing("HypothesisCoreDataSource") +- .wrap_data(ds, &*HYPOTHESIS_CORE_DATA_SOURCE_STRUCT_WRAPPER), +- None => NilClass::new().into(), +- } +- } +- fn ruby_hypothesis_core_engine_finish_overflow(child: AnyObject) -> NilClass { +- let core_engine = itself.get_data_mut(&*HYPOTHESIS_CORE_ENGINE_STRUCT_WRAPPER); +- let mut rdata_source = safe_access(child); +- let data_source = rdata_source.get_data_mut(&*HYPOTHESIS_CORE_DATA_SOURCE_STRUCT_WRAPPER); +- +- core_engine.finish_overflow(data_source); +- +- NilClass::new() +- } +- fn ruby_hypothesis_core_engine_finish_valid(child: AnyObject) -> NilClass { +- let core_engine = itself.get_data_mut(&*HYPOTHESIS_CORE_ENGINE_STRUCT_WRAPPER); +- let mut rdata_source = safe_access(child); +- let data_source = rdata_source.get_data_mut(&*HYPOTHESIS_CORE_DATA_SOURCE_STRUCT_WRAPPER); +- +- core_engine.finish_valid(data_source); +- +- NilClass::new() +- } +- fn ruby_hypothesis_core_engine_finish_invalid(child: AnyObject) -> NilClass { +- let core_engine = itself.get_data_mut(&*HYPOTHESIS_CORE_ENGINE_STRUCT_WRAPPER); +- let mut rdata_source = safe_access(child); +- let data_source = rdata_source.get_data_mut(&*HYPOTHESIS_CORE_DATA_SOURCE_STRUCT_WRAPPER); +- +- core_engine.finish_invalid(data_source); +- +- NilClass::new() +- } +- fn ruby_hypothesis_core_engine_finish_interesting( +- child: AnyObject, +- label: Integer +- ) -> NilClass { +- let core_engine = itself.get_data_mut(&*HYPOTHESIS_CORE_ENGINE_STRUCT_WRAPPER); +- let mut rdata_source = safe_access(child); +- let data_source = rdata_source.get_data_mut(&*HYPOTHESIS_CORE_DATA_SOURCE_STRUCT_WRAPPER); +- +- core_engine.finish_interesting(data_source, safe_access(label).to_u64()); +- +- NilClass::new() +- } +- fn ruby_hypothesis_core_engine_count_failing_examples() -> Integer { +- let core_engine = itself.get_data(&*HYPOTHESIS_CORE_ENGINE_STRUCT_WRAPPER); +- +- Integer::new(core_engine.count_failing_examples() as i64) +- } +- fn ruby_hypothesis_core_failing_example(i: Integer) -> AnyObject { +- let core_engine = itself.get_data_mut(&*HYPOTHESIS_CORE_ENGINE_STRUCT_WRAPPER); +- let int = safe_access(i).to_u64() as usize; +- +- let data_source = core_engine.failing_example(int); +- +- Class::from_existing("HypothesisCoreDataSource") +- .wrap_data(data_source, &*HYPOTHESIS_CORE_DATA_SOURCE_STRUCT_WRAPPER) +- } +- fn ruby_hypothesis_core_engine_was_unsatisfiable() -> Boolean { +- let core_engine = itself.get_data_mut(&*HYPOTHESIS_CORE_ENGINE_STRUCT_WRAPPER); +- +- Boolean::new(core_engine.was_unsatisfiable()) +- } +-); +- +-pub struct HypothesisCoreIntegersStruct { +- bitlengths: distributions::Sampler, +-} +- +-impl HypothesisCoreIntegersStruct { +- fn new() -> HypothesisCoreIntegersStruct { +- HypothesisCoreIntegersStruct { +- bitlengths: distributions::good_bitlengths(), +- } +- } +- +- fn provide(&mut self, data: &mut HypothesisCoreDataSourceStruct) -> Option { +- data.source.as_mut().and_then(|ref mut source| { +- distributions::integer_from_bitlengths(source, &self.bitlengths).ok() +- }) +- } +-} +- +-wrappable_struct!( +- HypothesisCoreIntegersStruct, +- HypothesisCoreIntegersStructWrapper, +- HYPOTHESIS_CORE_INTEGERS_STRUCT_WRAPPER +-); +- +-class!(HypothesisCoreIntegers); +- +-#[rustfmt::skip] +-methods!( +- HypothesisCoreIntegers, +- itself, +- fn ruby_hypothesis_core_integers_new() -> AnyObject { +- let core_integers = HypothesisCoreIntegersStruct::new(); +- +- Class::from_existing("HypothesisCoreIntegers") +- .wrap_data(core_integers, &*HYPOTHESIS_CORE_INTEGERS_STRUCT_WRAPPER) +- } +- fn ruby_hypothesis_core_integers_provide(data: AnyObject) -> AnyObject { +- let core_integers = itself.get_data_mut(&*HYPOTHESIS_CORE_INTEGERS_STRUCT_WRAPPER); +- let mut rdata = safe_access(data); +- let data_source = rdata.get_data_mut(&*HYPOTHESIS_CORE_DATA_SOURCE_STRUCT_WRAPPER); +- +- match core_integers.provide(data_source) { +- Some(i) => Integer::new(i).into(), +- None => NilClass::new().into(), +- } +- } +-); +- +-pub struct HypothesisCoreRepeatValuesStruct { +- repeat: Repeat, +-} +- +-impl HypothesisCoreRepeatValuesStruct { +- fn new( +- min_count: u64, +- max_count: u64, +- expected_count: f64, +- ) -> HypothesisCoreRepeatValuesStruct { +- HypothesisCoreRepeatValuesStruct { +- repeat: Repeat::new(min_count, max_count, expected_count), +- } +- } +- +- fn _should_continue(&mut self, data: &mut HypothesisCoreDataSourceStruct) -> Option { +- return data +- .source +- .as_mut() +- .and_then(|ref mut source| self.repeat.should_continue(source).ok()); +- } +- +- fn reject(&mut self) { +- self.repeat.reject(); +- } +-} +- +-wrappable_struct!( +- HypothesisCoreRepeatValuesStruct, +- HypothesisCoreRepeatValuesStructWrapper, +- HYPOTHESIS_CORE_REPEAT_VALUES_STRUCT_WRAPPER +-); +- +-class!(HypothesisCoreRepeatValues); +- +-#[rustfmt::skip] +-methods!( +- HypothesisCoreRepeatValues, +- itself, +- fn ruby_hypothesis_core_repeat_values_new( +- min_count: Integer, +- max_count: Integer, +- expected_count: Float +- ) -> AnyObject { +- let repeat_values = HypothesisCoreRepeatValuesStruct::new( +- safe_access(min_count).to_u64(), +- safe_access(max_count).to_u64(), +- safe_access(expected_count).to_f64(), +- ); +- +- Class::from_existing("HypothesisCoreRepeatValues").wrap_data( +- repeat_values, +- &*HYPOTHESIS_CORE_REPEAT_VALUES_STRUCT_WRAPPER, +- ) +- } +- fn ruby_hypothesis_core_repeat_values_should_continue(data: AnyObject) -> AnyObject { +- let mut rdata = safe_access(data); +- let mut data_source = rdata.get_data_mut(&*HYPOTHESIS_CORE_DATA_SOURCE_STRUCT_WRAPPER); +- +- let should_continue = itself +- .get_data_mut(&*HYPOTHESIS_CORE_REPEAT_VALUES_STRUCT_WRAPPER) +- ._should_continue(data_source); +- +- match should_continue { +- Some(b) => Boolean::new(b).into(), +- None => NilClass::new().into(), +- } +- } +- fn ruby_hypothesis_core_repeat_values_reject() -> NilClass { +- let repeat_values = itself.get_data_mut(&*HYPOTHESIS_CORE_REPEAT_VALUES_STRUCT_WRAPPER); +- +- repeat_values.reject(); +- +- NilClass::new() +- } +-); +- +-pub struct HypothesisCoreBoundedIntegersStruct { +- max_value: u64, +-} +- +-impl HypothesisCoreBoundedIntegersStruct { +- fn provide(&mut self, data: &mut HypothesisCoreDataSourceStruct) -> Option { +- data.source +- .as_mut() +- .and_then(|ref mut source| distributions::bounded_int(source, self.max_value).ok()) +- } +-} +- +-wrappable_struct!( +- HypothesisCoreBoundedIntegersStruct, +- HypothesisCoreBoundedIntegersStructWrapper, +- HYPOTHESIS_CORE_BOUNDED_INTEGERS_STRUCT_WRAPPER +-); +- +-class!(HypothesisCoreBoundedIntegers); +- +-#[rustfmt::skip] +-methods!( +- HypothesisCoreBoundedIntegers, +- itself, +- fn ruby_hypothesis_core_bounded_integers_new(max_value: Integer) -> AnyObject { +- let bounded_integers = HypothesisCoreBoundedIntegersStruct { +- max_value: safe_access(max_value).to_u64(), +- }; +- +- Class::from_existing("HypothesisCoreBoundedIntegers").wrap_data( +- bounded_integers, +- &*HYPOTHESIS_CORE_BOUNDED_INTEGERS_STRUCT_WRAPPER, +- ) +- } +- fn ruby_hypothesis_core_bounded_integers_provide(data: AnyObject) -> AnyObject { +- let mut rdata = safe_access(data); +- let data_source = rdata.get_data_mut(&*HYPOTHESIS_CORE_DATA_SOURCE_STRUCT_WRAPPER); +- let bounded_integers = +- itself.get_data_mut(&*HYPOTHESIS_CORE_BOUNDED_INTEGERS_STRUCT_WRAPPER); +- +- match bounded_integers.provide(data_source) { +- Some(i) => Integer::from(i).into(), +- None => NilClass::new().into(), +- } +- } +-); +- +-#[allow(non_snake_case)] +-#[no_mangle] +-pub extern "C" fn Init_rutie_hypothesis_core() { +- Class::new("HypothesisCoreEngine", None).define(|klass| { +- klass.def_self("new", ruby_hypothesis_core_engine_new); +- klass.def("new_source", ruby_hypothesis_core_engine_new_source); +- klass.def( +- "count_failing_examples", +- ruby_hypothesis_core_engine_count_failing_examples, +- ); +- klass.def("failing_example", ruby_hypothesis_core_failing_example); +- klass.def( +- "was_unsatisfiable", +- ruby_hypothesis_core_engine_was_unsatisfiable, +- ); +- klass.def( +- "finish_overflow", +- ruby_hypothesis_core_engine_finish_overflow, +- ); +- klass.def("finish_valid", ruby_hypothesis_core_engine_finish_valid); +- klass.def("finish_invalid", ruby_hypothesis_core_engine_finish_invalid); +- klass.def( +- "finish_interesting", +- ruby_hypothesis_core_engine_finish_interesting, +- ); +- }); +- +- Class::new("HypothesisCoreDataSource", None).define(|klass| { +- klass.def("start_draw", ruby_hypothesis_core_data_source_start_draw); +- klass.def("stop_draw", ruby_hypothesis_core_data_source_stop_draw); +- }); +- +- Class::new("HypothesisCoreIntegers", None).define(|klass| { +- klass.def_self("new", ruby_hypothesis_core_integers_new); +- klass.def("provide", ruby_hypothesis_core_integers_provide); +- }); +- +- Class::new("HypothesisCoreRepeatValues", None).define(|klass| { +- klass.def_self("new", ruby_hypothesis_core_repeat_values_new); +- klass.def( +- "_should_continue", +- ruby_hypothesis_core_repeat_values_should_continue, +- ); +- klass.def("reject", ruby_hypothesis_core_repeat_values_reject); +- }); +- +- Class::new("HypothesisCoreBoundedIntegers", None).define(|klass| { +- klass.def_self("new", ruby_hypothesis_core_bounded_integers_new); +- klass.def("provide", ruby_hypothesis_core_bounded_integers_provide); +- }); +-} +- +-fn mark_child_status( +- engine: &mut Engine, +- child: &mut HypothesisCoreDataSourceStruct, +- status: Status, +-) { +- if let Some(source) = mem::take(&mut child.source) { +- engine.mark_finished(source, status) +- } +-} +- +-fn safe_access(value: Result) -> T { +- value.map_err(VM::raise_ex).unwrap() +-} +-- +2.41.3 + diff --git a/python-hypothesis.spec b/python-hypothesis.spec index 8a2b669..a69dade 100644 --- a/python-hypothesis.spec +++ b/python-hypothesis.spec @@ -1,10 +1,11 @@ Summary: Library for property based testing Name: python-hypothesis -Version: 6.87.0 -Release: 4%{?dist} +Version: 6.104.2 +Release: 1%{?dist} License: MPLv2.0 URL: https://github.com/HypothesisWorks/hypothesis Source0: %{url}/archive/hypothesis-python-%{version}/hypothesis-%{version}.tar.gz +Patch1: 5001-Remove-the-hypothesis-ruby-directory.patch BuildRequires: python3-devel pyproject-rpm-macros @@ -241,6 +242,10 @@ sed -i -e '/sphinx_codeautolink/d' docs/conf.py %changelog +* Tue May 20 2025 Upgrade Robot - 6.104.2-1 +- [Type] security +- [DESC] Upgrade to version 6.104.2 + * Thu Sep 26 2024 OpenCloudOS Release Engineering - 6.87.0-4 - Rebuilt for clarifying the packages requirement in BaseOS and AppStream diff --git a/sources b/sources index 47f9472..6be8f50 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (hypothesis-6.87.0.tar.gz) = 2f11d3bfff9c6f6322e368b40987d5379d0aeb619c5017a746ac935e43f50381d4ad8e180765cfddf5196a4f0f69f89df48cc9069e9d3f79446e5d396c673a3b +SHA512 (hypothesis-6.104.2.tar.gz) = 18b11669bc1d2ba6e7ef0854823c22798fa86e988d951a223235160460fb79b5a5d10caf8fc7aa06ba5996c75ff7e8146725bf1ed3b9b4e169f93cbfa0bf2776 -- Gitee