|
@@ -2,8 +2,10 @@ package requirement
|
|
|
|
|
|
import (
|
|
import (
|
|
"fmt"
|
|
"fmt"
|
|
|
|
+ "path"
|
|
"reflect"
|
|
"reflect"
|
|
"runtime"
|
|
"runtime"
|
|
|
|
+ "strings"
|
|
)
|
|
)
|
|
|
|
|
|
type skipT interface {
|
|
type skipT interface {
|
|
@@ -20,7 +22,12 @@ func Is(s skipT, requirements ...Test) {
|
|
isValid := r()
|
|
isValid := r()
|
|
if !isValid {
|
|
if !isValid {
|
|
requirementFunc := runtime.FuncForPC(reflect.ValueOf(r).Pointer()).Name()
|
|
requirementFunc := runtime.FuncForPC(reflect.ValueOf(r).Pointer()).Name()
|
|
- s.Skip(fmt.Sprintf("unmatched requirement %s", requirementFunc))
|
|
|
|
|
|
+ s.Skip(fmt.Sprintf("unmatched requirement %s", extractRequirement(requirementFunc)))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+func extractRequirement(requirementFunc string) string {
|
|
|
|
+ requirement := path.Base(requirementFunc)
|
|
|
|
+ return strings.SplitN(requirement, ".", 2)[1]
|
|
|
|
+}
|