tmux_test.go
This file
Path
src/tmux_test.go
53 lines · 1.2 KiB · Go
Last changed by
Escape trailing semicolon in tmux command argumentJunegunn Choibefore adoption5763168
History of this fileTake it
Set --border-label as the title of the tmux floating pane (#4853)Junegunn Choibefore adoption77e6394
lines 1–4why, one step back1package fzf23import "testing"4Separate floating pane border label from pane titleJunegunn Choibefore adoption50e6c02
line 5why, one step back5func TestEscapeTmuxFormat(t *testing.T) {Set --border-label as the title of the tmux floating pane (#4853)Junegunn Choibefore adoption77e6394
lines 6–12why, one step back6 for _, tc := range []struct {7 given string8 expected string9 }{10 {"", ""},11 {" fzf ", " fzf "},12 {"100%", "100%"},Separate floating pane border label from pane titleJunegunn Choibefore adoption50e6c02
lines 13–18why, one step back13 // '#[' would be taken as a style directive when the label is drawn14 {"#[fg=red]x", "##[fg=red]x"},15 // '#{' is already literal in a substituted value, but doubling it16 // keeps a label that fzf renders itself looking the same17 {"#{pane_id}", "##{pane_id}"},18 {" C# notes #S ", " C## notes ##S "},Set --border-label as the title of the tmux floating pane (#4853)Junegunn Choibefore adoption77e6394
lines 19–20why, one step back19 {";", `\;`},20 {"; rm", "; rm"},Escape trailing semicolon in tmux command argumentJunegunn Choibefore adoption5763168
line 21why, one step back21 {"C#;", `C##\;`},Set --border-label as the title of the tmux floating pane (#4853)Junegunn Choibefore adoption77e6394
line 22why, one step back22 } {Separate floating pane border label from pane titleJunegunn Choibefore adoption50e6c02
line 23why, one step back23 if actual := escapeTmuxFormat(tc.given); actual != tc.expected {Set --border-label as the title of the tmux floating pane (#4853)Junegunn Choibefore adoption77e6394
lines 24–28why, one step back24 t.Errorf("expected %q, got %q", tc.expected, actual)25 }26 }27}28Separate floating pane border label from pane titleJunegunn Choibefore adoption50e6c02
line 29why, one step back29func TestEscapeTmuxSeparator(t *testing.T) {Set --border-label as the title of the tmux floating pane (#4853)Junegunn Choibefore adoption77e6394
lines 30–33why, one step back30 for _, tc := range []struct {31 given string32 expected string33 }{Separate floating pane border label from pane titleJunegunn Choibefore adoption50e6c02
lines 34–38why, one step back34 {"", ""},35 {" fzf ", " fzf "},36 {"#", "#"},37 {"#{pane_id}", "#{pane_id}"},38 {"100%", "100%"},Escape trailing semicolon in tmux command argumentJunegunn Choibefore adoption5763168
lines 39–40why, one step back39 // tmux drops a trailing ';' and everything after it, so only that40 // one is escapedSeparate floating pane border label from pane titleJunegunn Choibefore adoption50e6c02
line 41why, one step back41 {";", `\;`},Escape trailing semicolon in tmux command argumentJunegunn Choibefore adoption5763168
lines 42–44why, one step back42 {"abc;", `abc\;`},43 {";;", `;\;`},44 {`foo\;`, `foo\\;`},Separate floating pane border label from pane titleJunegunn Choibefore adoption50e6c02
lines 45–46why, one step back45 {"; rm", "; rm"},46 {" ; ", " ; "},Escape trailing semicolon in tmux command argumentJunegunn Choibefore adoption5763168
line 47why, one step back47 {"a;b", "a;b"},Set --border-label as the title of the tmux floating pane (#4853)Junegunn Choibefore adoption77e6394
line 48why, one step back48 } {Separate floating pane border label from pane titleJunegunn Choibefore adoption50e6c02
line 49why, one step back49 if actual := escapeTmuxSeparator(tc.given); actual != tc.expected {Set --border-label as the title of the tmux floating pane (#4853)Junegunn Choibefore adoption77e6394
lines 50–53why, one step back50 t.Errorf("expected %q, got %q", tc.expected, actual)51 }52 }53}