func assertScriptMatches(c *gc.C, cfg cloudinit.CloudConfig, pattern string, match bool) { script, err := cfg.RenderScript() c.Assert(err, jc.ErrorIsNil) checker := gc.Matches if !match { checker = gc.Not(checker) } c.Assert(script, checker, pattern) }