TIL t.Helper()
This commit is contained in:
parent
cb7bd6e3ba
commit
d6a49593b7
@ -7,16 +7,19 @@ import (
|
||||
|
||||
func TestExecute(t *testing.T) {
|
||||
assertLen := func(items []Item, length int) {
|
||||
t.Helper()
|
||||
if len(items) != length {
|
||||
t.Fatalf("Expected %d items, got %d", length, len(items))
|
||||
}
|
||||
}
|
||||
assertNil := func(err error) {
|
||||
t.Helper()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
assertNotNil := func(err error) {
|
||||
t.Helper()
|
||||
if err == nil {
|
||||
t.Fatal("expected err")
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import (
|
||||
)
|
||||
|
||||
func AssertItemIs(t *testing.T, item Item, expected string) {
|
||||
t.Helper()
|
||||
actual := fmt.Sprintf(
|
||||
"%s/%s/%t/%s/%s/%s/%s/%d",
|
||||
item.Source,
|
||||
|
@ -142,6 +142,7 @@ func TestOnCreateAction(t *testing.T) {
|
||||
}
|
||||
|
||||
execute := func(argv []string) []Item {
|
||||
t.Helper()
|
||||
items, _, err := Execute("test", argv, nil, nil, "", time.Minute)
|
||||
if err != nil {
|
||||
t.Fatal("unexpected error executing test fetch")
|
||||
@ -153,12 +154,14 @@ func TestOnCreateAction(t *testing.T) {
|
||||
}
|
||||
|
||||
onCreate := func(argv []string) {
|
||||
t.Helper()
|
||||
if err := UpdateAction(db, "test", "on_create", argv); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
getItem := func(id string) Item {
|
||||
t.Helper()
|
||||
item, err := GetItem(db, "test", id)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
Loading…
Reference in New Issue
Block a user