From b1993dc24dbd72b24c5ff84193750f423272ae28 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 2 May 2013 15:36:30 -0700 Subject: [PATCH] Test that coreEnvironment can't encode/decode --- packer/environment_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packer/environment_test.go b/packer/environment_test.go index a842f1c4d..303bec327 100644 --- a/packer/environment_test.go +++ b/packer/environment_test.go @@ -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)