diff --git a/attribute/generated_test.go b/attribute/generated_test.go index 4e8e6db..be1a0a5 100644 --- a/attribute/generated_test.go +++ b/attribute/generated_test.go @@ -1,75 +1,75 @@ package attribute_test import ( - "testing" + "testing" - "gitlab.codemonkeysoftware.net/b/hatmill" - "gitlab.codemonkeysoftware.net/b/hatmill/attribute" + "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.Value != expectedValue { - t.Fatalf("expected attribute value to be %#v, but got %#v", expectedValue, attrib.Value) - } + t.Helper() + if attrib.Value != expectedValue { + t.Fatalf("expected attribute value to be %#v, but got %#v", expectedValue, attrib.Value) + } } func TestSpaceList(t *testing.T) { - t.Run("empty", func(t *testing.T) { - testAttribValue(t, attribute.Class(), "") - }) - t.Run("nonempty", func(t *testing.T) { - testAttribValue(t, attribute.Class("alpha", "bravo", "charlie"), "alpha bravo charlie") - }) + t.Run("empty", func(t *testing.T) { + testAttribValue(t, attribute.Class(), "") + }) + t.Run("nonempty", func(t *testing.T) { + testAttribValue(t, attribute.Class("alpha", "bravo", "charlie"), "alpha bravo charlie") + }) } func TestString(t *testing.T) { - const s = "abcdefg" - testAttribValue(t, attribute.Id(s), s) + const s = "abcdefg" + testAttribValue(t, attribute.Id(s), s) } func TestBool(t *testing.T) { - testAttribValue(t, attribute.Disabled(), "") + 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") - }) + 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") + }) } func TestInt(t *testing.T) { - t.Run("zero", func(t *testing.T) { - testAttribValue(t, attribute.Height(0), "0") - }) - t.Run("positive", func(t *testing.T) { - testAttribValue(t, attribute.Height(45), "45") - }) - t.Run("negative", func(t *testing.T) { - testAttribValue(t, attribute.Tabindex(-45), "-45") - }) + t.Run("zero", func(t *testing.T) { + testAttribValue(t, attribute.Height(0), "0") + }) + t.Run("positive", func(t *testing.T) { + testAttribValue(t, attribute.Height(45), "45") + }) + t.Run("negative", func(t *testing.T) { + testAttribValue(t, attribute.Tabindex(-45), "-45") + }) } func TestFloat(t *testing.T) { - for _, testcase := range []struct{ - name string - f float32 - value string - } { - {name: "zero", f: 0, value: "0"}, - {name: "integral", f: 45, value: "45"}, - {name: "positive fractional, small positive exponent", f: 12.55, value: "12.55"}, - {name: "positive fractional, large positive exponent", f: 1.55E+12, value: "1.55E+12"}, - {name: "positive fractional, large negative exponent", f: 1.55E-12, value: "1.55E-12"}, - {name: "negative fractional, small positive exponent", f: -12.55, value: "-12.55"}, - {name: "negative fractional, large positive exponent", f: -1.55E+12, value: "-1.55E+12"}, - {name: "negative fractional, large negative exponent", f: -1.55E-12, value: "-1.55E-12"}, - } { - t.Run(testcase.name, func(t *testing.T) { - testAttribValue(t, attribute.Min(testcase.f), testcase.value) - }) - } + for _, testcase := range []struct { + name string + f float32 + value string + }{ + {name: "zero", f: 0, value: "0"}, + {name: "integral", f: 45, value: "45"}, + {name: "positive fractional, small positive exponent", f: 12.55, value: "12.55"}, + {name: "positive fractional, large positive exponent", f: 1.55E+12, value: "1.55E+12"}, + {name: "positive fractional, large negative exponent", f: 1.55E-12, value: "1.55E-12"}, + {name: "negative fractional, small positive exponent", f: -12.55, value: "-12.55"}, + {name: "negative fractional, large positive exponent", f: -1.55E+12, value: "-1.55E+12"}, + {name: "negative fractional, large negative exponent", f: -1.55E-12, value: "-1.55E-12"}, + } { + t.Run(testcase.name, func(t *testing.T) { + testAttribValue(t, attribute.Min(testcase.f), testcase.value) + }) + } }