OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package common | 5 package common |
6 | 6 |
7 import ( | 7 import ( |
8 "fmt" | 8 "fmt" |
9 "strings" | 9 "strings" |
10 "testing" | 10 "testing" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 So(ValidateInstanceTag(strings.Repeat("long", 200)+":abc"), Shou
ldNotBeNil) | 48 So(ValidateInstanceTag(strings.Repeat("long", 200)+":abc"), Shou
ldNotBeNil) |
49 So(ValidateInstanceTag("BADKEY:value"), ShouldNotBeNil) | 49 So(ValidateInstanceTag("BADKEY:value"), ShouldNotBeNil) |
50 So(ValidateInstanceTag("good:tag"), ShouldBeNil) | 50 So(ValidateInstanceTag("good:tag"), ShouldBeNil) |
51 So(ValidateInstanceTag("good_tag:"), ShouldBeNil) | 51 So(ValidateInstanceTag("good_tag:"), ShouldBeNil) |
52 So(ValidateInstanceTag("good:tag:blah"), ShouldBeNil) | 52 So(ValidateInstanceTag("good:tag:blah"), ShouldBeNil) |
53 So(ValidateInstanceTag("good_tag:asdad/asdad/adad/a\\asdasdad"),
ShouldBeNil) | 53 So(ValidateInstanceTag("good_tag:asdad/asdad/adad/a\\asdasdad"),
ShouldBeNil) |
54 }) | 54 }) |
55 } | 55 } |
56 | 56 |
57 func TestValidatePin(t *testing.T) { | 57 func TestValidatePin(t *testing.T) { |
58 » Convey("TestValidatePin works", t, func() { | 58 » Convey("ValidatePin works", t, func() { |
59 So(ValidatePin(Pin{"good/name", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaa"}), ShouldBeNil) | 59 So(ValidatePin(Pin{"good/name", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaa"}), ShouldBeNil) |
60 So(ValidatePin(Pin{"BAD/name", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaa"}), ShouldNotBeNil) | 60 So(ValidatePin(Pin{"BAD/name", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaa"}), ShouldNotBeNil) |
61 So(ValidatePin(Pin{"good/name", "aaaaaaaaaaa"}), ShouldNotBeNil) | 61 So(ValidatePin(Pin{"good/name", "aaaaaaaaaaa"}), ShouldNotBeNil) |
62 }) | 62 }) |
63 } | 63 } |
64 | 64 |
| 65 func TestValidateInstanceVersion(t *testing.T) { |
| 66 Convey("ValidateInstanceVersion works", t, func() { |
| 67 So(ValidateInstanceVersion("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaa"), ShouldBeNil) |
| 68 So(ValidateInstanceVersion("good:tag"), ShouldBeNil) |
| 69 So(ValidateInstanceVersion("BADTAG:"), ShouldNotBeNil) |
| 70 }) |
| 71 } |
| 72 |
65 func TestPinToString(t *testing.T) { | 73 func TestPinToString(t *testing.T) { |
66 Convey("Pin.String works", t, func() { | 74 Convey("Pin.String works", t, func() { |
67 So( | 75 So( |
68 fmt.Sprintf("%s", Pin{"good/name", "aaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaa"}), | 76 fmt.Sprintf("%s", Pin{"good/name", "aaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaa"}), |
69 ShouldEqual, | 77 ShouldEqual, |
70 "good/name:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") | 78 "good/name:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") |
71 }) | 79 }) |
72 } | 80 } |
OLD | NEW |