From 7e2d86731e737d89b9697a51bf95e8ee04663dc5 Mon Sep 17 00:00:00 2001 From: Adrien Delorme Date: Wed, 20 Feb 2019 11:03:17 +0100 Subject: [PATCH] tests: add a post-processor that creates an unnamed.txt file --- command/build_test.go | 15 +++++++++------ command/test-fixtures/build-only/template.json | 9 +++++++++ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/command/build_test.go b/command/build_test.go index 53043a2d4..2a2ba1734 100644 --- a/command/build_test.go +++ b/command/build_test.go @@ -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") } diff --git a/command/test-fixtures/build-only/template.json b/command/test-fixtures/build-only/template.json index 9ca20adca..01e6bfd13 100644 --- a/command/test-fixtures/build-only/template.json +++ b/command/test-fixtures/build-only/template.json @@ -48,6 +48,15 @@ "type": "shell-local", "inline": [ "touch tomato.txt" ] } + ], + [ + { + "only": [ + "chocolate" + ], + "type": "shell-local", + "inline": [ "touch unnamed.txt" ] + } ] ] } \ No newline at end of file