mirror of
https://github.com/go-task/task.git
synced 2025-12-16 03:37:48 +01:00
feat: test wildcards
This commit is contained in:
@@ -967,3 +967,55 @@ func TestIncludeChecksum(t *testing.T) {
|
|||||||
WithFixtureTemplating(),
|
WithFixtureTemplating(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestWildcard(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
tests := []struct {
|
||||||
|
name string
|
||||||
|
call string
|
||||||
|
wantErr bool
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
name: "basic wildcard",
|
||||||
|
call: "wildcard-foo",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "double wildcard",
|
||||||
|
call: "foo-wildcard-bar",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "store wildcard",
|
||||||
|
call: "start-foo",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "matches exactly",
|
||||||
|
call: "matches-exactly-*",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "no matches",
|
||||||
|
call: "no-match",
|
||||||
|
wantErr: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "multiple matches",
|
||||||
|
call: "wildcard-foo-bar",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, test := range tests {
|
||||||
|
opts := []ExecutorTestOption{
|
||||||
|
WithName(test.name),
|
||||||
|
WithNodeDir("testdata/wildcards"),
|
||||||
|
WithExecutorOptions(
|
||||||
|
task.WithSilent(true),
|
||||||
|
task.WithForce(true),
|
||||||
|
),
|
||||||
|
WithTask(test.call),
|
||||||
|
}
|
||||||
|
if test.wantErr {
|
||||||
|
opts = append(opts, WithRunError())
|
||||||
|
}
|
||||||
|
NewExecutorTest(t, opts...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
4423
task_test.go
4423
task_test.go
File diff suppressed because it is too large
Load Diff
1
testdata/wildcards/testdata/TestWildcard-basic_wildcard.golden
vendored
Normal file
1
testdata/wildcards/testdata/TestWildcard-basic_wildcard.golden
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Hello foo
|
||||||
1
testdata/wildcards/testdata/TestWildcard-double_wildcard.golden
vendored
Normal file
1
testdata/wildcards/testdata/TestWildcard-double_wildcard.golden
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Hello foo bar
|
||||||
1
testdata/wildcards/testdata/TestWildcard-matches_exactly.golden
vendored
Normal file
1
testdata/wildcards/testdata/TestWildcard-matches_exactly.golden
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
I don't consume matches: []
|
||||||
1
testdata/wildcards/testdata/TestWildcard-multiple_matches.golden
vendored
Normal file
1
testdata/wildcards/testdata/TestWildcard-multiple_matches.golden
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Hello foo-bar
|
||||||
1
testdata/wildcards/testdata/TestWildcard-no_matches-err-run.golden
vendored
Normal file
1
testdata/wildcards/testdata/TestWildcard-no_matches-err-run.golden
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
task: Task "no-match" does not exist
|
||||||
1
testdata/wildcards/testdata/TestWildcard-no_matches.golden
vendored
Normal file
1
testdata/wildcards/testdata/TestWildcard-no_matches.golden
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
task: No tasks with description available. Try --list-all to list all tasks
|
||||||
1
testdata/wildcards/testdata/TestWildcard-store_wildcard.golden
vendored
Normal file
1
testdata/wildcards/testdata/TestWildcard-store_wildcard.golden
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Starting foo
|
||||||
Reference in New Issue
Block a user