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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: go/src/infra/gae/libs/wrapper/memory/binutils_test.go
diff --git a/go/src/infra/gae/libs/wrapper/memory/binutils_test.go b/go/src/infra/gae/libs/wrapper/memory/binutils_test.go
new file mode 100644
index 0000000000000000000000000000000000000000..88a447c4ca5ca06916f0b311b65ecefab64ac481
--- /dev/null
+++ b/go/src/infra/gae/libs/wrapper/memory/binutils_test.go
@@ -0,0 +1,54 @@
+// 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 memory
+
+import (
+ "bytes"
+ "testing"
+
+ . "github.com/smartystreets/goconvey/convey"
+)
+
+func TestBinutils(t *testing.T) {
+ t.Parallel()
+
+ Convey("Binary utilities", t, func() {
+ b := &bytes.Buffer{}
+
+ Convey("bytes", func() {
+ t := []byte("this is a test")
+ writeBytes(b, t)
+ Convey("good", func() {
+ r, err := readBytes(b)
+ So(err, ShouldBeNil)
+ So(r, ShouldResemble, t)
+ })
+ Convey("bad (truncated buffer)", func() {
+ bs := b.Bytes()
+ _, err := readBytes(bytes.NewBuffer(bs[:len(bs)-4]))
+ So(err.Error(), ShouldContainSubstring, "readBytes: expected ")
+ })
+ Convey("bad (bad varint)", func() {
+ _, err := readBytes(bytes.NewBuffer([]byte{0x8f}))
+ So(err.Error(), ShouldContainSubstring, "EOF")
+ })
+ })
+
+ Convey("strings", func() {
+ t := "this is a test"
+ writeString(b, t)
+ Convey("good", func() {
+ r, err := readString(b)
+ So(err, ShouldBeNil)
+ So(r, ShouldEqual, t)
+ })
+ Convey("bad (truncated buffer)", func() {
+ bs := b.Bytes()
+ _, err := readString(bytes.NewBuffer(bs[:len(bs)-4]))
+ So(err.Error(), ShouldContainSubstring, "readBytes: expected ")
+ })
+ })
+ })
+}
« 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