forked from stretchr/testify
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdoc.go
More file actions
37 lines (36 loc) · 1.27 KB
/
doc.go
File metadata and controls
37 lines (36 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// SPDX-FileCopyrightText: Copyright 2025 go-swagger maintainers
// SPDX-License-Identifier: Apache-2.0
// Package require implements the same assertions as the assert package but
// stops test execution when a test fails.
//
// # Example usage
//
// The following is a complete example using require in a standard test function:
//
// import (
// "testing"
// "github.com/go-openapi/testify/v2/require"
// )
//
// func TestSomething(t *testing.T) {
// var a string = "Hello"
// var b string = "Hello"
//
// require.Equal(t, a, b, "The two words should be the same.")
// }
//
// # Assertions
//
// The require package exposes the same functions as the assert package,
// but instead of returning a boolean result the functions call [testing.T.FailNow].
//
// A consequence of this is that it must be called from the goroutine running
// the test function, not from other goroutines created during the test.
//
// Every assertion function takes an optional string message as the final argument,
// allowing custom error messages to be appended to the message the assertion method outputs.
//
// See our doc site at https://go-openapi.github.io/testify/ for usage, examples and searchable reference.
//
// See https://pkg.go/dev/go-openapi/testify/ for complete reference.
package require