We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3cf2b68 commit 3d5a7f0Copy full SHA for 3d5a7f0
1 file changed
time/time_test.go
@@ -0,0 +1,24 @@
1
+package time
2
+
3
+import (
4
+ "testing"
5
+)
6
7
+func TestUnMarshalText(t *testing.T) {
8
+ dummyTime := Time{}
9
10
+ goodTimeFormats := []string{
11
+ "2006-01-02T15:04:05MST",
12
+ "2006-01-02T15:04:05",
13
+ }
14
+ for _, goodTime := range goodTimeFormats {
15
+ if dummyTime.UnmarshalText([]byte(goodTime)) != nil {
16
+ t.Error("expected " + goodTime + " to be marshal-able.")
17
18
19
20
+ badTime := "this is a bad time, isn't it?"
21
+ if dummyTime.UnmarshalText([]byte(badTime)) == nil {
22
+ t.Error("expected " + badTime + "to be unmarshal-able.")
23
24
+}
0 commit comments