aboutsummaryrefslogtreecommitdiff
path: root/content/cover/pkg_test.go
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2013-12-03 07:58:53 +1100
committerAndrew Gerrand <adg@golang.org>2013-12-03 07:58:53 +1100
commit1601cf2af6ed6496b7fa481b640779cf49a492ca (patch)
treeaa4ed6dc0e3a21edc636222bea6a3401524fef8c /content/cover/pkg_test.go
parentdf10efcca47e7360ce74f0ed32282991c8be150f (diff)
go.blog/cover: new article about test coverage
R=adg https://golang.org/cl/14566048
Diffstat (limited to 'content/cover/pkg_test.go')
-rw-r--r--content/cover/pkg_test.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/content/cover/pkg_test.go b/content/cover/pkg_test.go
new file mode 100644
index 0000000..8bf4b0c
--- /dev/null
+++ b/content/cover/pkg_test.go
@@ -0,0 +1,22 @@
+package size
+
+import "testing"
+
+type Test struct {
+ in int
+ out string
+}
+
+var tests = []Test{
+ {-1, "negative"},
+ {5, "small"},
+}
+
+func TestSize(t *testing.T) {
+ for i, test := range tests {
+ size := Size(test.in)
+ if size != test.out {
+ t.Errorf("#%d: Size(%d)=%s; want %s", i, test.in, size, test.out)
+ }
+ }
+}