File: statebag_test.go

package info (click to toggle)
golang-github-mitchellh-multistep 0.0~git20170316.391576a-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, forky, sid, trixie
  • size: 84 kB
  • sloc: makefile: 2
file content (30 lines) | stat: -rw-r--r-- 495 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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")
	}
}