-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcall_test.go
More file actions
48 lines (33 loc) · 788 Bytes
/
call_test.go
File metadata and controls
48 lines (33 loc) · 788 Bytes
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
package gg
import "testing"
func TestCalls(t *testing.T) {
t.Run("no owner", func(t *testing.T) {
buf := pool.Get()
defer buf.Free()
expected := "List()"
Call("List").render(buf)
compareAST(t, expected, buf.String())
})
t.Run("witch owner", func(t *testing.T) {
buf := pool.Get()
defer buf.Free()
expected := "x.List(src)"
Call("List").
WithOwner("x").
AddParameter("src").
render(buf)
compareAST(t, expected, buf.String())
})
t.Run("panic while owner is not nil", func(t *testing.T) {
})
t.Run("call list", func(t *testing.T) {
buf := pool.Get()
defer buf.Free()
expected := "x.List().Next(src,dst)"
Call("List").
WithOwner("x").
AddCall("Next", "src", "dst").
render(buf)
compareAST(t, expected, buf.String())
})
}