]> Cypherpunks repositories - gostls13.git/commitdiff
mime, strconv: Make testdata more consistent.
authorRobin Eklind <r.eklind.87@gmail.com>
Tue, 22 Jan 2013 21:44:35 +0000 (13:44 -0800)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 22 Jan 2013 21:44:35 +0000 (13:44 -0800)
All packages place testdata in a specific directory with the name
"testdata". The mime and strconv packages have been updated to use
the same convention.

mime: Move "mime/test.types" to "mime/testdata/test.types". Update test
code accordingly.

strconv: Move "strconv/testfp.txt" to "strconv/testdata/testfp.txt".
Update test code accordingly.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7098072

src/pkg/mime/testdata/test.types [moved from src/pkg/mime/test.types with 100% similarity]
src/pkg/mime/type_unix.go
src/pkg/strconv/fp_test.go
src/pkg/strconv/testdata/testfp.txt [moved from src/pkg/strconv/testfp.txt with 100% similarity]

index 2dab1eac78d41d5fb95d31f120659856de67998b..88eb83a735d167b34b157c220cfe22bd00208403 100644 (file)
@@ -52,7 +52,7 @@ func initMime() {
 }
 
 func initMimeForTests() map[string]string {
-       typeFiles = []string{"test.types"}
+       typeFiles = []string{"testdata/test.types"}
        return map[string]string{
                ".t1":  "application/test",
                ".t2":  "text/test; charset=utf-8",
index 171defa4417ddfd09ff813a888ae81f4f38046db..294b7a9bfbb50e2b9cd199fb1111a3dfcfb5d133 100644 (file)
@@ -96,9 +96,9 @@ func myatof32(s string) (f float32, ok bool) {
 }
 
 func TestFp(t *testing.T) {
-       f, err := os.Open("testfp.txt")
+       f, err := os.Open("testdata/testfp.txt")
        if err != nil {
-               t.Fatal("testfp: open testfp.txt:", err)
+               t.Fatal("testfp: open testdata/testfp.txt:", err)
        }
        defer f.Close()
 
@@ -111,7 +111,7 @@ func TestFp(t *testing.T) {
                        break
                }
                if err2 != nil {
-                       t.Fatal("testfp: read testfp.txt: " + err2.Error())
+                       t.Fatal("testfp: read testdata/testfp.txt: " + err2.Error())
                }
                line = line[0 : len(line)-1]
                lineno++
@@ -120,7 +120,7 @@ func TestFp(t *testing.T) {
                }
                a := strings.Split(line, " ")
                if len(a) != 4 {
-                       t.Error("testfp.txt:", lineno, ": wrong field count")
+                       t.Error("testdata/testfp.txt:", lineno, ": wrong field count")
                        continue
                }
                var s string
@@ -130,21 +130,21 @@ func TestFp(t *testing.T) {
                        var ok bool
                        v, ok = myatof64(a[2])
                        if !ok {
-                               t.Error("testfp.txt:", lineno, ": cannot atof64 ", a[2])
+                               t.Error("testdata/testfp.txt:", lineno, ": cannot atof64 ", a[2])
                                continue
                        }
                        s = fmt.Sprintf(a[1], v)
                case "float32":
                        v1, ok := myatof32(a[2])
                        if !ok {
-                               t.Error("testfp.txt:", lineno, ": cannot atof32 ", a[2])
+                               t.Error("testdata/testfp.txt:", lineno, ": cannot atof32 ", a[2])
                                continue
                        }
                        s = fmt.Sprintf(a[1], v1)
                        v = float64(v1)
                }
                if s != a[3] {
-                       t.Error("testfp.txt:", lineno, ": ", a[0], " ", a[1], " ", a[2], " (", v, ") ",
+                       t.Error("testdata/testfp.txt:", lineno, ": ", a[0], " ", a[1], " ", a[2], " (", v, ") ",
                                "want ", a[3], " got ", s)
                }
        }