Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(222)

Unified Diff: charm/meta_test.go

Issue 6423062: schema: introduce StringMap; kill MapType and ListType
Patch Set: schema: introduce StringMap; kill MapType and ListType Created 12 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « charm/meta.go ('k') | environs/config/config.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: charm/meta_test.go
=== modified file 'charm/meta_test.go'
--- charm/meta_test.go 2012-07-11 13:46:41 +0000
+++ charm/meta_test.go 2012-07-19 22:31:15 +0000
@@ -6,7 +6,6 @@
"io/ioutil"
. "launchpad.net/gocheck"
"launchpad.net/juju-core/charm"
- "launchpad.net/juju-core/schema"
"launchpad.net/juju-core/testing"
"os"
"path/filepath"
@@ -110,34 +109,34 @@
// Shorthand is properly rewritten
v, err := e.Coerce("http", path)
c.Assert(err, IsNil)
- c.Assert(v, DeepEquals, schema.MapType{"interface": "http", "limit": nil, "optional": false, "scope": charm.ScopeGlobal})
+ c.Assert(v, DeepEquals, map[string]interface{}{"interface": "http", "limit": nil, "optional": false, "scope": charm.ScopeGlobal})
// Defaults are properly applied
- v, err = e.Coerce(schema.MapType{"interface": "http"}, path)
- c.Assert(err, IsNil)
- c.Assert(v, DeepEquals, schema.MapType{"interface": "http", "limit": nil, "optional": false, "scope": charm.ScopeGlobal})
-
- v, err = e.Coerce(schema.MapType{"interface": "http", "limit": 2}, path)
- c.Assert(err, IsNil)
- c.Assert(v, DeepEquals, schema.MapType{"interface": "http", "limit": int64(2), "optional": false, "scope": charm.ScopeGlobal})
-
- v, err = e.Coerce(schema.MapType{"interface": "http", "optional": true}, path)
- c.Assert(err, IsNil)
- c.Assert(v, DeepEquals, schema.MapType{"interface": "http", "limit": nil, "optional": true, "scope": charm.ScopeGlobal})
+ v, err = e.Coerce(map[string]interface{}{"interface": "http"}, path)
+ c.Assert(err, IsNil)
+ c.Assert(v, DeepEquals, map[string]interface{}{"interface": "http", "limit": nil, "optional": false, "scope": charm.ScopeGlobal})
+
+ v, err = e.Coerce(map[string]interface{}{"interface": "http", "limit": 2}, path)
+ c.Assert(err, IsNil)
+ c.Assert(v, DeepEquals, map[string]interface{}{"interface": "http", "limit": int64(2), "optional": false, "scope": charm.ScopeGlobal})
+
+ v, err = e.Coerce(map[string]interface{}{"interface": "http", "optional": true}, path)
+ c.Assert(err, IsNil)
+ c.Assert(v, DeepEquals, map[string]interface{}{"interface": "http", "limit": nil, "optional": true, "scope": charm.ScopeGlobal})
// Invalid data raises an error.
v, err = e.Coerce(42, path)
c.Assert(err, ErrorMatches, "<path>: expected map, got 42")
- v, err = e.Coerce(schema.MapType{"interface": "http", "optional": nil}, path)
+ v, err = e.Coerce(map[string]interface{}{"interface": "http", "optional": nil}, path)
c.Assert(err, ErrorMatches, "<path>.optional: expected bool, got nothing")
- v, err = e.Coerce(schema.MapType{"interface": "http", "limit": "none, really"}, path)
+ v, err = e.Coerce(map[string]interface{}{"interface": "http", "limit": "none, really"}, path)
c.Assert(err, ErrorMatches, "<path>.limit: unsupported value")
// Can change default limit
e = charm.IfaceExpander(1)
- v, err = e.Coerce(schema.MapType{"interface": "http"}, path)
+ v, err = e.Coerce(map[string]interface{}{"interface": "http"}, path)
c.Assert(err, IsNil)
- c.Assert(v, DeepEquals, schema.MapType{"interface": "http", "limit": int64(1), "optional": false, "scope": charm.ScopeGlobal})
+ c.Assert(v, DeepEquals, map[string]interface{}{"interface": "http", "limit": int64(1), "optional": false, "scope": charm.ScopeGlobal})
}
« no previous file with comments | « charm/meta.go ('k') | environs/config/config.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b