Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
wyne authored and oz committed Aug 29, 2024
1 parent 0bdd6e2 commit 51bf458
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
15 changes: 2 additions & 13 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func (m model) Init() tea.Cmd {
return tick()
}

func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
func (m *model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {

case tea.KeyMsg:
Expand Down Expand Up @@ -182,20 +182,9 @@ func main() {

initialModel.interactive = !*exitQuick

// if len(os.Getenv("DEBUG")) > 0 {
// f, err := tea.LogToFile("debug.log", "debug")
// if err != nil {
// fmt.Println("fatal:", err)
// os.Exit(1)
// }
// defer f.Close()
// }

p := tea.NewProgram(initialModel)
p := tea.NewProgram(&initialModel)
if err := p.Start(); err != nil {
fmt.Printf("Alas, there's been an error: %v", err)
os.Exit(1)
}

// loadConfigFile()
}
4 changes: 2 additions & 2 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func TestUpdateIncHour(t *testing.T) {
t.Errorf("Expected nil Cmd, but got %v", cmd)
return
}
h := nextState.(model).clock.t.Hour()
h := nextState.(*model).clock.t.Hour()
if h != test.nextHour {
t.Errorf("Expected %d, but got %d", test.nextHour, h)
}
Expand Down Expand Up @@ -111,7 +111,7 @@ func TestUpdateDecHour(t *testing.T) {
t.Errorf("Expected nil Cmd, but got %v", cmd)
return
}
h := nextState.(model).clock.t.Hour()
h := nextState.(*model).clock.t.Hour()
if h != test.nextHour {
t.Errorf("Expected %d, but got %d", test.nextHour, h)
}
Expand Down

0 comments on commit 51bf458

Please sign in to comment.