@@ -22,6 +22,7 @@ import (
2222 "io/ioutil"
2323 "os"
2424 "testing"
25+ "time"
2526
2627 "github.com/stretchr/testify/internal/spew"
2728)
@@ -127,6 +128,7 @@ func initSpewTests() {
127128 // Config states with various settings.
128129 scsDefault := spew .NewDefaultConfig ()
129130 scsNoMethods := & spew.ConfigState {Indent : " " , DisableMethods : true }
131+ scsNoMethodsButTimeStringer := & spew.ConfigState {Indent : " " , DisableMethods : true , EnableTimeStringer : true }
130132 scsNoPmethods := & spew.ConfigState {Indent : " " , DisablePointerMethods : true }
131133 scsMaxDepth := & spew.ConfigState {Indent : " " , MaxDepth : 1 }
132134 scsContinue := & spew.ConfigState {Indent : " " , ContinueOnMethod : true }
@@ -138,6 +140,8 @@ func initSpewTests() {
138140 ts := stringer ("test" )
139141 tps := pstringer ("test" )
140142
143+ tm := time .Date (2006 , time .January , 2 , 15 , 4 , 5 , 999999999 , time .UTC )
144+
141145 type ptrTester struct {
142146 s * struct {}
143147 }
@@ -203,6 +207,11 @@ func initSpewTests() {
203207 {scsNoPtrAddr , fCSSdump , "" , tptr , "(*spew_test.ptrTester)({\n s: (*struct {})({\n })\n })\n " },
204208 {scsNoCap , fCSSdump , "" , make ([]string , 0 , 10 ), "([]string) {\n }\n " },
205209 {scsNoCap , fCSSdump , "" , make ([]string , 1 , 10 ), "([]string) (len=1) {\n (string) \" \" \n }\n " },
210+
211+ // time.Time formatting:
212+ {scsDefault , fCSFprint , "" , tm , "2006-01-02 15:04:05.999999999 +0000 UTC" },
213+ {scsNoMethods , fCSFprint , "" , tm , "{999999999 63271811045 <nil>}" },
214+ {scsNoMethodsButTimeStringer , fCSFprint , "" , tm , "2006-01-02 15:04:05.999999999 +0000 UTC" },
206215 }
207216}
208217
0 commit comments