mirror of
https://github.com/go-task/task.git
synced 2025-09-13 06:46:31 +03:00
Write first test for deps
This commit is contained in:
45
task_test.go
Normal file
45
task_test.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package task_test
|
||||
|
||||
import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestDeps(t *testing.T) {
|
||||
const dir = "testdata/deps"
|
||||
|
||||
files := []string{
|
||||
"d1.txt",
|
||||
"d2.txt",
|
||||
"d3.txt",
|
||||
"d11.txt",
|
||||
"d12.txt",
|
||||
"d13.txt",
|
||||
"d21.txt",
|
||||
"d22.txt",
|
||||
"d23.txt",
|
||||
"d31.txt",
|
||||
"d32.txt",
|
||||
"d33.txt",
|
||||
}
|
||||
|
||||
for _, f := range files {
|
||||
_ = os.Remove(f)
|
||||
}
|
||||
|
||||
c := exec.Command("task")
|
||||
c.Dir = dir
|
||||
if err := c.Run(); err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
for _, f := range files {
|
||||
f = filepath.Join(dir, f)
|
||||
if _, err := os.Stat(f); err != nil {
|
||||
t.Errorf("File %s should exists", f)
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user