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

Side by Side Diff: go/src/infra/appengine/test-results/model/common_test.go

Issue 2234353002: test-results: package model: Add full_result.go and tests (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Improve coverage Created 4 years, 4 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
OLDNEW
(Empty)
1 package model
2
3 import (
4 "encoding/json"
5 "testing"
6
7 . "github.com/smartystreets/goconvey/convey"
8 )
9
10 func TestCommon(t *testing.T) {
11 t.Parallel()
12
13 Convey("Number", t, func() {
14 Convey("UnmarshalJSON", func() {
15 Convey("fails on non integers", func() {
16 Convey("string", func() {
17 input := []byte("foo")
18 var num Number
19 So(json.Unmarshal(input, &num), ShouldNo tBeNil)
20 })
21
22 Convey("float", func() {
23 input := []byte("2.0")
24 var num Number
25 So(json.Unmarshal(input, &num), ShouldNo tBeNil)
26 })
27 })
28
29 Convey("succeeds for integer", func() {
30 input := []byte("-400")
31 var num Number
32 So(json.Unmarshal(input, &num), ShouldBeNil)
33 So(num, ShouldEqual, -400)
34 })
35 })
36
37 Convey("MarshalJSON", func() {
38 Convey("basic", func() {
39 num := Number(-400)
40 b, err := json.Marshal(&num)
41 So(err, ShouldBeNil)
42 So(string(b), ShouldEqual, "-400")
43 })
44 })
45 })
46 }
OLDNEW
« no previous file with comments | « go/src/infra/appengine/test-results/model/common.go ('k') | go/src/infra/appengine/test-results/model/full_result.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698