From 782a8f759bb95c74b382e7de676c42a3245c0cc5 Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Mon, 2 Nov 2020 08:27:19 -0800 Subject: [PATCH] Still trying to reproduce #154 --- cmd/transpile/main_test.go | 9 ++++++++- cmd/transpile/testdata/cat1/1/answer.txt | 1 + cmd/transpile/testdata/cat1/1/mkpuzzle | 5 +++-- 3 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 cmd/transpile/testdata/cat1/1/answer.txt diff --git a/cmd/transpile/main_test.go b/cmd/transpile/main_test.go index af48f3b..20351d7 100644 --- a/cmd/transpile/main_test.go +++ b/cmd/transpile/main_test.go @@ -174,6 +174,14 @@ func TestFilesystem(t *testing.T) { BaseFs: afero.NewOsFs(), } + stdout.Reset() + if err := tp.Run("puzzle", "-dir=testdata/cat1/1"); err != nil { + t.Error(err) + } + if !strings.Contains(stdout.String(), "moo") { + t.Error("File not pulled from cwd", stdout.String()) + } + stdout.Reset() if err := tp.Run("file", "-dir=testdata/cat1/1", "-file=moo.txt"); err != nil { t.Error(err) @@ -181,5 +189,4 @@ func TestFilesystem(t *testing.T) { if !strings.Contains(stdout.String(), "Moo.") { t.Error("Wrong file pulled", stdout.String()) } - } \ No newline at end of file diff --git a/cmd/transpile/testdata/cat1/1/answer.txt b/cmd/transpile/testdata/cat1/1/answer.txt new file mode 100644 index 0000000..eec8c88 --- /dev/null +++ b/cmd/transpile/testdata/cat1/1/answer.txt @@ -0,0 +1 @@ +moo diff --git a/cmd/transpile/testdata/cat1/1/mkpuzzle b/cmd/transpile/testdata/cat1/1/mkpuzzle index e61b4a2..161b2e7 100755 --- a/cmd/transpile/testdata/cat1/1/mkpuzzle +++ b/cmd/transpile/testdata/cat1/1/mkpuzzle @@ -7,9 +7,10 @@ fail () { case $1:$2 in puzzle:) - cat <<'EOT' + read answer < answer.txt + cat <