2015-07-20 19:18:25 +00:00
|
|
|
package cli
|
2013-07-20 22:50:13 +00:00
|
|
|
|
|
|
|
import (
|
2016-04-28 20:05:14 +00:00
|
|
|
"os"
|
2013-07-20 22:50:13 +00:00
|
|
|
"reflect"
|
2016-04-28 20:05:14 +00:00
|
|
|
"runtime"
|
|
|
|
"strings"
|
2013-07-20 22:50:13 +00:00
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
2016-04-28 20:05:14 +00:00
|
|
|
var (
|
|
|
|
wd, _ = os.Getwd()
|
|
|
|
)
|
|
|
|
|
2016-05-25 16:05:14 +00:00
|
|
|
func init() {
|
|
|
|
os.Setenv("CLI_TEMPLATE_REPANIC", "1")
|
|
|
|
}
|
|
|
|
|
2013-07-20 22:50:13 +00:00
|
|
|
func expect(t *testing.T, a interface{}, b interface{}) {
|
2016-04-28 20:05:14 +00:00
|
|
|
_, fn, line, _ := runtime.Caller(1)
|
|
|
|
fn = strings.Replace(fn, wd+"/", "", -1)
|
|
|
|
|
2015-10-27 04:45:28 +00:00
|
|
|
if !reflect.DeepEqual(a, b) {
|
2016-04-28 20:05:14 +00:00
|
|
|
t.Errorf("(%s:%d) Expected %v (type %v) - Got %v (type %v)", fn, line, b, reflect.TypeOf(b), a, reflect.TypeOf(a))
|
2013-07-20 22:50:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func refute(t *testing.T, a interface{}, b interface{}) {
|
2015-10-27 04:45:28 +00:00
|
|
|
if reflect.DeepEqual(a, b) {
|
2013-07-20 22:50:13 +00:00
|
|
|
t.Errorf("Did not expect %v (type %v) - Got %v (type %v)", b, reflect.TypeOf(b), a, reflect.TypeOf(a))
|
|
|
|
}
|
|
|
|
}
|