~ps-jenkins/ubuntu-push/utopic-proposed

« back to all changes in this revision

Viewing changes to whoopsie/identifier/testing/testing_test.go

  • Committer: CI bot
  • Author(s): Roberto Alsina, John R. Lenton
  • Date: 2014-08-12 02:33:07 UTC
  • mfrom: (118.1.3 merge-automatic)
  • Revision ID: ps-jenkins@lists.canonical.com-20140812023307-74ffayf1jqmoqp2s
Roberto's branch + fixes to tests that failed in chroot. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
        identifier ".."
21
 
        . "launchpad.net/gocheck"
22
 
        "testing"
23
 
)
24
 
 
25
 
// hook up gocheck
26
 
func Test(t *testing.T) { TestingT(t) }
27
 
 
28
 
type IdentifierSuite struct{}
29
 
 
30
 
var _ = Suite(&IdentifierSuite{})
31
 
 
32
 
// TestSettableDefaultValueVisible tests that SettableIdentifier's default
33
 
// value is notable.
34
 
func (s *IdentifierSuite) TestSettableDefaultValueVisible(c *C) {
35
 
        id := Settable()
36
 
        c.Check(id.String(), Equals, "<Settable>")
37
 
}
38
 
 
39
 
// TestSettableSets tests that SettableIdentifier is settable.
40
 
func (s *IdentifierSuite) TestSettableSets(c *C) {
41
 
        id := Settable()
42
 
        id.Set("hello")
43
 
        c.Check(id.String(), Equals, "hello")
44
 
}
45
 
 
46
 
// TestSettableGenerateDoesNotFail tests that SettableIdentifier's Generate
47
 
// does not fail.
48
 
func (s *IdentifierSuite) TestSettableGenerateDoesNotFail(c *C) {
49
 
        id := Settable()
50
 
        c.Check(id.Generate(), Equals, nil)
51
 
}
52
 
 
53
 
// TestFailingFails tests that FailingIdentifier fails.
54
 
func (s *IdentifierSuite) TestFailingFails(c *C) {
55
 
        id := Failing()
56
 
        c.Check(id.Generate(), Not(Equals), nil)
57
 
}
58
 
 
59
 
// TestFailingStringNotEmpty tests that FailingIdentifier still has a
60
 
// non-empty string.
61
 
func (s *IdentifierSuite) TestFailingStringNotEmpty(c *C) {
62
 
        id := Failing()
63
 
        c.Check(id.String(), Equals, "<Failing>")
64
 
}
65
 
 
66
 
// TestIdentifierInterface tests that FailingIdentifier and
67
 
// SettableIdentifier implement Id.
68
 
func (s *IdentifierSuite) TestIdentifierInterface(c *C) {
69
 
        _ = []identifier.Id{Failing(), Settable()}
70
 
}