1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package main
import (
"strings"
"testing"
)
// -app is a run mode of its own: it cannot be combined with another mode
// or command, nor with -plain. The check runs before the data folder is
// touched.
func TestAppModeIsExclusive(t *testing.T) {
for name, opts := range map[string]commandOptions{
"tray": {app: true, tray: true},
"status": {app: true, status: true},
"list": {app: true, listAccounts: true},
} {
err := runCommand(opts)
if err == nil || !strings.Contains(err.Error(), "-app") {
t.Errorf("%s: got %v, want the exclusive-mode error", name, err)
}
}
if err := runCommand(commandOptions{app: true, plain: true}); err == nil || !strings.Contains(err.Error(), "-plain") {
t.Errorf("-app -plain: got %v", err)
}
}