bazel-test: add sizes to all tests.

This gets rid of the warning about mismatched test sizes.
This commit is contained in:
2023-05-04 16:08:18 -07:00
parent bfc7fedbf9
commit c1b8b72cf1
9 changed files with 23 additions and 9 deletions

View File

@@ -1,4 +1,4 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
go_library(
name = "seekbuf",
@@ -6,3 +6,11 @@ go_library(
importpath = "git.wntrmute.dev/kyle/goutils/seekbuf",
visibility = ["//visibility:public"],
)
go_test(
name = "seekbuf_test",
srcs = ["seekbuf_test.go"],
embed = [":seekbuf"],
deps = ["//assert"],
size = "small"
)

View File

@@ -1,3 +1,4 @@
// seekbuf implements a read-seekable buffer.
package seekbuf
import "io"
@@ -40,7 +41,7 @@ func (b *Buffer) Seek(pos int) {
// Rewind resets the read pointer to 0.
func (b *Buffer) Rewind() {
b.pos = 0
b.Seek(0)
}
// Close clears all the data out of the buffer and sets the read position to 0.
@@ -49,3 +50,8 @@ func (b *Buffer) Close() error {
b.pos = 0
return nil
}
// Len returns the length of data remaining to be read.
func (b *Buffer) Len() int {
return len(b.data[b.pos:])
}