mirror of
https://github.com/go-task/task.git
synced 2024-12-12 10:45:49 +02:00
Add file path to YAML error message
This commit is contained in:
parent
fb0e43989d
commit
81de61d8db
14
task_test.go
14
task_test.go
@ -838,6 +838,20 @@ func TestIncorrectVersionIncludes(t *testing.T) {
|
|||||||
assert.EqualError(t, e.Setup(), expectedError)
|
assert.EqualError(t, e.Setup(), expectedError)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestIncludesIncorrect(t *testing.T) {
|
||||||
|
const dir = "testdata/includes_incorrect"
|
||||||
|
|
||||||
|
var buff bytes.Buffer
|
||||||
|
e := task.Executor{
|
||||||
|
Dir: dir,
|
||||||
|
Stdout: &buff,
|
||||||
|
Stderr: &buff,
|
||||||
|
Silent: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.Error(t, e.Setup())
|
||||||
|
}
|
||||||
|
|
||||||
func TestIncludesEmptyMain(t *testing.T) {
|
func TestIncludesEmptyMain(t *testing.T) {
|
||||||
tt := fileContentTest{
|
tt := fileContentTest{
|
||||||
Dir: "testdata/includes_empty",
|
Dir: "testdata/includes_empty",
|
||||||
|
@ -188,7 +188,10 @@ func readTaskfile(file string) (*taskfile.Taskfile, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
var t taskfile.Taskfile
|
var t taskfile.Taskfile
|
||||||
return &t, yaml.NewDecoder(f).Decode(&t)
|
if err := yaml.NewDecoder(f).Decode(&t); err != nil {
|
||||||
|
return nil, fmt.Errorf("%s: %w", file, err)
|
||||||
|
}
|
||||||
|
return &t, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func exists(path string) (string, error) {
|
func exists(path string) (string, error) {
|
||||||
|
4
testdata/includes_incorrect/Taskfile.yml
vendored
Normal file
4
testdata/includes_incorrect/Taskfile.yml
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
version: '3'
|
||||||
|
|
||||||
|
includes:
|
||||||
|
included: incomplete.yml
|
4
testdata/includes_incorrect/incomplete.yml
vendored
Normal file
4
testdata/includes_incorrect/incomplete.yml
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
version: '3'
|
||||||
|
|
||||||
|
name:
|
||||||
|
'test
|
Loading…
Reference in New Issue
Block a user