Create embedded-5_0-branch branch for development on ARM embedded cores.
[official-gcc.git] / embedded-5_0-branch / gcc / testsuite / go.test / test / import5.go
blob6480acff92c52ea36ecb5cb54c30f1006f12142a
1 // errorcheck
3 // Copyright 2009 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
7 // Verify that invalid imports are rejected by the compiler.
8 // Does not compile.
10 package main
12 // Correct import paths.
13 import _ "fmt"
14 import _ `time`
15 import _ "m\x61th"
16 import _ "go/parser"
18 // Correct import paths, but the packages don't exist.
19 // Don't test.
20 //import "a.b"
21 //import "greek/αβ"
23 // Import paths must be strings.
24 import 42 // ERROR "import statement"
25 import 'a' // ERROR "import statement"
26 import 3.14 // ERROR "import statement"
27 import 0.25i // ERROR "import statement"
29 // Each of these pairs tests both `` vs "" strings
30 // and also use of invalid characters spelled out as
31 // escape sequences and written directly.
32 // For example `"\x00"` tests import "\x00"
33 // while "`\x00`" tests import `<actual-NUL-byte>`.
34 import "" // ERROR "import path"
35 import `` // ERROR "import path"
36 import "\x00" // ERROR "import path"
37 import `\x00` // ERROR "import path"
38 import "\x7f" // ERROR "import path"
39 import `\x7f` // ERROR "import path"
40 import "a!" // ERROR "import path"
41 import `a!` // ERROR "import path"
42 import "a b" // ERROR "import path"
43 import `a b` // ERROR "import path"
44 import "a\\b" // ERROR "import path"
45 import `a\\b` // ERROR "import path"
46 import "\"`a`\"" // ERROR "import path"
47 import `\"a\"` // ERROR "import path"
48 import "\x80\x80" // ERROR "import path"
49 import `\x80\x80` // ERROR "import path"
50 import "\xFFFD" // ERROR "import path"
51 import `\xFFFD` // ERROR "import path"
53 // Invalid local imports.
54 import "/foo" // ERROR "import path cannot be absolute path"
55 import "c:/foo" // ERROR "import path contains invalid character"