bazel-test: add sizes to all tests.

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

View File

@ -9,11 +9,11 @@ go_library(
go_test( go_test(
name = "dbg_test", name = "dbg_test",
size = "small",
srcs = ["dbg_test.go"], srcs = ["dbg_test.go"],
embed = [":dbg"], embed = [":dbg"],
deps = [ deps = [
"//testio", "//testio",
"@com_github_stretchr_testify//require", "@com_github_stretchr_testify//require",
], ],
size = "small",
) )

View File

@ -110,8 +110,8 @@ go_library(
go_test( go_test(
name = "lib_test", name = "lib_test",
size = "small",
srcs = ["lib_test.go"], srcs = ["lib_test.go"],
embed = [":lib"], embed = [":lib"],
deps = ["//assert"], deps = ["//assert"],
size = "small",
) )

View File

@ -15,10 +15,10 @@ go_library(
go_test( go_test(
name = "logging_test", name = "logging_test",
size = "small",
srcs = [ srcs = [
"example_test.go", "example_test.go",
"log_test.go", "log_test.go",
], ],
embed = [":logging"], embed = [":logging"],
size = "small",
) )

View File

@ -9,11 +9,11 @@ go_library(
go_test( go_test(
name = "mwc_test", name = "mwc_test",
size = "small",
srcs = ["mwc_test.go"], srcs = ["mwc_test.go"],
embed = [":mwc"], embed = [":mwc"],
deps = [ deps = [
"//assert", "//assert",
"//testio", "//testio",
], ],
size = "small",
) )

View File

@ -9,7 +9,7 @@ go_library(
go_test( go_test(
name = "rand_test", name = "rand_test",
size = "small",
srcs = ["rand_test.go"], srcs = ["rand_test.go"],
embed = [":rand"], embed = [":rand"],
size = "small",
) )

View File

@ -9,8 +9,8 @@ go_library(
go_test( go_test(
name = "sbuf_test", name = "sbuf_test",
size = "small",
srcs = ["sbuf_test.go"], srcs = ["sbuf_test.go"],
embed = [":sbuf"], embed = [":sbuf"],
deps = ["@org_golang_x_crypto//nacl/box"], deps = ["@org_golang_x_crypto//nacl/box"],
size = "small",
) )

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( go_library(
name = "seekbuf", name = "seekbuf",
@ -6,3 +6,11 @@ go_library(
importpath = "git.wntrmute.dev/kyle/goutils/seekbuf", importpath = "git.wntrmute.dev/kyle/goutils/seekbuf",
visibility = ["//visibility:public"], 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 package seekbuf
import "io" import "io"
@ -40,7 +41,7 @@ func (b *Buffer) Seek(pos int) {
// Rewind resets the read pointer to 0. // Rewind resets the read pointer to 0.
func (b *Buffer) Rewind() { 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. // 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 b.pos = 0
return nil return nil
} }
// Len returns the length of data remaining to be read.
func (b *Buffer) Len() int {
return len(b.data[b.pos:])
}

View File

@ -9,7 +9,7 @@ go_library(
go_test( go_test(
name = "testio_test", name = "testio_test",
size = "small",
srcs = ["testio_test.go"], srcs = ["testio_test.go"],
embed = [":testio"], embed = [":testio"],
size = "small",
) )