Debian Codegraph @

identifier/testing/testing_test.go

raw
1 /*
2 Copyright 2013-2014 Canonical Ltd.
3
4 This program is free software: you can redistribute it and/or modify it
5 under the terms of the GNU General Public License version 3, as published
6 by the Free Software Foundation.
7
8 This program is distributed in the hope that it will be useful, but
9 WITHOUT ANY WARRANTY; without even the implied warranties of
10 MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 PURPOSE. See the GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License along
14 with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17 package testing
18
19 import (
20 "testing"
21
22 . "gopkg.in/check.v1"
23 "gitlab.com/ubports/development/core/lomiri-push-service/identifier"
24 )
25
26 // hook up gocheck
27 func Test(t *testing.T) { TestingT(t) }
28
29 type IdentifierSuite struct{}
30
31 var _ = Suite(&IdentifierSuite{})
32
33 // TestSettableDefaultValueVisible tests that SettableIdentifier's default
34 // value is notable.
35 func (s *IdentifierSuite) TestSettableDefaultValueVisible(c *C) {
36 id := Settable()
37 c.Check(id.String(), Equals, "<Settable>")
38 }
39
40 // TestSettableSets tests that SettableIdentifier is settable.
41 func (s *IdentifierSuite) TestSettableSets(c *C) {
42 id := Settable()
43 id.Set("hello")
44 c.Check(id.String(), Equals, "hello")
45 }
46
47 // TestFailingStringNotEmpty tests that FailingIdentifier still has a
48 // non-empty string.
49 func (s *IdentifierSuite) TestFailingStringNotEmpty(c *C) {
50 id := Failing()
51 c.Check(id.String(), Equals, "<Failing>")
52 }
53
54 // TestIdentifierInterface tests that FailingIdentifier and
55 // SettableIdentifier implement Id.
56 func (s *IdentifierSuite) TestIdentifierInterface(c *C) {
57 _ = []identifier.Id{Failing(), Settable()}
58 }