示例#1
0
文件: fetch_test.go 项目: 0xMF/toybox
func TestToFromSqlite(t *testing.T) {
	r, _ := adn.GetGlobal()
	res, err := ToFromSqlite(r, "data/blog_test.db")
	if len(res) == 0 || err != nil {
		t.Error("Expected result, got nil")
	}
	if len(r.Data) != len(res) {
		t.Error("Returned ADN results and persistence store returned aren't the same", len(r.Data), len(res))
	}
}
示例#2
0
文件: fetch.go 项目: 0xMF/toybox
func main() {

	rchan := make(chan adn.Response)

	go func() {
		r, err := adn.GetGlobal()
		check_error_status(err)
		rchan <- r
	}()

	go func() {
		r := <-rchan
		results, err := ToFromSqlite(r, file)
		check_error_status(err)

		for _, v := range results {
			fmt.Printf("%s\n", v)
		}
	}()

	fmt.Printf("Press any key to continue...")
	var input string
	fmt.Scanln(&input)
}
示例#3
0
文件: fetch_test.go 项目: 0xMF/toybox
func TestGlobalData(t *testing.T) {
	r, _ := adn.GetGlobal()
	if r.Meta.Code != 200 {
		t.Error("Expected 200, got ", r.Meta.Code)
	}
}