search_test.go 435 B

12345678910111213141516171819202122232425262728
  1. package search
  2. import (
  3. "encoding/json"
  4. "fmt"
  5. "testing"
  6. )
  7. func TestSearch(t *testing.T) {
  8. text := "抗体"
  9. result, err := Query(text, 1, 0, 5, false)
  10. if err != nil {
  11. t.Fatal(err)
  12. }
  13. buf, _ := json.Marshal(result)
  14. fmt.Println(string(buf))
  15. }
  16. func TestGetTip(t *testing.T) {
  17. text := "胃"
  18. result, err := GetSearchTips(text, 1)
  19. if err != nil {
  20. t.Fatal(err)
  21. }
  22. buf, _ := json.Marshal(result)
  23. fmt.Println(string(buf))
  24. }