aboutsummaryrefslogtreecommitdiff
path: root/cursed/useState_test.go
blob: 62780344f260207195198ff1323e6df3226cbec2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
package cursed

import "testing"

func TestUseState(t *testing.T) {
	val, setVal := UseState[string]("hi")

	if val() != "hi" {
		t.Errorf("wanted %q but got %q", "hi", val())
	}

	setVal("goodbye")
	if val() != "goodbye" {
		t.Errorf("wanted %q but got %q", "goodbye", val())
	}
}