From 952c8aef3f221ee266627c26b9d8e4c0d936258f Mon Sep 17 00:00:00 2001 From: Vincent Demeester Date: Mon, 26 Dec 2016 19:20:27 +0100 Subject: [PATCH] =?UTF-8?q?Display=20only=20the=20name=20of=20the=20requir?= =?UTF-8?q?ement=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit … relative to the integration-cli package Signed-off-by: Vincent Demeester --- integration-cli/requirement/requirement.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/integration-cli/requirement/requirement.go b/integration-cli/requirement/requirement.go index 82a1b9ad68..f60917447c 100644 --- a/integration-cli/requirement/requirement.go +++ b/integration-cli/requirement/requirement.go @@ -2,8 +2,10 @@ package requirement import ( "fmt" + "path" "reflect" "runtime" + "strings" ) type skipT interface { @@ -20,7 +22,12 @@ func Is(s skipT, requirements ...Test) { isValid := r() if !isValid { 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] +}