From 40712671eef0c1fa5349e07e5a68a6b1682d78b3 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Thu, 29 Mar 2012 16:15:59 -0700 Subject: [PATCH] pkg/auth and pkg/schema: fix tests. Change-Id: I54f391241c77902ad301edea92d39660f7cf0008 --- pkg/auth/auth.go | 1 - pkg/schema/fileread_test.go | 4 ++-- pkg/schema/schema_test.go | 48 +------------------------------------ 3 files changed, 3 insertions(+), 50 deletions(-) diff --git a/pkg/auth/auth.go b/pkg/auth/auth.go index 43c6223d4..4a5d687db 100644 --- a/pkg/auth/auth.go +++ b/pkg/auth/auth.go @@ -19,7 +19,6 @@ package auth import ( "encoding/base64" "fmt" - "log" "net/http" "os" "regexp" diff --git a/pkg/schema/fileread_test.go b/pkg/schema/fileread_test.go index f28413d19..aa32579e3 100644 --- a/pkg/schema/fileread_test.go +++ b/pkg/schema/fileread_test.go @@ -59,11 +59,11 @@ func filePart(cps []*BytesPart, skip uint64) *BytesPart { } err := PopulateParts(m, fileSize, cpl) if err != nil { - panic(err.String()) + panic(err) } json, err := MapToCamliJson(m) if err != nil { - panic(err.String()) + panic(err) } tb := &test.Blob{json} testFetcher.AddBlob(tb) diff --git a/pkg/schema/schema_test.go b/pkg/schema/schema_test.go index ac4c0afda..c7914e4d0 100644 --- a/pkg/schema/schema_test.go +++ b/pkg/schema/schema_test.go @@ -22,28 +22,9 @@ import ( "strings" "testing" - . "camli/test/asserts" + . "camlistore.org/pkg/test/asserts" ) -type isUtf8Test struct { - s string - e bool -} - -func TestIsUtf8(t *testing.T) { - tests := []isUtf8Test{ - {"foo", true}, - {"Straße", true}, - {string([]uint8{65, 234, 234, 192, 23, 123}), false}, - {string([]uint8{65, 97}), true}, - } - for idx, test := range tests { - if isValidUtf8(test.s) != test.e { - t.Errorf("expected isutf8==%d for test index %d", test.e, idx) - } - } -} - const kExpectedHeader = `{"camliVersion"` func TestJson(t *testing.T) { @@ -63,33 +44,6 @@ func TestJson(t *testing.T) { } -type rfc3339NanoTest struct { - nanos int64 - e string -} - -func TestRFC3339Nanos(t *testing.T) { - tests := []rfc3339NanoTest{ - {0, "1970-01-01T00:00:00Z"}, - {1, "1970-01-01T00:00:00.000000001Z"}, - {10, "1970-01-01T00:00:00.00000001Z"}, - {1000, "1970-01-01T00:00:00.000001Z"}, - {1301114560 * 1e9, "2011-03-26T04:42:40Z"}, - {1301114560*1e9 + 10, "2011-03-26T04:42:40.00000001Z"}, - } - for idx, test := range tests { - got := RFC3339FromNanos(test.nanos) - if got != test.e { - t.Errorf("On test %d got %q; expected %q", idx, got, test.e) - } - // and back! - back := NanosFromRFC3339(test.e) - if back != test.nanos { - t.Errorf("On test %d NanosFromRFC3339(%q) got %d; expected %d", idx, test.e, back, test.nanos) - } - } -} - func TestRegularFile(t *testing.T) { fileName := "schema_test.go" fi, err := os.Lstat(fileName)