urfave-cli/altsrc/helpers_test.go

32 lines
695 B
Go
Raw Normal View History

package altsrc
2015-12-06 23:43:18 +00:00
import (
"os"
2015-12-06 23:43:18 +00:00
"reflect"
"runtime"
"strings"
2015-12-06 23:43:18 +00:00
"testing"
)
var (
wd, _ = os.Getwd()
)
2015-12-06 23:43:18 +00:00
func expect(t *testing.T, a interface{}, b interface{}) {
_, fn, line, _ := runtime.Caller(1)
fn = strings.Replace(fn, wd+"/", "", -1)
if !reflect.DeepEqual(a, b) {
t.Errorf("(%s:%d) Expected %v (type %v) - Got %v (type %v)", fn, line, b, reflect.TypeOf(b), a, reflect.TypeOf(a))
2015-12-06 23:43:18 +00:00
}
}
func refute(t *testing.T, a interface{}, b interface{}) {
_, fn, line, _ := runtime.Caller(1)
fn = strings.Replace(fn, wd+"/", "", -1)
if reflect.DeepEqual(a, b) {
t.Errorf("(%s:%d) Did not expect %v (type %v) - Got %v (type %v)", fn, line, b, reflect.TypeOf(b), a, reflect.TypeOf(a))
2015-12-06 23:43:18 +00:00
}
}