Commit 8c9d2454 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

command/build: remove asserts framewor

parent 79f7936d
...@@ -2,7 +2,6 @@ package build ...@@ -2,7 +2,6 @@ package build
import ( import (
"bytes" "bytes"
"cgl.tideland.biz/asserts"
"github.com/mitchellh/packer/packer" "github.com/mitchellh/packer/packer"
"testing" "testing"
) )
...@@ -23,33 +22,33 @@ func testEnvironment() packer.Environment { ...@@ -23,33 +22,33 @@ func testEnvironment() packer.Environment {
} }
func TestCommand_Implements(t *testing.T) { func TestCommand_Implements(t *testing.T) {
assert := asserts.NewTestingAsserts(t, true) var _ packer.Command = new(Command)
var actual packer.Command
assert.Implementor(new(Command), &actual, "should be a Command")
} }
func TestCommand_Run_NoArgs(t *testing.T) { func TestCommand_Run_NoArgs(t *testing.T) {
assert := asserts.NewTestingAsserts(t, true)
command := new(Command) command := new(Command)
result := command.Run(testEnvironment(), make([]string, 0)) result := command.Run(testEnvironment(), make([]string, 0))
assert.Equal(result, 1, "no args should error") if result != 1 {
t.Fatalf("bad: %d", result)
}
} }
func TestCommand_Run_MoreThanOneArg(t *testing.T) { func TestCommand_Run_MoreThanOneArg(t *testing.T) {
assert := asserts.NewTestingAsserts(t, true)
command := new(Command) command := new(Command)
args := []string{"one", "two"} args := []string{"one", "two"}
result := command.Run(testEnvironment(), args) result := command.Run(testEnvironment(), args)
assert.Equal(result, 1, "More than one arg should fail") if result != 1 {
t.Fatalf("bad: %d", result)
}
} }
func TestCommand_Run_MissingFile(t *testing.T) { func TestCommand_Run_MissingFile(t *testing.T) {
assert := asserts.NewTestingAsserts(t, true)
command := new(Command) command := new(Command)
args := []string{"i-better-not-exist"} args := []string{"i-better-not-exist"}
result := command.Run(testEnvironment(), args) result := command.Run(testEnvironment(), args)
assert.Equal(result, 1, "a non-existent file should error") if result != 1 {
t.Fatalf("bad: %d", result)
}
} }
...@@ -93,5 +93,5 @@ func templateTimestamp() string { ...@@ -93,5 +93,5 @@ func templateTimestamp() string {
} }
func templateUuid() string { func templateUuid() string {
return hex.EncodeToString(uuid.TimeOrderedUUID()) return uuid.TimeOrderedUUID()
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment