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

Side by Side Diff: go/src/infra/libs/logging/memlogger/memory_test.go

Issue 1153883002: go: infra/libs/* now live in luci-go. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: move the rest too Created 5 years, 7 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 unified diff | Download patch
« no previous file with comments | « go/src/infra/libs/logging/memlogger/memory.go ('k') | go/src/infra/libs/parallel/parallel.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package memlogger
6
7 import (
8 "testing"
9
10 "golang.org/x/net/context"
11
12 . "github.com/smartystreets/goconvey/convey"
13
14 "infra/libs/logging"
15 )
16
17 func TestLogger(t *testing.T) {
18 Convey("logger", t, func() {
19 c := Use(context.Background())
20 l := logging.Get(c)
21 So(l, ShouldNotBeNil)
22 l.Infof("test %s", LogInfo)
23 l.Warningf("test %s", LogWarn)
24 l.Errorf("test %s", LogError)
25 l.Errorf("test WAT: %s", LogLevel(9001))
26 ml := l.(*MemLogger)
27
28 So(len(*ml), ShouldEqual, 4)
29 So((*ml)[0], ShouldResemble, LogEntry{LogInfo, "test IFO"})
30 So((*ml)[1], ShouldResemble, LogEntry{LogWarn, "test WRN"})
31 So((*ml)[2], ShouldResemble, LogEntry{LogError, "test ERR"})
32 So((*ml)[3], ShouldResemble, LogEntry{LogError, "test WAT: ???"} )
33 })
34
35 Convey("logger context", t, func() {
36 c := Use(context.Background())
37 l := logging.Get(c)
38 So(l, ShouldNotBeNil)
39 ml := l.(*MemLogger)
40
41 l.Infof("totally works: %s", "yes")
42
43 So(len(*ml), ShouldEqual, 1)
44 So((*ml)[0], ShouldResemble, LogEntry{LogInfo, "totally works: y es"})
45 })
46 }
OLDNEW
« no previous file with comments | « go/src/infra/libs/logging/memlogger/memory.go ('k') | go/src/infra/libs/parallel/parallel.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698