MCPcopy Index your code
hub / github.com/yuin/gopher-lua / assertOsDateFields

Function assertOsDateFields

baselib_test.go:114–141  ·  view source on GitHub ↗
(t *testing.T, key LValue, value LValue, expect time.Time)

Source from the content-addressed store, hash-verified

112}
113
114func assertOsDateFields(t *testing.T, key LValue, value LValue, expect time.Time) {
115 switch key.String() {
116 case "year":
117 if value.String() != strconv.Itoa(expect.Year()) {
118 t.Errorf("year=%v, expect.Year=%v", value.String(), expect.Year())
119 }
120 case "month":
121 if value.String() != strconv.Itoa(int(expect.Month())) {
122 t.Errorf("month=%v, expect.Month=%v", value.String(), expect.Month())
123 }
124 case "day":
125 if value.String() != strconv.Itoa(expect.Day()) {
126 t.Errorf("day=%v, expect.Day=%v", value.String(), expect.Day())
127 }
128 case "hour":
129 if value.String() != strconv.Itoa(expect.Hour()) {
130 t.Errorf("hour=%v, expect.Hour=%v", value.String(), expect.Hour())
131 }
132 case "min":
133 if value.String() != strconv.Itoa(expect.Minute()) {
134 t.Errorf("min=%v, expect.Minute=%v", value.String(), expect.Minute())
135 }
136 case "sec":
137 if value.String() != strconv.Itoa(expect.Second()) {
138 t.Errorf("sec=%v, expect.Second=%v", value.String(), expect.Second())
139 }
140 }
141}

Calls 1

StringMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…