testdata: add better tests for struct expanding
Этот коммит содержится в:
родитель
12fb4f3f91
коммит
4731f2f787
4 изменённых файлов: 35 добавлений и 31 удалений
3
testdata/print.go
предоставленный
3
testdata/print.go
предоставленный
|
@ -29,6 +29,9 @@ func main() {
|
|||
// print float64
|
||||
println(3.14)
|
||||
|
||||
// print interface
|
||||
println(interface{}(nil))
|
||||
|
||||
// print map
|
||||
println(map[string]int{"three": 3, "five": 5})
|
||||
|
||||
|
|
1
testdata/print.txt
предоставленный
1
testdata/print.txt
предоставленный
|
@ -16,5 +16,6 @@ a b c
|
|||
123456789012
|
||||
-123456789012
|
||||
+3.140000e+000
|
||||
(0:nil)
|
||||
map[2]
|
||||
true false
|
||||
|
|
44
testdata/structexpand.go
предоставленный
44
testdata/structexpand.go
предоставленный
|
@ -52,53 +52,53 @@ type s8 struct {
|
|||
b byte // 1 element
|
||||
}
|
||||
|
||||
type s9 struct {
|
||||
func test0(s s0) {
|
||||
println("test0")
|
||||
}
|
||||
|
||||
func test1(s s1) {
|
||||
println("test1")
|
||||
println("test1", s.a)
|
||||
}
|
||||
|
||||
func test2(s s2) {
|
||||
println("test2")
|
||||
println("test2", s.a, s.b)
|
||||
}
|
||||
|
||||
func test3(s s3) {
|
||||
println("test3")
|
||||
println("test3", s.a, s.b, s.c)
|
||||
}
|
||||
|
||||
func test4(s s4) {
|
||||
println("test4")
|
||||
println("test4", s.a, s.b, s.c, s.d)
|
||||
}
|
||||
|
||||
func test5(s s5) {
|
||||
println("test5")
|
||||
println("test5", s.a.aa, s.a.ab, s.b)
|
||||
}
|
||||
|
||||
func test6(s s6) {
|
||||
println("test6")
|
||||
println("test6", s.a, len(s.a), s.b)
|
||||
}
|
||||
|
||||
func test7(s s7) {
|
||||
println("test7")
|
||||
println("test7", s.a, s.b)
|
||||
}
|
||||
|
||||
func test8(s s8) {
|
||||
println("test8")
|
||||
}
|
||||
|
||||
func test9(s s9) {
|
||||
println("test9")
|
||||
println("test8", len(s.a), cap(s.a), s.a[0], s.a[1], s.b)
|
||||
}
|
||||
|
||||
func main() {
|
||||
test1(s1{})
|
||||
test2(s2{})
|
||||
test3(s3{})
|
||||
test4(s4{})
|
||||
test5(s5{})
|
||||
test6(s6{})
|
||||
test7(s7{})
|
||||
test8(s8{})
|
||||
test9(s9{})
|
||||
test0(s0{})
|
||||
test1(s1{1})
|
||||
test2(s2{1, 2})
|
||||
test3(s3{1, 2, 3})
|
||||
test4(s4{1, 2, 3, 4})
|
||||
test5(s5{a: struct {
|
||||
aa byte
|
||||
ab byte
|
||||
}{1, 2}, b: 3})
|
||||
test6(s6{"foo", 5})
|
||||
test7(s7{a: nil, b: 8})
|
||||
test8(s8{[]byte{12, 13, 14}[:2], 6})
|
||||
}
|
||||
|
|
18
testdata/structexpand.txt
предоставленный
18
testdata/structexpand.txt
предоставленный
|
@ -1,9 +1,9 @@
|
|||
test1
|
||||
test2
|
||||
test3
|
||||
test4
|
||||
test5
|
||||
test6
|
||||
test7
|
||||
test8
|
||||
test9
|
||||
test0
|
||||
test1 1
|
||||
test2 1 2
|
||||
test3 1 2 3
|
||||
test4 1 2 3 4
|
||||
test5 1 2 3
|
||||
test6 foo 3 5
|
||||
test7 (0:nil) 8
|
||||
test8 2 3 12 13 6
|
||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче