Skip to content

Commit 098b579

Browse files
committed
Add failing test for internalization of Date into time.Time struct.
Test case for #287, currently failing.
1 parent 0dda54d commit 098b579

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

js/js_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,17 @@ func TestDate(t *testing.T) {
287287
}
288288
}
289289

290+
// https://github.com/gopherjs/gopherjs/issues/287
291+
func TestInternalizeDate(t *testing.T) {
292+
var a = time.Unix(0, (123 * time.Millisecond).Nanoseconds())
293+
var b time.Time
294+
js.Global.Set("internalizeDate", func(t time.Time) { b = t })
295+
js.Global.Call("eval", "(internalizeDate(new Date(123)))")
296+
if a != b {
297+
t.Fail()
298+
}
299+
}
300+
290301
func TestEquality(t *testing.T) {
291302
if js.Global.Get("Array") != js.Global.Get("Array") || js.Global.Get("Array") == js.Global.Get("String") {
292303
t.Fail()

0 commit comments

Comments
 (0)