query_test.go 393 B

12345678910111213141516171819
  1. package util
  2. import (
  3. "testing"
  4. )
  5. // TestQuery query method test case
  6. func TestQuery(t *testing.T) {
  7. result := Query(map[string]interface{}{
  8. "age": 12,
  9. "name": "Alan",
  10. "cat": "Peter",
  11. })
  12. if result == "" {
  13. // 由于hash是乱序 所以没法很好的预测输出的字符串
  14. // 将会输出符合Query规则的字符串 "age=12&name=Alan&cat=Peter"
  15. t.Error("NOT PASS")
  16. }
  17. }