hatmill/attribute/generated_test.go
2019-08-31 10:20:58 -06:00

34 lines
797 B
Go

package attribute_test
import (
"testing"
"gitlab.codemonkeysoftware.net/b/hatmill"
"gitlab.codemonkeysoftware.net/b/hatmill/attribute"
)
func testAttribValue(t *testing.T, attrib hatmill.Attrib, expectedValue string) {
t.Helper()
if attrib.ValueString() != expectedValue {
t.Fatalf("expected attribute value to be %#v, but got %#v", expectedValue, attrib.ValueString())
}
}
func TestString(t *testing.T) {
const s = "abcdefg"
testAttribValue(t, attribute.Id(s), s)
}
func TestBool(t *testing.T) {
testAttribValue(t, attribute.Disabled(), "")
}
func TestExplicitBool(t *testing.T) {
t.Run("true", func(t *testing.T) {
testAttribValue(t, attribute.Draggable(true), "true")
})
t.Run("false", func(t *testing.T) {
testAttribValue(t, attribute.Draggable(false), "false")
})
}