forked from wingyplus/dump.go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dump_test.go
58 lines (48 loc) · 963 Bytes
/
dump_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package dump_test
import (
. "dump"
"testing"
// "go/parser"
"go/token"
"exec"
// "fmt"
)
var emptyString = ""
type S struct {
A int
B int
}
type T struct {
S
C int
}
type Circular struct {
c *Circular
}
func TestDump(t *testing.T) {
// empty
// func ParseFile(filename string, src interface{}, scope *ast.Scope, mode uint) (*ast.File, os.Error)
/*
file, e := parser.ParseFile(nil, "dump_test.go", nil, parser.ParseComments)
if e != nil {
fmt.Println("error", e)
} else {
*/
// fmt.Printf("%#v\n", file);
// Dump(file)
Dump(map[string]int{"satu": 1, "dua": 2})
Dump([]int{1, 2, 3})
Dump([3]int{1, 2, 3})
Dump(&[][]int{[]int{1, 2, 3}, []int{1, 2, 3}, []int{1, 2, 3}})
Dump(&emptyString)
Dump(T{S{1, 2}, 3})
Dump(token.STRING)
bulet := make([]Circular, 3)
bulet[0].c = &bulet[1]
bulet[1].c = &bulet[2]
bulet[2].c = &bulet[0]
Dump(struct{ a []Circular }{bulet})
cmd := exec.Command("ls", "-la")
Dump(cmd)
// }
}