From d82caf6bd497920ee9fd2389a14a73dd7515a4e2 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Tue, 5 Aug 2014 15:43:29 +0200 Subject: [PATCH] Don't depend on a pretty printer just for testing --- build.sh | 1 - protocol/protocol_test.go | 12 +++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/build.sh b/build.sh index e07089f5..99f36dab 100755 --- a/build.sh +++ b/build.sh @@ -93,7 +93,6 @@ setup() { go get -v code.google.com/p/go.tools/cmd/vet go get -v github.com/mattn/goveralls go get -v github.com/tools/godep - GOPATH="$GOPATH:$(godep path)" go get -v -t ./... } xdr() { diff --git a/protocol/protocol_test.go b/protocol/protocol_test.go index 8aabe3fc..56a46f2e 100644 --- a/protocol/protocol_test.go +++ b/protocol/protocol_test.go @@ -7,6 +7,7 @@ package protocol import ( "bytes" "encoding/hex" + "encoding/json" "errors" "fmt" "io" @@ -17,7 +18,6 @@ import ( "testing/quick" "github.com/calmh/xdr" - pretty "github.com/tonnerre/golang-pretty" ) var ( @@ -346,12 +346,10 @@ func testMarshal(t *testing.T, prefix string, m1, m2 message) bool { var buf bytes.Buffer failed := func(bc []byte) { - f, _ := os.Create(prefix + "-1.txt") - pretty.Fprintf(f, "%# v", m1) - f.Close() - f, _ = os.Create(prefix + "-2.txt") - pretty.Fprintf(f, "%# v", m2) - f.Close() + bs, _ := json.MarshalIndent(m1, "", " ") + ioutil.WriteFile(prefix+"-1.txt", bs, 0644) + bs, _ = json.MarshalIndent(m2, "", " ") + ioutil.WriteFile(prefix+"-2.txt", bs, 0644) if len(bc) > 0 { f, _ := os.Create(prefix + "-data.txt") fmt.Fprint(f, hex.Dump(bc))