Skip to content

Commit c9d5f4c

Browse files
committed
route table-driven error checks through shared helper
1 parent 90257fb commit c9d5f4c

2 files changed

Lines changed: 3 additions & 9 deletions

File tree

vibes/examples_test.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55
"maps"
66
"path/filepath"
7-
"strings"
87
"testing"
98
)
109

@@ -2040,9 +2039,7 @@ func TestExamples(t *testing.T) {
20402039
if err == nil {
20412040
t.Fatalf("expected error %q, got nil", tc.wantErr)
20422041
}
2043-
if !strings.Contains(err.Error(), tc.wantErr) {
2044-
t.Fatalf("expected error containing %q, got %q", tc.wantErr, err.Error())
2045-
}
2042+
requireErrorContains(t, err, tc.wantErr)
20462043
} else {
20472044
if err != nil {
20482045
t.Fatalf("unexpected error: %v", err)

vibes/modules_test.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,8 @@ end`,
9393
for _, tc := range cases {
9494
t.Run(tc.name, func(t *testing.T) {
9595
script := compileScriptWithEngine(t, engine, tc.source)
96-
if _, err := script.Call(context.Background(), "run", nil, CallOptions{}); err == nil {
97-
t.Fatalf("expected alias validation error")
98-
} else if !strings.Contains(err.Error(), tc.wantErr) {
99-
t.Fatalf("unexpected error: %v", err)
100-
}
96+
err := callScriptErr(t, context.Background(), script, "run", nil, CallOptions{})
97+
requireErrorContains(t, err, tc.wantErr)
10198
})
10299
}
103100
}

0 commit comments

Comments
 (0)