Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement fixed hash arbitrary and allow to pass kwargs as arbitraries #7

Merged
merged 1 commit into from
Mar 30, 2024

Conversation

ohbarye
Copy link
Owner

@ohbarye ohbarye commented Mar 30, 2024

Change

This adds FixedHashArbitrary to generate/shrink a Hash.

Also this allows to pass keyword arbitrary to Pbt.property and its predicate method.

Pbt.assert do
  Pbt.property(x: Pbt.integer, y: Pbt.integer) do |hash|
    # use hash
  end
end

Note: I wanted to pass keyword arguments with destructuring but Ractor doesn't allow the usage. Ractor interprets the keyword arguments as its own and raises ArgumentError.

  Pbt.property(x: Pbt.integer, y: Pbt.integer) do |x:, y:|
    # use x, y
  end
Ractor.new(x: 1, y: 2) { |x:, y:| }
# unknown keyword: :x, :y (ArgumentError)

@ohbarye ohbarye merged commit 442da65 into main Mar 30, 2024
3 checks passed
@ohbarye ohbarye deleted the allow-to-pass-kwargs branch April 7, 2024 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant