~rogpeppe/juju-core/438-local-instance-Addresses

« back to all changes in this revision

Viewing changes to formula/meta_test.go

  • Committer: Gustavo Niemeyer
  • Date: 2011-09-05 22:26:13 UTC
  • mto: This revision was merged to the branch mainline in revision 7.
  • Revision ID: gustavo@niemeyer.net-20110905222613-7im2u2s2dbxy1a3z
Implemented initial config parsing. No variable validation using the
parsed schema yet.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
        . "launchpad.net/gocheck"
6
6
        "launchpad.net/ensemble/go/formula"
7
7
        "launchpad.net/ensemble/go/schema"
8
 
        "launchpad.net/goyaml"
9
8
        "path/filepath"
10
9
)
11
10
 
134
133
        c.Assert(err, IsNil)
135
134
        c.Assert(v, Equals, schema.MapType{"interface": "http", "limit": int64(1), "optional": false})
136
135
}
137
 
 
138
 
 
139
 
func ReadYaml(path string) map[interface{}]interface{} {
140
 
        data, err := ioutil.ReadFile(path)
141
 
        if err != nil {
142
 
                panic(err)
143
 
        }
144
 
        m := make(map[interface{}]interface{})
145
 
        err = goyaml.Unmarshal(data, m)
146
 
        if err != nil {
147
 
                panic(err)
148
 
        }
149
 
        return m
150
 
}
151
 
 
152
 
func DumpYaml(v interface{}) []byte {
153
 
        data, err := goyaml.Marshal(v)
154
 
        if err != nil {
155
 
                panic(err)
156
 
        }
157
 
        return data
158
 
}