From ff163e44590e81e2fa8f60cc17414a080379a880 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 30 Sep 2013 11:39:24 -0700 Subject: [PATCH] provisioner/shell: add another UnixReader test for sanity --- provisioner/shell/unix_reader_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/provisioner/shell/unix_reader_test.go b/provisioner/shell/unix_reader_test.go index 8dedf6300..17e16ae39 100644 --- a/provisioner/shell/unix_reader_test.go +++ b/provisioner/shell/unix_reader_test.go @@ -31,3 +31,21 @@ func TestUnixReader(t *testing.T) { t.Fatalf("bad: %#v", result.String()) } } + +func TestUnixReader_unixOnly(t *testing.T) { + input := "one\ntwo\nthree\n" + expected := "one\ntwo\nthree\n" + + r := &UnixReader{ + Reader: bytes.NewReader([]byte(input)), + } + + result := new(bytes.Buffer) + if _, err := io.Copy(result, r); err != nil { + t.Fatalf("err: %s", err) + } + + if result.String() != expected { + t.Fatalf("bad: %#v", result.String()) + } +}