Skip to content

Commit

Permalink
Style things
Browse files Browse the repository at this point in the history
  • Loading branch information
matta committed Jun 1, 2024
1 parent 0350a48 commit 51f2adf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
8 changes: 4 additions & 4 deletions internal/replicatedtodo/replicatedtodo.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@ func (model *Model) SetTitle(id string, title string) {
}

func (model *Model) DebugString() string {
var sb strings.Builder
var builder strings.Builder

sb.WriteString(fmt.Sprintf("Model @%p\n", model))
builder.WriteString(fmt.Sprintf("Model @%p\n", model))
for id, item := range model.Items {
sb.WriteString(fmt.Sprintf("%v:\n %s\n", id, item.DebugString()))
builder.WriteString(fmt.Sprintf("%v:\n %s\n", id, item.DebugString()))
}

return sb.String()
return builder.String()
}
11 changes: 5 additions & 6 deletions internal/replicatedtodo/replicatedtodo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@ func TestModel_NewTodo(t *testing.T) {
if len(model.Items) != 1 {
t.Errorf("len(model.Items) = %v, want %v", len(model.Items), 1)
}

if len(model.States) != 1 {
t.Errorf("len(model.States) = %v, want %v", len(model.States), 1)
}
}

func TestNew(t *testing.T) {
got := replicatedtodo.New()
if got.States == nil {
t.Errorf("New() = %v, want non-nil States", got)
if got.Items == nil {
t.Errorf("New() = %v, want non-nil Items", got)
}
if len(got.Items) != 0 {
t.Errorf("New() = %v, want non-nil Items", got)
}
}

0 comments on commit 51f2adf

Please sign in to comment.