You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

29 lines
594 B

  1. package cli
  2. import (
  3. "os"
  4. "reflect"
  5. "runtime"
  6. "strings"
  7. "testing"
  8. )
  9. var (
  10. wd, _ = os.Getwd()
  11. )
  12. func expect(t *testing.T, a interface{}, b interface{}) {
  13. _, fn, line, _ := runtime.Caller(1)
  14. fn = strings.Replace(fn, wd+"/", "", -1)
  15. if !reflect.DeepEqual(a, b) {
  16. t.Errorf("(%s:%d) Expected %v (type %v) - Got %v (type %v)", fn, line, b, reflect.TypeOf(b), a, reflect.TypeOf(a))
  17. }
  18. }
  19. func refute(t *testing.T, a interface{}, b interface{}) {
  20. if reflect.DeepEqual(a, b) {
  21. t.Errorf("Did not expect %v (type %v) - Got %v (type %v)", b, reflect.TypeOf(b), a, reflect.TypeOf(a))
  22. }
  23. }