From a531c68c21853847f2dd00f7dd31da9aacf530b5 Mon Sep 17 00:00:00 2001 From: bradleyjkemp Date: Fri, 11 Aug 2017 22:32:36 +0000 Subject: [PATCH] Make snapshots more readable and diffable --- .snapshots/c2go-TestCLI-func1-AstHelpFlag | 6 +++++- .snapshots/c2go-TestCLI-func1-AstNoFilesHelp | 6 +++++- .snapshots/c2go-TestCLI-func1-TranspileHelpFlag | 11 ++++++++++- .snapshots/c2go-TestCLI-func1-TranspileNoFilesHelp | 11 ++++++++++- cli_test.go | 4 +++- 5 files changed, 33 insertions(+), 5 deletions(-) diff --git a/.snapshots/c2go-TestCLI-func1-AstHelpFlag b/.snapshots/c2go-TestCLI-func1-AstHelpFlag index bfba206fe..dc82ef71a 100644 --- a/.snapshots/c2go-TestCLI-func1-AstHelpFlag +++ b/.snapshots/c2go-TestCLI-func1-AstHelpFlag @@ -1 +1,5 @@ -(string) (len=51) "Usage: test ast file.c\n -h\tprint help information\n" +([]string) (len=3) { + (string) (len=22) "Usage: test ast file.c", + (string) (len=27) " -h\tprint help information", + (string) "" +} diff --git a/.snapshots/c2go-TestCLI-func1-AstNoFilesHelp b/.snapshots/c2go-TestCLI-func1-AstNoFilesHelp index bfba206fe..dc82ef71a 100644 --- a/.snapshots/c2go-TestCLI-func1-AstNoFilesHelp +++ b/.snapshots/c2go-TestCLI-func1-AstNoFilesHelp @@ -1 +1,5 @@ -(string) (len=51) "Usage: test ast file.c\n -h\tprint help information\n" +([]string) (len=3) { + (string) (len=22) "Usage: test ast file.c", + (string) (len=27) " -h\tprint help information", + (string) "" +} diff --git a/.snapshots/c2go-TestCLI-func1-TranspileHelpFlag b/.snapshots/c2go-TestCLI-func1-TranspileHelpFlag index b5e9822a4..e46011164 100644 --- a/.snapshots/c2go-TestCLI-func1-TranspileHelpFlag +++ b/.snapshots/c2go-TestCLI-func1-TranspileHelpFlag @@ -1 +1,10 @@ -(string) (len=256) "Usage: test transpile [-V] [-o file.go] [-p package] file.c\n -V\tprint progress as comments\n -h\tprint help information\n -o string\n \toutput Go generated code to the specified file\n -p string\n \tset the name of the generated package (default \"main\")\n" +([]string) (len=8) { + (string) (len=59) "Usage: test transpile [-V] [-o file.go] [-p package] file.c", + (string) (len=31) " -V\tprint progress as comments", + (string) (len=27) " -h\tprint help information", + (string) (len=11) " -o string", + (string) (len=51) " \toutput Go generated code to the specified file", + (string) (len=11) " -p string", + (string) (len=59) " \tset the name of the generated package (default \"main\")", + (string) "" +} diff --git a/.snapshots/c2go-TestCLI-func1-TranspileNoFilesHelp b/.snapshots/c2go-TestCLI-func1-TranspileNoFilesHelp index b5e9822a4..e46011164 100644 --- a/.snapshots/c2go-TestCLI-func1-TranspileNoFilesHelp +++ b/.snapshots/c2go-TestCLI-func1-TranspileNoFilesHelp @@ -1 +1,10 @@ -(string) (len=256) "Usage: test transpile [-V] [-o file.go] [-p package] file.c\n -V\tprint progress as comments\n -h\tprint help information\n -o string\n \toutput Go generated code to the specified file\n -p string\n \tset the name of the generated package (default \"main\")\n" +([]string) (len=8) { + (string) (len=59) "Usage: test transpile [-V] [-o file.go] [-p package] file.c", + (string) (len=31) " -V\tprint progress as comments", + (string) (len=27) " -h\tprint help information", + (string) (len=11) " -o string", + (string) (len=51) " \toutput Go generated code to the specified file", + (string) (len=11) " -p string", + (string) (len=59) " \tset the name of the generated package (default \"main\")", + (string) "" +} diff --git a/cli_test.go b/cli_test.go index 297422ff9..d527ed867 100644 --- a/cli_test.go +++ b/cli_test.go @@ -4,6 +4,7 @@ import ( "bytes" "github.com/bradleyjkemp/cupaloy" "os" + "strings" "testing" ) @@ -42,7 +43,8 @@ func TestCLI(t *testing.T) { defer teardown() runCommand() - err := cupaloy.SnapshotMulti(testName, output.String()) + outputLines := strings.Split(output.String(), "\n") + err := cupaloy.SnapshotMulti(testName, outputLines) if err != nil { t.Fatalf("error: %s", err) }