From f404483834613fc1250b105461c68145f9543421 Mon Sep 17 00:00:00 2001 From: Adrien Date: Mon, 26 Jun 2017 20:32:39 +0200 Subject: platform/model: Don't pull in the "testing" package in normal builds (#6735) Rename all files importing the "testing" package in "platform/model" so that they only get compiled in test builds. This avoids the side effects of the testing package (notably, defining some command line flags with the "flags" package) for codebases importing the model package. --- model/modeltestlib_test.go | 51 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 model/modeltestlib_test.go (limited to 'model/modeltestlib_test.go') diff --git a/model/modeltestlib_test.go b/model/modeltestlib_test.go new file mode 100644 index 000000000..2734b3ead --- /dev/null +++ b/model/modeltestlib_test.go @@ -0,0 +1,51 @@ +// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +package model + +import ( + "runtime/debug" + "testing" +) + +func CheckInt(t *testing.T, got int, expected int) { + if got != expected { + debug.PrintStack() + t.Fatalf("Got: %v, Expected: %v", got, expected) + } +} + +func CheckInt64(t *testing.T, got int64, expected int64) { + if got != expected { + debug.PrintStack() + t.Fatalf("Got: %v, Expected: %v", got, expected) + } +} + +func CheckString(t *testing.T, got string, expected string) { + if got != expected { + debug.PrintStack() + t.Fatalf("Got: %v, Expected: %v", got, expected) + } +} + +func CheckTrue(t *testing.T, test bool) { + if !test { + debug.PrintStack() + t.Fatal("Expected true") + } +} + +func CheckFalse(t *testing.T, test bool) { + if test { + debug.PrintStack() + t.Fatal("Expected true") + } +} + +func CheckBool(t *testing.T, got bool, expected bool) { + if got != expected { + debug.PrintStack() + t.Fatalf("Got: %v, Expected: %v", got, expected) + } +} -- cgit v1.2.3-1-g7c22