Test that coreEnvironment can't encode/decode

This commit is contained in:
Mitchell Hashimoto 2013-05-02 15:36:30 -07:00
parent 575489fa78
commit b1993dc24d
1 changed files with 15 additions and 0 deletions

View File

@ -3,6 +3,7 @@ package packer
import (
"bytes"
"cgl.tideland.biz/asserts"
"encoding/gob"
"os"
"strings"
"testing"
@ -23,6 +24,20 @@ func testEnvironment() Environment {
return env
}
// This is just a sanity test to prove that our coreEnvironment can't
// encode or decode using gobs. That is fine, and expected, but I just like
// to be sure.
func TestEnvironment_CoreEnvironmentCantEncode(t *testing.T) {
assert := asserts.NewTestingAsserts(t, true)
env := testEnvironment()
b := new(bytes.Buffer)
e := gob.NewEncoder(b)
err := e.Encode(env)
assert.NotNil(err, "encoding should fail")
}
func TestEnvironment_DefaultConfig_Command(t *testing.T) {
assert := asserts.NewTestingAsserts(t, true)