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

Side by Side Diff: go/src/infra/gae/libs/wrapper/memory/binutils_test.go

Issue 1230303003: Revert "Refactor current GAE abstraction library to be free of the SDK*" (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: 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 unified diff | Download patch
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 memory
6
7 import (
8 "bytes"
9 "testing"
10
11 . "github.com/smartystreets/goconvey/convey"
12 )
13
14 func TestBinutils(t *testing.T) {
15 t.Parallel()
16
17 Convey("Binary utilities", t, func() {
18 b := &bytes.Buffer{}
19
20 Convey("bytes", func() {
21 t := []byte("this is a test")
22 writeBytes(b, t)
23 Convey("good", func() {
24 r, err := readBytes(b)
25 So(err, ShouldBeNil)
26 So(r, ShouldResemble, t)
27 })
28 Convey("bad (truncated buffer)", func() {
29 bs := b.Bytes()
30 _, err := readBytes(bytes.NewBuffer(bs[:len(bs)- 4]))
31 So(err.Error(), ShouldContainSubstring, "readByt es: expected ")
32 })
33 Convey("bad (bad varint)", func() {
34 _, err := readBytes(bytes.NewBuffer([]byte{0x8f} ))
35 So(err.Error(), ShouldContainSubstring, "EOF")
36 })
37 })
38
39 Convey("strings", func() {
40 t := "this is a test"
41 writeString(b, t)
42 Convey("good", func() {
43 r, err := readString(b)
44 So(err, ShouldBeNil)
45 So(r, ShouldEqual, t)
46 })
47 Convey("bad (truncated buffer)", func() {
48 bs := b.Bytes()
49 _, err := readString(bytes.NewBuffer(bs[:len(bs) -4]))
50 So(err.Error(), ShouldContainSubstring, "readByt es: expected ")
51 })
52 })
53 })
54 }
OLDNEW
« no previous file with comments | « go/src/infra/gae/libs/wrapper/memory/binutils.go ('k') | go/src/infra/gae/libs/wrapper/memory/context.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698