summaryrefslogtreecommitdiffstats
path: root/model/modeltestlib_test.go
diff options
context:
space:
mode:
authorAdrien <adrien@bustany.org>2017-06-26 20:32:39 +0200
committerJoram Wilander <jwawilander@gmail.com>2017-06-26 14:32:39 -0400
commitf404483834613fc1250b105461c68145f9543421 (patch)
tree330a0f60f44e48eb72da9f77f9d7b59d8d4ff896 /model/modeltestlib_test.go
parent82b36b3721d6ee129d27c3fc3957d4e37643d4a6 (diff)
downloadchat-f404483834613fc1250b105461c68145f9543421.tar.gz
chat-f404483834613fc1250b105461c68145f9543421.tar.bz2
chat-f404483834613fc1250b105461c68145f9543421.zip
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.
Diffstat (limited to 'model/modeltestlib_test.go')
-rw-r--r--model/modeltestlib_test.go51
1 files changed, 51 insertions, 0 deletions
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)
+ }
+}