Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(731)

Unified Diff: go/src/infra/libs/clock/clockflag/time_test.go

Issue 1223213002: Remove libs/clock in favor of luci-go/common/clock. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@abstract
Patch Set: rebase Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « go/src/infra/libs/clock/clockflag/time.go ('k') | go/src/infra/libs/clock/context.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: go/src/infra/libs/clock/clockflag/time_test.go
diff --git a/go/src/infra/libs/clock/clockflag/time_test.go b/go/src/infra/libs/clock/clockflag/time_test.go
deleted file mode 100644
index 771c5cb31fdee4e753ac482ec3c48d21ed51fcfb..0000000000000000000000000000000000000000
--- a/go/src/infra/libs/clock/clockflag/time_test.go
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package clockflag
-
-import (
- "encoding/json"
- "flag"
- "testing"
- "time"
-
- . "github.com/smartystreets/goconvey/convey"
-)
-
-func TestTime(t *testing.T) {
- t.Parallel()
-
- Convey(`A Time flag`, t, func() {
- fs := flag.NewFlagSet("test", flag.ContinueOnError)
- var d Time
- fs.Var(&d, "time", "Test time parameter.")
-
- Convey(`Parses a 10-second Time from "2015-05-05T23:47:17+00:00".`, func() {
- err := fs.Parse([]string{"-time", "2015-05-05T23:47:17+00:00"})
- So(err, ShouldBeNil)
- So(d.Time().Equal(time.Unix(1430869637, 0)), ShouldBeTrue)
- })
-
- Convey(`Returns an error when parsing "asdf".`, func() {
- err := fs.Parse([]string{"-time", "asdf"})
- So(err, ShouldNotBeNil)
- })
-
- Convey(`When treated as a JSON field`, func() {
- var s struct {
- T Time `json:"time"`
- }
-
- testJSON := `{"time":"asdf"}`
- Convey(`Fails to unmarshal from `+testJSON+`.`, func() {
- testJSON := testJSON
- err := json.Unmarshal([]byte(testJSON), &s)
- So(err, ShouldNotBeNil)
- })
-
- Convey(`Marshals correctly to RFC3339 time string.`, func() {
- s.T = Time(time.Unix(1430869637, 0))
- testJSON, err := json.Marshal(&s)
- So(err, ShouldBeNil)
- So(string(testJSON), ShouldEqual, `{"time":"2015-05-05T23:47:17Z"}`)
-
- Convey(`And Unmarshals correctly.`, func() {
- s.T = Time{}
- err := json.Unmarshal([]byte(testJSON), &s)
- So(err, ShouldBeNil)
- So(s.T.Time().Equal(time.Unix(1430869637, 0)), ShouldBeTrue)
- })
- })
- })
- })
-}
« no previous file with comments | « go/src/infra/libs/clock/clockflag/time.go ('k') | go/src/infra/libs/clock/context.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698