From ff3cf4fe995e51eaab0b8136cb1b850b31dbfe02 Mon Sep 17 00:00:00 2001 From: Songmu Date: Sun, 22 May 2022 03:15:44 +0900 Subject: [PATCH] fix test --- encode_test.go | 8 ++++---- example_test.go | 7 +------ 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/encode_test.go b/encode_test.go index 4ea02de..d1cee30 100644 --- a/encode_test.go +++ b/encode_test.go @@ -48,7 +48,7 @@ var encodeTests = []struct { EmailVerified: true, Memo: "songmu.jp", }, - Output: "user:songmu\tage:36\tweight:66.6", + Output: "user:songmu\tage:36\tweight:66.6\temail_verified:true", }, { Name: "Simple without nil pointer", @@ -60,7 +60,7 @@ var encodeTests = []struct { EmailVerified: false, Memo: "songmu.jp", }, - Output: "user:songmu\tage:36\theight:169.1\tweight:66.6", + Output: "user:songmu\tage:36\theight:169.1\tweight:66.6\temail_verified:false", }, { Name: "Omit memo", @@ -69,7 +69,7 @@ var encodeTests = []struct { Age: 36, Memo: "songmu.jp", }, - Output: "user:songmu\tage:36\tweight:0", + Output: "user:songmu\tage:36\tweight:0\temail_verified:false", }, { Name: "Anthoer struct", @@ -108,7 +108,7 @@ func TestMarshal(t *testing.T) { } } else { if s != tt.Output { - t.Errorf("%s: out=%s, want=%s", tt.Name, s, tt.Output) + t.Errorf("%s:\n out =%s\n want=%s", tt.Name, s, tt.Output) } } } diff --git a/example_test.go b/example_test.go index 1d8faba..6e5fd3a 100644 --- a/example_test.go +++ b/example_test.go @@ -1,7 +1,6 @@ package ltsv_test import ( - "fmt" "net" "time" @@ -47,14 +46,10 @@ func ExampleUnmarshal() { "vhost:mackerel.io" l := log{} ltsv.Unmarshal([]byte(ltsvLog), &l) - t := l.Time - l.Time = nil - fmt.Println(t) pretty.Println(l) // Output: - // 2016-07-13 00:00:04 +0900 +0900 // ltsv_test.log{ - // Time: (*ltsv_test.logTime)(nil), + // Time: time.Date(2016, time.July, 13, 0, 0, 4, 0, time.Location("")), // Host: {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xc0, 0x0, 0x2, 0x1}, // Req: "POST /api/v0/tsdb HTTP/1.1", // Status: 200,