Skip to content

Commit

Permalink
chore: Use generic function in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
twpayne committed Mar 31, 2024
1 parent 97f27d1 commit ed0186f
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion internal/chezmoibubbles/boolinputmodel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func TestBoolInputModel(t *testing.T) {
}{
{
name: "empty_with_default",
defaultValue: newBool(true),
defaultValue: newValue(true),
input: "\r",
expectedValue: true,
},
Expand Down
6 changes: 3 additions & 3 deletions internal/chezmoibubbles/chezmoibubbles_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ func testRunModelWithInput[M tea.Model]( //nolint:ireturn,nolintlint
return model
}

func newBool(b bool) *bool { return &b }
func newInt64(i int64) *int64 { return &i }
func newString(s string) *string { return &s }
func newValue[T any](value T) *T {
return &value
}
2 changes: 1 addition & 1 deletion internal/chezmoibubbles/choiceinputmodel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestChoiceInputModel(t *testing.T) {
{
name: "empty_with_default",
choices: choicesYesNoAll,
defaultValue: newString("all"),
defaultValue: newValue("all"),
input: "\r",
expectedValue: "all",
},
Expand Down
2 changes: 1 addition & 1 deletion internal/chezmoibubbles/intinputmodel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func TestIntInputModel(t *testing.T) {
}{
{
name: "empty_with_default",
defaultValue: newInt64(1),
defaultValue: newValue(int64(1)),
input: "\r",
expectedValue: 1,
},
Expand Down
2 changes: 1 addition & 1 deletion internal/chezmoibubbles/stringinputmodel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func TestStringInputModel(t *testing.T) {
},
{
name: "empty_with_default",
defaultValue: newString("default"),
defaultValue: newValue("default"),
input: "\r",
expectedValue: "default",
},
Expand Down

0 comments on commit ed0186f

Please sign in to comment.