mirror of
https://github.com/mgechev/revive.git
synced 2024-12-12 10:44:59 +02:00
34 lines
596 B
Go
34 lines
596 B
Go
package fixtures
|
|
|
|
import (
|
|
"errors"
|
|
"log"
|
|
"os"
|
|
"testing"
|
|
)
|
|
|
|
func TestMain(m *testing.M) {
|
|
// call flag.Parse() here if TestMain uses flags
|
|
os.Exit(m.Run())
|
|
}
|
|
|
|
// Testable package level example
|
|
func Example() {
|
|
log.Fatal(errors.New("example"))
|
|
}
|
|
|
|
// Testable function example
|
|
func ExampleFoo() {
|
|
log.Fatal(errors.New("example"))
|
|
}
|
|
|
|
// Testable method example
|
|
func ExampleBar_Qux() {
|
|
log.Fatal(errors.New("example"))
|
|
}
|
|
|
|
// Not an example because it has an argument
|
|
func ExampleBar(int) {
|
|
log.Fatal(errors.New("example")) // MATCH /calls to log.Fatal only in main() or init() functions/
|
|
}
|