1
0
mirror of https://github.com/go-task/task.git synced 2025-06-15 00:15:10 +02:00

Issue #519: Allow includes to be optional

This commit is contained in:
Sally Young
2021-08-11 17:28:44 +01:00
parent 50e5813222
commit 8f80fc4e2c
8 changed files with 93 additions and 1 deletions

View File

@ -755,6 +755,41 @@ func TestIncludesCallingRoot(t *testing.T) {
tt.Run(t)
}
func TestIncludesOptional(t *testing.T) {
tt := fileContentTest{
Dir: "testdata/includes_optional",
Target: "default",
TrimSpace: true,
Files: map[string]string{
"called_dep.txt": "called_dep",
}}
tt.Run(t)
}
func TestIncludesOptionalImplicitFalse(t *testing.T) {
e := task.Executor{
Dir: "testdata/includes_optional_implicit_false",
Stdout: ioutil.Discard,
Stderr: ioutil.Discard,
}
err := e.Setup()
assert.Error(t, err)
assert.Equal(t, "stat testdata/includes_optional_implicit_false/TaskfileOptional.yml: no such file or directory", err.Error())
}
func TestIncludesOptionalExplicitFalse(t *testing.T) {
e := task.Executor{
Dir: "testdata/includes_optional_explicit_false",
Stdout: ioutil.Discard,
Stderr: ioutil.Discard,
}
err := e.Setup()
assert.Error(t, err)
assert.Equal(t, "stat testdata/includes_optional_explicit_false/TaskfileOptional.yml: no such file or directory", err.Error())
}
func TestSummary(t *testing.T) {
const dir = "testdata/summary"