Source file
test/char_lit.go
1
2
3
4
5
6
7
8
9 package main
10
11 import "os"
12
13 func main() {
14 var i uint64 =
15 ' ' +
16 'a' +
17 'ä' +
18 '本' +
19 '\a' +
20 '\b' +
21 '\f' +
22 '\n' +
23 '\r' +
24 '\t' +
25 '\v' +
26 '\\' +
27 '\'' +
28 '\000' +
29 '\123' +
30 '\x00' +
31 '\xca' +
32 '\xFE' +
33 '\u0123' +
34 '\ubabe' +
35 '\U0010FFFF' +
36 '\U000ebabe'
37 if '\U000ebabe' != 0x000ebabe {
38 print("ebabe wrong\n")
39 os.Exit(1)
40 }
41 if i != 0x20e213 {
42 print("number is ", i, " should be ", 0x20e213, "\n")
43 os.Exit(1)
44 }
45 }
46
View as plain text