Ejemplo n.º 1
0
func (s *FileVarSuite) TestReadStdin(c *gc.C) {
	s.ctx.Stdin = bytes.NewBufferString("abc")

	var config cmd.FileVar
	config.SetStdin()
	config.Set("-")
	file, err := config.Read(s.ctx)
	c.Assert(err, gc.IsNil)
	c.Assert(string(file), gc.Equals, "abc")
}
Ejemplo n.º 2
0
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")
}
Ejemplo n.º 3
0
func (s *FileVarSuite) TestSetStdin(c *gc.C) {
	var config cmd.FileVar
	c.Assert(config.Path, gc.Equals, "")
	c.Assert(config.StdinMarkers, jc.DeepEquals, []string{})

	config.SetStdin()
	c.Assert(config.Path, gc.Equals, "")
	c.Assert(config.StdinMarkers, jc.DeepEquals, []string{"-"})

	config.SetStdin("<>", "@")
	c.Assert(config.Path, gc.Equals, "")
	c.Assert(config.StdinMarkers, jc.DeepEquals, []string{"<>", "@"})
}