MCPcopy
hub / github.com/google/mtail / TestStrptimeWithTimezone

Function TestStrptimeWithTimezone

internal/runtime/vm/vm_test.go:783–795  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

781}
782
783func TestStrptimeWithTimezone(t *testing.T) {
784 loc, _ := time.LoadLocation("Europe/Berlin")
785 obj := &code.Object{Program: []code.Instr{{code.Strptime, 0, 0}}}
786 vm := New("strptimezone", obj, true, loc, false, false)
787 vm.t = new(thread)
788 vm.t.stack = make([]interface{}, 0)
789 vm.t.Push("2012/01/18 06:25:00")
790 vm.t.Push("2006/01/02 15:04:05")
791 vm.execute(vm.t, obj.Program[0])
792 if vm.t.time != time.Date(2012, 1, 18, 6, 25, 0, 0, loc) {
793 t.Errorf("Time didn't parse with location: %s received", vm.t.time)
794 }
795}
796
797func TestStrptimeWithoutTimezone(t *testing.T) {
798 obj := &code.Object{Program: []code.Instr{{code.Strptime, 0, 0}}}

Callers

nothing calls this directly

Calls 3

PushMethod · 0.80
executeMethod · 0.80
NewFunction · 0.70

Tested by

no test coverage detected