func (s *ChainMapSuite) TestGet2(c *gc.C) { chainMap := chainmap.New(s.dict1, s.dict2) result := chainMap.Get("value") c.Assert(result, gc.Equals, "4") result = chainMap.Get("testing") c.Assert(result, gc.Equals, "2") }
// return a string value for the named option. All % interpolations are // expanded in the return values, based on the defaults passed into the // constructor and the DEFAULT section. func (p *ConfigParser) GetInterpolated(section, option string) (string, error) { o, err := p.Items(section) if err != nil { return "", err } c := chainmap.New(chainmap.Dict(p.Defaults()), chainmap.Dict(o)) return p.getInterpolated(section, option, c) }
func (s *ChainMapSuite) TestGet3(c *gc.C) { chainMap := chainmap.New(s.dict2, s.dict1) result := chainMap.Get("value") c.Assert(result, gc.Equals, "3") }
func (s *ChainMapSuite) TestGet1(c *gc.C) { chainMap := chainmap.New(s.dict1, s.dict2) result := chainMap.Get("unknown") c.Assert(result, gc.Equals, "") }
func (s *ChainMapSuite) TestLen(c *gc.C) { chainMap := chainmap.New(s.dict1, s.dict2) c.Assert(chainMap.Len(), gc.Equals, 2) }