feat(test): Add unit tests for all themes

Use Tmux itself by spinning up a temporary test server, load the theme,
and use "show-options" to pull out and validate relevant options that
are set by the theme.
This commit is contained in:
2019-11-29 02:47:36 +00:00
parent cae4b67003
commit 6e2e24e0f2
10 changed files with 499 additions and 0 deletions

47
test/basic_test.go Normal file
View File

@@ -0,0 +1,47 @@
package test
import (
"testing"
"github.com/jimeh/go-tmux"
"github.com/stretchr/testify/assert"
)
func TestBasicTheme(t *testing.T) {
tmuxSetup()
defer tmuxTearDown()
theme := "../basic.tmuxtheme"
_, err := tm.Exec("source-file", theme)
assert.NoErrorf(t, err, `%s: Failed to load theme`, theme)
tmuxHasOptions(t, theme, tmux.GlobalWindow, tmux.Options{
"clock-mode-colour": "red",
"clock-mode-style": "24",
"mode-style": "bg=red",
"pane-active-border-style": "fg=green",
"pane-border-style": "default",
"window-status-activity-style": "fg=yellow,bg=black",
"window-status-current-format": " #I:#W#F ",
"window-status-current-style": "fg=black,bg=red",
"window-status-format": " #I:#W#F ",
"window-status-separator": "",
})
tmuxHasOptions(t, theme, tmux.GlobalSession, tmux.Options{
"display-panes-active-colour": "default",
"display-panes-colour": "default",
"message-command-style": "default",
"message-style": "default",
"status-interval": "1",
"status-justify": "centre",
"status-left": "#S #[fg=white]» #[fg=yellow]#I #[fg=cyan]#P",
"status-left-length": "40",
"status-left-style": "fg=green,bg=black",
"status-right": "#H #[fg=white]« #[fg=yellow]%H:%M:%S #[fg=green]%d-%b-%y",
"status-right-length": "40",
"status-right-style": "fg=cyan,bg=black",
"status-style": "fg=cyan,bg=black",
})
}