-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalue_test.go
More file actions
41 lines (34 loc) · 821 Bytes
/
value_test.go
File metadata and controls
41 lines (34 loc) · 821 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
package flyline
import "testing"
func TestValue_Scan_Basic(t *testing.T) {
var err error = nil
vInt := int64(1)
i := int64(0)
err = ValueScan(vInt, &i)
t.Logf("int64: %v, %v", i == vInt, err)
vBool := true
b := false
err = ValueScan(vBool, &b)
t.Logf("bool: %v, %v", b == vBool, err)
}
func TestValue_Scan_Slice(t *testing.T) {
var err error = nil
v := []int64{1, 2, 3, 4}
s := make([]int64, 0, 4)
err = ValueScan(v, &s)
t.Logf("slice: src = %v, dest = %v, err = %v", v, s, err)
}
type P struct {
V int64
}
func TestValue_Scan_Interface(t *testing.T) {
var err error = nil
v1 := &P{1}
s1 := P{}
err = ValueScan(v1, &s1)
t.Logf("slice: src = %v, dest = %v, err = %v", v1, s1, err)
v2 := P{1}
s2 := new(P)
err = ValueScan(v2, s2)
t.Logf("slice: src = %v, dest = %v, err = %v", v2, s2, err)
}