tests: add a post-processor that creates an unnamed.txt file

This commit is contained in:
Adrien Delorme 2019-02-20 11:03:17 +01:00
parent de336ef15e
commit 7e2d86731e
2 changed files with 18 additions and 6 deletions

View File

@ -28,7 +28,7 @@ func TestBuildOnlyFileCommaFlags(t *testing.T) {
}
for _, f := range []string{"chocolate.txt", "vanilla.txt",
"apple.txt", "peach.txt", "pear.txt"} {
"apple.txt", "peach.txt", "pear.txt", "unnamed.txt"} {
if !fileExists(f) {
t.Errorf("Expected to find %s", f)
}
@ -62,7 +62,8 @@ func TestBuildStdin(t *testing.T) {
fatalCommand(t, c.Meta)
}
for _, f := range []string{"vanilla.txt", "cherry.txt", "chocolate.txt"} {
for _, f := range []string{"vanilla.txt", "cherry.txt", "chocolate.txt",
"unnamed.txt"} {
if !fileExists(f) {
t.Errorf("Expected to find %s", f)
}
@ -95,7 +96,7 @@ func TestBuildOnlyFileMultipleFlags(t *testing.T) {
}
}
for _, f := range []string{"chocolate.txt", "cherry.txt",
"apple.txt", "peach.txt", "pear.txt"} {
"apple.txt", "peach.txt", "pear.txt", "unnamed.txt"} {
if !fileExists(f) {
t.Errorf("Expected to find %s", f)
}
@ -108,7 +109,7 @@ func TestBuildEverything(t *testing.T) {
}
args := []string{
`-except=""`,
`-except=`,
filepath.Join(testFixture("build-only"), "template.json"),
}
@ -119,7 +120,7 @@ func TestBuildEverything(t *testing.T) {
}
for _, f := range []string{"chocolate.txt", "vanilla.txt", "tomato.txt",
"apple.txt", "cherry.txt", "pear.txt", "peach.txt"} {
"apple.txt", "cherry.txt", "pear.txt", "peach.txt", "unnamed.txt"} {
if !fileExists(f) {
t.Errorf("Expected to find %s", f)
}
@ -142,7 +143,8 @@ func TestBuildExceptFileCommaFlags(t *testing.T) {
fatalCommand(t, c.Meta)
}
for _, f := range []string{"chocolate.txt", "vanilla.txt", "tomato.txt"} {
for _, f := range []string{"chocolate.txt", "vanilla.txt", "tomato.txt",
"unnamed.txt"} {
if fileExists(f) {
t.Errorf("Expected NOT to find %s", f)
}
@ -198,4 +200,5 @@ func cleanup() {
os.RemoveAll("peach.txt")
os.RemoveAll("pear.txt")
os.RemoveAll("tomato.txt")
os.RemoveAll("unnamed.txt")
}

View File

@ -48,6 +48,15 @@
"type": "shell-local",
"inline": [ "touch tomato.txt" ]
}
],
[
{
"only": [
"chocolate"
],
"type": "shell-local",
"inline": [ "touch unnamed.txt" ]
}
]
]
}