Index: testing/checkers/bool_test.go |
=== added file 'testing/checkers/bool_test.go' |
--- testing/checkers/bool_test.go 1970-01-01 00:00:00 +0000 |
+++ testing/checkers/bool_test.go 2013-06-19 04:43:15 +0000 |
@@ -0,0 +1,35 @@ |
+// Copyright 2013 Canonical Ltd. |
+// Licensed under the AGPLv3, see LICENCE file for details. |
+ |
+package checkers_test |
+ |
+import ( |
+ . "launchpad.net/gocheck" |
+ . "launchpad.net/juju-core/testing/checkers" |
+) |
+ |
+type BoolSuite struct{} |
+ |
+var _ = Suite(&BoolSuite{}) |
+ |
+func (s *BoolSuite) TestIsTrue(c *C) { |
+ c.Assert(true, IsTrue) |
+ c.Assert(false, Not(IsTrue)) |
+ |
+ result, msg := IsTrue.Check([]interface{}{false}, nil) |
+ c.Assert(result, Equals, false) |
+ c.Assert(msg, Equals, "") |
+ |
+ result, msg = IsTrue.Check([]interface{}{"foo"}, nil) |
+ c.Assert(result, Equals, false) |
+ c.Check(msg, Equals, `expected bool:true, received string:"foo"`) |
+ |
+ result, msg = IsTrue.Check([]interface{}{42}, nil) |
+ c.Assert(result, Equals, false) |
+ c.Assert(msg, Equals, `expected bool:true, received int:42`) |
+} |
+ |
+func (s *BoolSuite) TestIsFalse(c *C) { |
+ c.Assert(false, IsFalse) |
+ c.Assert(true, Not(IsFalse)) |
+} |