Add more checks for return values from methods

master
Ivan Klymenchenko 4 years ago
parent cf5b6db5d3
commit 0bb5fdc72e

@ -84,7 +84,7 @@ func (smug Smug) StartSession(config Config, windows []string) error {
} }
for _, w := range config.Windows { for _, w := range config.Windows {
if (len(windows) == 0 && w.Manual == true) || (len(windows) > 0 && !Contains(windows, w.Name)) { if (len(windows) == 0 && w.Manual) || (len(windows) > 0 && !Contains(windows, w.Name)) {
continue continue
} }
@ -104,7 +104,10 @@ func (smug Smug) StartSession(config Config, windows []string) error {
paneRoot = filepath.Join(windowRoot, p.Root) paneRoot = filepath.Join(windowRoot, p.Root)
} }
smug.tmux.SplitWindow(window, p.Type, paneRoot, p.Commands) _, err = smug.tmux.SplitWindow(window, p.Type, paneRoot, p.Commands)
if err != nil {
return err
}
} }
} }

@ -101,7 +101,10 @@ func TestStartSession(t *testing.T) {
tmux := Tmux{commander} tmux := Tmux{commander}
smug := Smug{tmux, commander} smug := Smug{tmux, commander}
smug.StartSession(params.config, params.windows) err := smug.StartSession(params.config, params.windows)
if err != nil {
t.Fatalf("error %v", err)
}
if !reflect.DeepEqual(params.commands, commander.Commands) { if !reflect.DeepEqual(params.commands, commander.Commands) {
t.Errorf("expected\n%s\ngot\n%s", strings.Join(params.commands, "\n"), strings.Join(commander.Commands, "\n")) t.Errorf("expected\n%s\ngot\n%s", strings.Join(params.commands, "\n"), strings.Join(commander.Commands, "\n"))

Loading…
Cancel
Save