OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgo/] [go/] [mime/] [type_test.go] - Blame information for rev 747

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 747 jeremybenn
// Copyright 2010 The Go Authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style
3
// license that can be found in the LICENSE file.
4
 
5
package mime
6
 
7
import "testing"
8
 
9
var typeTests = initMimeForTests()
10
 
11
func TestTypeByExtension(t *testing.T) {
12
        for ext, want := range typeTests {
13
                val := TypeByExtension(ext)
14
                if val != want {
15
                        t.Errorf("TypeByExtension(%q) = %q, want %q", ext, val, want)
16
                }
17
 
18
        }
19
}
20
 
21
func TestCustomExtension(t *testing.T) {
22
        custom := "text/xml; charset=iso-8859-1"
23
        if error := AddExtensionType(".xml", custom); error != nil {
24
                t.Fatalf("error %s for AddExtension(%s)", error, custom)
25
        }
26
        if registered := TypeByExtension(".xml"); registered != custom {
27
                t.Fatalf("registered %s instead of %s", registered, custom)
28
        }
29
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.