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

Side by Side Diff: go/src/infra/tools/cipd/local/manifest_test.go

Issue 1129043003: cipd: Refactor client to make it more readable. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: 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/tools/cipd/local/manifest.go ('k') | go/src/infra/tools/cipd/local/pkgdef.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 2014 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 local
6
7 import (
8 "bytes"
9 "strings"
10 "testing"
11
12 . "github.com/smartystreets/goconvey/convey"
13 )
14
15 func TestReadManifest(t *testing.T) {
16 var goodManifest = `{
17 "format_version": "1",
18 "package_name": "package/name"
19 }`
20
21 Convey("readManifest can read valid manifest", t, func() {
22 manifest, err := readManifest(strings.NewReader(goodManifest))
23 So(manifest, ShouldResemble, Manifest{
24 FormatVersion: "1",
25 PackageName: "package/name",
26 })
27 So(err, ShouldBeNil)
28 })
29
30 Convey("readManifest rejects invalid manifest", t, func() {
31 manifest, err := readManifest(strings.NewReader("I'm not a manif est"))
32 So(manifest, ShouldResemble, Manifest{})
33 So(err, ShouldNotBeNil)
34 })
35
36 Convey("writeManifest works", t, func() {
37 buf := &bytes.Buffer{}
38 m := Manifest{
39 FormatVersion: "1",
40 PackageName: "package/name",
41 }
42 So(writeManifest(&m, buf), ShouldBeNil)
43 So(string(buf.Bytes()), ShouldEqual, goodManifest)
44 })
45 }
OLDNEW
« no previous file with comments | « go/src/infra/tools/cipd/local/manifest.go ('k') | go/src/infra/tools/cipd/local/pkgdef.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698