forked from Oskang09/goloquent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdecoder_test.go
56 lines (43 loc) · 1.1 KB
/
decoder_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
package goloquent
import (
"fmt"
"testing"
)
func TestEscape(t *testing.T) {
txt := "hello word"
if escape([]byte(fmt.Sprintf(`"%s"`, txt))) != txt {
t.Errorf(errUnexpectedResult, "escape")
}
}
func TestInitStruct(t *testing.T) {
}
func TestIterator(t *testing.T) {
// var i testUser
// email := `[email protected]`
// it := &Iterator{}
// it.put(0, "Email", []byte(email))
// it.put(0, "Age", []byte(`100`))
// it.put(0, "IsSingle", nil)
// if err := it.Scan(&i); err != nil {
// t.Errorf("")
// }
// if i.Email != email {
// t.Error()
// }
// fmt.Println(i)
}
func TestValueToInterface(t *testing.T) {
// var i testUser
// vt := reflect.TypeOf(i)
// vv, _ := valueToInterface(vt.Field(0).Type, []byte(`178330303`), true)
// if vv != "178330303" {
// log.Fatal(fmt.Sprintf("Unexpected value using valueToInterface %v", vv))
// }
// vv, _ = valueToInterface(vt.Field(2).Type, []byte(`Joe`), true)
// if vv != "Joe" {
// log.Fatal(fmt.Sprintf("Unexpected value using valueToInterface %v", vv))
// }
}
func TestLoadStructField(t *testing.T) {}
func TestLoadField(t *testing.T) {
}