mirror of
https://github.com/jimeh/tmux-themepack.git
synced 2026-02-19 11:16:43 +00:00
feat(overrides): Add additional prefix/suffix support
Allows a higher-level prefixes and suffixes by allowing it directly on `@theme-*` options, which are what are set directly against Tmux's options. These are the prefix/suffix options added: - `@theme-status-left-prefix` - `@theme-status-left-suffix` - `@theme-status-right-prefix` - `@theme-status-right-suffix` - `@theme-window-status-current-prefix` - `@theme-window-status-current-suffix` - `@theme-window-status-prefix` - `@theme-window-status-suffix` As they are applied on the highest level, it means they work on ALL themes, including the `default` theme. The `@themepack-*` prefix/suffix options still work too, but only for themes that uses them and have three separate text areas on the left and right status.
This commit is contained in:
60
test/setup.go
Normal file
60
test/setup.go
Normal file
@@ -0,0 +1,60 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/jimeh/go-tmux"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
var tm = tmux.New()
|
||||
var tmuxVersion = os.Getenv("TMUX_VERSION")
|
||||
var tmuxBinPath = os.Getenv("TMUX_BIN_PATH")
|
||||
var tmuxConfig = os.Getenv("TMUX_CONFIG")
|
||||
|
||||
func tmuxSetup() {
|
||||
if tmuxBinPath != "" {
|
||||
tm.BinPath = tmuxBinPath
|
||||
}
|
||||
tm.SocketPath = "./tmux-test-socket"
|
||||
|
||||
if tmuxConfig != "" {
|
||||
tmuxConfig = "./tmux.conf"
|
||||
}
|
||||
|
||||
_, err := tm.Exec("-f", tmuxConfig, "new-session", "-d", "sleep", "30")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func tmuxTearDown() {
|
||||
_, err := tm.Exec("kill-server")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
if tm.SocketPath != "" {
|
||||
err = os.Remove(tm.SocketPath)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func tmuxHasOptions(t *testing.T, theme string, s tmux.Scope, m tmux.Options) {
|
||||
opts, err := tm.GetOptions(s)
|
||||
assert.NoErrorf(t, err, `%s: Failed to get options`, theme)
|
||||
|
||||
if err == nil {
|
||||
for k, v := range m {
|
||||
_, ok := opts[k]
|
||||
assert.Truef(t, ok, `Key "%s" is not available in %s`, k, theme)
|
||||
if ok {
|
||||
assert.Equalf(t, v, opts[k], `Key "%s" in "%s"`, k, theme)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user