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

Improve error handle #25

Merged
merged 4 commits into from
May 6, 2024
Merged

Improve error handle #25

merged 4 commits into from
May 6, 2024

Conversation

ohbarye
Copy link
Owner

@ohbarye ohbarye commented May 6, 2024

Change

  1. Make error messages short to keep focusing on error causes.
  2. Do not exit on RSpec::Expectations::ExpectationNotMetError that inherits Exception so that pbt continues shrinking phase.
RSpec.describe Pbt do
  it "sorts an array" do
    Pbt.assert do
      Pbt.property(Pbt.array(Pbt.integer)) do |numbers|
        result = sort(numbers)
        result.each_cons(2) do |x, y|
          expect(x).to be <= y
        end
      end
    end
  end
end

ohbarye added 4 commits May 6, 2024 16:07
- Short backtrace because most backtraces are pbt gem's.
- Skip hints because it's for first-time users only. It could be annoying for long-time users.
because RSpec matcher raises ExpectationNotMet that inherits Exception.
@ohbarye ohbarye enabled auto-merge May 6, 2024 07:15
@ohbarye ohbarye merged commit eb61288 into main May 6, 2024
3 checks passed
@ohbarye ohbarye deleted the improve-error-handle branch May 6, 2024 07:15
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