packer-cn/command/command_test.go

29 lines
470 B
Go
Raw Normal View History

2014-10-28 18:09:22 -04:00
package command
import (
"path/filepath"
2014-10-28 18:09:22 -04:00
"testing"
"github.com/mitchellh/cli"
)
const fixturesDir = "./test-fixtures"
func fatalCommand(t *testing.T, m Meta) {
ui := m.Ui.(*cli.MockUi)
t.Fatalf(
"Bad exit code.\n\nStdout:\n\n%s\n\nStderr:\n\n%s",
ui.OutputWriter.String(),
ui.ErrorWriter.String())
}
func testFixture(n string) string {
return filepath.Join(fixturesDir, n)
}
2014-10-28 18:09:22 -04:00
func testMeta(t *testing.T) Meta {
return Meta{
Ui: new(cli.MockUi),
}
}