summaryrefslogtreecommitdiffstats
path: root/model/modeltestlib.go
diff options
context:
space:
mode:
authorGeorge Goldberg <george@gberg.me>2017-04-20 14:58:54 +0100
committerJoram Wilander <jwawilander@gmail.com>2017-04-20 09:58:54 -0400
commit55bbf15fc7a83d3cda1fe5bc037823cbbc4fc023 (patch)
tree312f6a9c42c8f153168df8f960b613666777f64a /model/modeltestlib.go
parent8723f61f4540c74d5c755d7f9532f8fe199ccb6f (diff)
downloadchat-55bbf15fc7a83d3cda1fe5bc037823cbbc4fc023.tar.gz
chat-55bbf15fc7a83d3cda1fe5bc037823cbbc4fc023.tar.bz2
chat-55bbf15fc7a83d3cda1fe5bc037823cbbc4fc023.zip
PLT-6112: Add some more unit tests to the model package (#6142)
* Unit Tests for model/push_response.go * Unit tests for security_bulletin.go * Unit tests for webrtc.go * Unit tests for model/password_recovery.go * Add missing headers. * Unit tests for model/license.go * Tidy up existing tests. * Simplify JSON to/from tests. * Fix gofmt
Diffstat (limited to 'model/modeltestlib.go')
-rw-r--r--model/modeltestlib.go51
1 files changed, 51 insertions, 0 deletions
diff --git a/model/modeltestlib.go b/model/modeltestlib.go
new file mode 100644
index 000000000..2734b3ead
--- /dev/null
+++ b/model/modeltestlib.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)
+ }
+}