diff options
author | Julien Dessaux | 2021-01-13 15:38:19 +0100 |
---|---|---|
committer | Julien Dessaux | 2021-01-13 15:38:19 +0100 |
commit | 19e747f1669d8ae64619686569929a59d5722b8c (patch) | |
tree | 370b8742f7563e1b750f5ad494e654a7fcc24838 /config/app_test.go | |
parent | Properly test the minimal config contents (diff) | |
download | shell-game-launcher-19e747f1669d8ae64619686569929a59d5722b8c.tar.gz shell-game-launcher-19e747f1669d8ae64619686569929a59d5722b8c.tar.bz2 shell-game-launcher-19e747f1669d8ae64619686569929a59d5722b8c.zip |
Finished implementing config tests
Diffstat (limited to 'config/app_test.go')
-rw-r--r-- | config/app_test.go | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/config/app_test.go b/config/app_test.go index cda891d..5a6cf41 100644 --- a/config/app_test.go +++ b/config/app_test.go @@ -55,9 +55,7 @@ func TestAppvalidate(t *testing.T) { t.Fatal("Negative or zero MenuMaxIdleTime should not be valid.") } - //PostLoginCommands is tested from command.go - - // A valid App + //PostLoginCommands are mostly tested from command_test.go app = App{ WorkingDirectory: "var/", MaxUsers: 512, @@ -65,6 +63,28 @@ func TestAppvalidate(t *testing.T) { MenuMaxIdleTime: 60, } if err := app.validate(); err != nil { + t.Fatal("Empty PostLoginCommands list should be valid") + } + app = App{ + WorkingDirectory: "var/", + MaxUsers: 512, + MaxNickLen: 15, + MenuMaxIdleTime: 60, + PostLoginCommands: []string{"invalid"}, + } + if err := app.validate(); err == nil { + t.Fatal("Invalid command in PostLoginCommands should not be valid") + } + + // A valid App + app = App{ + WorkingDirectory: "var/", + MaxUsers: 512, + MaxNickLen: 15, + MenuMaxIdleTime: 60, + PostLoginCommands: []string{"wait"}, + } + if err := app.validate(); err != nil { t.Fatal("A valid app should pass") } } |