first commit
This commit is contained in:
commit
a617cf50ee
8 files changed
+799
No files matched your search
@@ -0,0 +1,29 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestUserJsonification(t *testing.T) {
|
||||
jsonForm := `{"screen_name": "boblechef", "id": 2920819021}`
|
||||
expectedUser := &User{"boblechef", 2920819021}
|
||||
u := new(User)
|
||||
if err := json.Unmarshal([]byte(jsonForm), u); err != nil {
|
||||
t.Error(err)
|
||||
} else if !reflect.DeepEqual(u, expectedUser) {
|
||||
t.Fail()
|
||||
}
|
||||
}
|
||||
|
||||
func TestFollowerListJsonification(t *testing.T) {
|
||||
jsonForm := `{"next_cursor_str": "3333", "users":[ {"screen_name": "boblechef", "id": 2920819021}]}`
|
||||
expectedUserList := &FollowerList{"3333", []*User{&User{"boblechef", 2920819021}}}
|
||||
l := new(FollowerList)
|
||||
if err := json.Unmarshal([]byte(jsonForm), l); err != nil {
|
||||
t.Error(err)
|
||||
} else if !reflect.DeepEqual(l, expectedUserList) {
|
||||
t.Fail()
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user