forked from capnspacehook/taskmaster
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathparse_test.go
More file actions
29 lines (23 loc) · 705 Bytes
/
parse_test.go
File metadata and controls
29 lines (23 loc) · 705 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//go:build windows
// +build windows
package taskmaster
import (
"math"
"testing"
"time"
ole "github.com/go-ole/go-ole"
)
func TestVariantTimeOrZero(t *testing.T) {
if got := variantTimeOrZero(nil); !got.IsZero() {
t.Fatalf("expected zero time for nil variant, got %v", got)
}
if got := variantTimeOrZero(&ole.VARIANT{VT: ole.VT_I4, Val: 10}); !got.IsZero() {
t.Fatalf("expected zero time for non-date variant, got %v", got)
}
vtDate := &ole.VARIANT{VT: ole.VT_DATE, Val: int64(math.Float64bits(2.5))}
got := variantTimeOrZero(vtDate)
expected := time.Date(1900, time.January, 1, 12, 0, 0, 0, time.UTC)
if !got.Equal(expected) {
t.Fatalf("expected %v, got %v", expected, got)
}
}