packer-cn/helper/multistep/statebag_test.go

31 lines
495 B
Go
Raw Permalink Normal View History

2018-01-18 01:49:03 -05:00
package multistep
import (
"testing"
)
func TestBasicStateBag_ImplRunner(t *testing.T) {
var raw interface{}
raw = &BasicStateBag{}
if _, ok := raw.(StateBag); !ok {
t.Fatalf("must be a StateBag")
}
}
func TestBasicStateBag(t *testing.T) {
b := new(BasicStateBag)
if b.Get("foo") != nil {
t.Fatalf("bad: %#v", b.Get("foo"))
}
if _, ok := b.GetOk("foo"); ok {
t.Fatal("should not have foo")
}
b.Put("foo", "bar")
if b.Get("foo").(string) != "bar" {
t.Fatalf("bad")
}
}