aboutsummaryrefslogtreecommitdiffstats
path: root/Godeps/_workspace/src/github.com/pborman/uuid/sql_test.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-09-14 18:06:59 +0800
committerFelix Lange <fjl@twurst.com>2015-09-14 18:06:59 +0800
commita9c809b441146dcd2c3f4d174f00148a510aeb75 (patch)
treece7bb6b4597c97405fed4621e54df5e8bb24c884 /Godeps/_workspace/src/github.com/pborman/uuid/sql_test.go
parent55ed8d108d72d12543ecdc6d8c9d9978392dabf0 (diff)
parent0d4072777520a665637937efd440e06f18ea0626 (diff)
downloadgo-tangerine-a9c809b441146dcd2c3f4d174f00148a510aeb75.tar.gz
go-tangerine-a9c809b441146dcd2c3f4d174f00148a510aeb75.tar.zst
go-tangerine-a9c809b441146dcd2c3f4d174f00148a510aeb75.zip
Merge pull request #1792 from jeffallen/uuid
Change go-uuid to use the current supported repository.
Diffstat (limited to 'Godeps/_workspace/src/github.com/pborman/uuid/sql_test.go')
-rw-r--r--Godeps/_workspace/src/github.com/pborman/uuid/sql_test.go53
1 files changed, 53 insertions, 0 deletions
diff --git a/Godeps/_workspace/src/github.com/pborman/uuid/sql_test.go b/Godeps/_workspace/src/github.com/pborman/uuid/sql_test.go
new file mode 100644
index 000000000..d643567ee
--- /dev/null
+++ b/Godeps/_workspace/src/github.com/pborman/uuid/sql_test.go
@@ -0,0 +1,53 @@
+// Copyright 2015 Google Inc. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package uuid
+
+import (
+ "strings"
+ "testing"
+)
+
+func TestScan(t *testing.T) {
+ var stringTest string = "f47ac10b-58cc-0372-8567-0e02b2c3d479"
+ var byteTest []byte = Parse(stringTest)
+ var badTypeTest int = 6
+ var invalidTest string = "f47ac10b-58cc-0372-8567-0e02b2c3d4"
+ var invalidByteTest []byte = Parse(invalidTest)
+
+ var uuid UUID
+ err := (&uuid).Scan(stringTest)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ err = (&uuid).Scan(byteTest)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ err = (&uuid).Scan(badTypeTest)
+ if err == nil {
+ t.Error("int correctly parsed and shouldn't have")
+ }
+ if !strings.Contains(err.Error(), "unable to scan type") {
+ t.Error("attempting to parse an int returned an incorrect error message")
+ }
+
+ err = (&uuid).Scan(invalidTest)
+ if err == nil {
+ t.Error("invalid uuid was parsed without error")
+ }
+ if !strings.Contains(err.Error(), "invalid UUID") {
+ t.Error("attempting to parse an invalid UUID returned an incorrect error message")
+ }
+
+ err = (&uuid).Scan(invalidByteTest)
+ if err == nil {
+ t.Error("invalid byte uuid was parsed without error")
+ }
+ if !strings.Contains(err.Error(), "invalid UUID") {
+ t.Error("attempting to parse an invalid byte UUID returned an incorrect error message")
+ }
+}