Skip to content

Commit

Permalink
Update doc comments
Browse files Browse the repository at this point in the history
  • Loading branch information
flyingmutant committed Aug 24, 2022
1 parent ff836af commit 64593fd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
26 changes: 13 additions & 13 deletions engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ func assertValidRange(min int, max int) {
// Check fails the current test if rapid can find a test case which falsifies prop.
//
// Property is falsified in case of a panic or a call to
// (*T).Fatalf, (*T).Fatal, (*T).Errorf, (*T).Error, (*T).FailNow or (*T).Fail.
// [*T.Fatalf], [*T.Fatal], [*T.Errorf], [*T.Error], [*T.FailNow] or [*T.Fail].
func Check(t *testing.T, prop func(*T)) {
t.Helper()
checkTB(t, prop)
}

// MakeCheck is a convenience function for defining subtests suitable for
// (*testing.T).Run. It allows you to write this:
// [*testing.T.Run]. It allows you to write this:
//
// t.Run("subtest name", rapid.MakeCheck(func(t *rapid.T) {
// // test code
Expand Down Expand Up @@ -369,7 +369,7 @@ func traceback(err *testError) string {
return err.traceback
}

// TB is a common interface between *testing.T, *testing.B and *T.
// TB is a common interface between [*testing.T], [*testing.B] and [*T].
type TB interface {
Helper()
Name() string
Expand Down Expand Up @@ -399,11 +399,11 @@ type tb interface {
Failed() bool
}

// T is similar to testing.T, but with extra bookkeeping for property-based tests.
// T is similar to [testing.T], but with extra bookkeeping for property-based tests.
//
// For tests to be reproducible, they should generally run in a single goroutine.
// If concurrency is unavoidable, methods on *T, such as Helper and Errorf, are safe for concurrent calls,
// but Draw from a given *T is not.
// If concurrency is unavoidable, methods on *T, such as [*testing.T.Helper] and [*T.Errorf],
// are safe for concurrent calls, but *Generator.Draw from a given *T is not.
type T struct {
tb // unnamed to force re-export of (*T).Helper()
tbLog bool
Expand Down Expand Up @@ -484,7 +484,7 @@ func (t *T) Log(args ...interface{}) {
}
}

// Skipf is equivalent to Logf followed by SkipNow.
// Skipf is equivalent to [T.Logf] followed by [T.SkipNow].
func (t *T) Skipf(format string, args ...interface{}) {
if t.tbLog && t.tb != nil {
t.tb.Helper()
Expand All @@ -493,7 +493,7 @@ func (t *T) Skipf(format string, args ...interface{}) {
t.skip(fmt.Sprintf(format, args...))
}

// Skip is equivalent to Log followed by SkipNow.
// Skip is equivalent to [T.Log] followed by [T.SkipNow].
func (t *T) Skip(args ...interface{}) {
if t.tbLog && t.tb != nil {
t.tb.Helper()
Expand All @@ -507,13 +507,13 @@ func (t *T) Skip(args ...interface{}) {
// If too many test cases are skipped, rapid will mark the test as failing
// due to inability to generate enough valid test cases.
//
// Prefer Filter to SkipNow, and prefer generators that always produce
// Prefer *Generator.Filter to SkipNow, and prefer generators that always produce
// valid test cases to Filter.
func (t *T) SkipNow() {
t.skip("(*T).SkipNow() called")
}

// Errorf is equivalent to Logf followed by Fail.
// Errorf is equivalent to [T.Logf] followed by [T.Fail].
func (t *T) Errorf(format string, args ...interface{}) {
if t.tbLog && t.tb != nil {
t.tb.Helper()
Expand All @@ -522,7 +522,7 @@ func (t *T) Errorf(format string, args ...interface{}) {
t.fail(false, fmt.Sprintf(format, args...))
}

// Error is equivalent to Log followed by Fail.
// Error is equivalent to [T.Log] followed by [T.Fail].
func (t *T) Error(args ...interface{}) {
if t.tbLog && t.tb != nil {
t.tb.Helper()
Expand All @@ -531,7 +531,7 @@ func (t *T) Error(args ...interface{}) {
t.fail(false, fmt.Sprint(args...))
}

// Fatalf is equivalent to Logf followed by FailNow.
// Fatalf is equivalent to [T.Logf] followed by [T.FailNow].
func (t *T) Fatalf(format string, args ...interface{}) {
if t.tbLog && t.tb != nil {
t.tb.Helper()
Expand All @@ -540,7 +540,7 @@ func (t *T) Fatalf(format string, args ...interface{}) {
t.fail(true, fmt.Sprintf(format, args...))
}

// Fatal is equivalent to Log followed by FailNow.
// Fatal is equivalent to [T.Log] followed by [T.FailNow].
func (t *T) Fatal(args ...interface{}) {
if t.tbLog && t.tb != nil {
t.tb.Helper()
Expand Down
2 changes: 1 addition & 1 deletion statemachine.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type StateMachine interface {
}

// Run is a convenience function for defining "state machine" tests,
// to be run by Check or MakeCheck.
// to be run by [Check] or [MakeCheck].
//
// State machine test is a pattern for testing stateful systems that looks
// like this:
Expand Down

0 comments on commit 64593fd

Please sign in to comment.