Mark the assert test helpers as such (#90)
Using `t.Helper()`. Also move the assert package to be internal.
This commit is contained in:
parent
33524d6836
commit
4858e5d47d
@ -5,8 +5,8 @@ import (
|
||||
"testing"
|
||||
|
||||
g "github.com/maragudk/gomponents"
|
||||
"github.com/maragudk/gomponents/assert"
|
||||
c "github.com/maragudk/gomponents/components"
|
||||
"github.com/maragudk/gomponents/internal/assert"
|
||||
)
|
||||
|
||||
func TestClasses(t *testing.T) {
|
||||
|
@ -4,9 +4,9 @@ import (
|
||||
"testing"
|
||||
|
||||
g "github.com/maragudk/gomponents"
|
||||
"github.com/maragudk/gomponents/assert"
|
||||
. "github.com/maragudk/gomponents/components"
|
||||
. "github.com/maragudk/gomponents/html"
|
||||
"github.com/maragudk/gomponents/internal/assert"
|
||||
)
|
||||
|
||||
func TestHTML5(t *testing.T) {
|
||||
|
@ -4,8 +4,8 @@ import (
|
||||
"testing"
|
||||
|
||||
g "github.com/maragudk/gomponents"
|
||||
"github.com/maragudk/gomponents/assert"
|
||||
c "github.com/maragudk/gomponents/components"
|
||||
"github.com/maragudk/gomponents/internal/assert"
|
||||
)
|
||||
|
||||
func TestInputHidden(t *testing.T) {
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
"testing"
|
||||
|
||||
g "github.com/maragudk/gomponents"
|
||||
"github.com/maragudk/gomponents/assert"
|
||||
"github.com/maragudk/gomponents/internal/assert"
|
||||
)
|
||||
|
||||
func TestNodeFunc(t *testing.T) {
|
||||
|
@ -5,8 +5,8 @@ import (
|
||||
"testing"
|
||||
|
||||
g "github.com/maragudk/gomponents"
|
||||
"github.com/maragudk/gomponents/assert"
|
||||
. "github.com/maragudk/gomponents/html"
|
||||
"github.com/maragudk/gomponents/internal/assert"
|
||||
)
|
||||
|
||||
func TestBooleanAttributes(t *testing.T) {
|
||||
|
@ -6,8 +6,8 @@ import (
|
||||
"testing"
|
||||
|
||||
g "github.com/maragudk/gomponents"
|
||||
"github.com/maragudk/gomponents/assert"
|
||||
. "github.com/maragudk/gomponents/html"
|
||||
"github.com/maragudk/gomponents/internal/assert"
|
||||
)
|
||||
|
||||
type erroringWriter struct{}
|
||||
|
@ -10,17 +10,20 @@ import (
|
||||
|
||||
// Equal checks for equality between the given expected string and the rendered Node string.
|
||||
func Equal(t *testing.T, expected string, actual g.Node) {
|
||||
t.Helper()
|
||||
|
||||
var b strings.Builder
|
||||
_ = actual.Render(&b)
|
||||
if expected != b.String() {
|
||||
t.Errorf("expected `%v` but got `%v`", expected, actual)
|
||||
t.FailNow()
|
||||
t.Fatalf(`expected "%v" but got "%v"`, expected, actual)
|
||||
}
|
||||
}
|
||||
|
||||
// Error checks for a non-nil error.
|
||||
func Error(t *testing.T, err error) {
|
||||
t.Helper()
|
||||
|
||||
if err == nil {
|
||||
t.FailNow()
|
||||
t.Fatal("error is nil")
|
||||
}
|
||||
}
|
@ -5,7 +5,7 @@ import (
|
||||
"testing"
|
||||
|
||||
g "github.com/maragudk/gomponents"
|
||||
"github.com/maragudk/gomponents/assert"
|
||||
"github.com/maragudk/gomponents/internal/assert"
|
||||
. "github.com/maragudk/gomponents/svg"
|
||||
)
|
||||
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
"testing"
|
||||
|
||||
g "github.com/maragudk/gomponents"
|
||||
"github.com/maragudk/gomponents/assert"
|
||||
"github.com/maragudk/gomponents/internal/assert"
|
||||
. "github.com/maragudk/gomponents/svg"
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user