func (s *FileVarSuite) TestOpenNotStdin(c *gc.C) { var config cmd.FileVar config.Set("-") _, err := config.Open(s.ctx) c.Check(err, jc.Satisfies, os.IsNotExist) }
func (s *FileVarSuite) TestOpenStdin(c *gc.C) { s.ctx.Stdin = bytes.NewBufferString("abc") var config cmd.FileVar config.SetStdin() config.Set("-") file, err := config.Open(s.ctx) c.Assert(err, gc.IsNil) s.checkOpen(c, file, "abc") }
func (s *FileVarSuite) TestOpenTilde(c *gc.C) { path := filepath.Join(utils.Home(), "config.yaml") err := ioutil.WriteFile(path, []byte("abc"), 0644) c.Assert(err, gc.IsNil) var config cmd.FileVar config.Set("~/config.yaml") file, err := config.Open(s.ctx) c.Assert(err, gc.IsNil) s.checkOpen(c, file, "abc") }