~ubuntu-branches/ubuntu/wily/juju-core/wily

« back to all changes in this revision

Viewing changes to src/launchpad.net/juju-core/utils/voyeur/value_test.go

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-02-28 16:53:15 UTC
  • mfrom: (1.1.19)
  • Revision ID: package-import@ubuntu.com-20140228165315-g8n1ds0jrtekhxq6
Tags: 1.17.4-0ubuntu1
* New upstream point release (LP: #1261628):
  - https://launchpad.net/juju-core/trunk/1.17.4
  - d/control: Prefer juju-mongodb over mongodb-server for juju-local
    package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
        v := NewValue(nil)
52
52
        expected := "12345"
53
53
        v.Set(expected)
54
 
        got, ok := v.Get()
55
 
        c.Assert(ok, jc.IsTrue)
 
54
        got := v.Get()
56
55
        c.Assert(got, gc.Equals, expected)
 
56
        c.Assert(v.Closed(), jc.IsFalse)
57
57
}
58
58
 
59
59
func (s *suite) TestValueInitial(c *gc.C) {
60
60
        expected := "12345"
61
61
        v := NewValue(expected)
62
 
        got, ok := v.Get()
63
 
        c.Assert(ok, jc.IsTrue)
 
62
        got := v.Get()
64
63
        c.Assert(got, gc.Equals, expected)
 
64
        c.Assert(v.Closed(), jc.IsFalse)
65
65
}
66
66
 
67
67
func (s *suite) TestValueClose(c *gc.C) {
68
68
        expected := "12345"
69
69
        v := NewValue(expected)
70
70
        c.Assert(v.Close(), gc.IsNil)
71
 
        got, ok := v.Get()
72
 
        c.Assert(ok, jc.IsFalse)
 
71
 
 
72
        isClosed := v.Closed()
 
73
        c.Assert(isClosed, jc.IsTrue)
 
74
        got := v.Get()
73
75
        c.Assert(got, gc.Equals, expected)
74
76
 
75
77
        // test that we can close multiple times without a problem
209
211
        ch <- true
210
212
 
211
213
        // prove the value is not closed, even though the watcher is
212
 
        _, ok := v.Get()
213
 
        c.Assert(ok, jc.IsTrue)
 
214
        c.Assert(v.Closed(), jc.IsFalse)
214
215
}
215
216
 
216
217
func (s *suite) TestWatchZeroValue(c *gc.C) {