-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Expand file tree
/
Copy pathfish_test.go
More file actions
40 lines (34 loc) · 1.03 KB
/
Copy pathfish_test.go
File metadata and controls
40 lines (34 loc) · 1.03 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package shell
import (
"fmt"
"testing"
"github.com/stretchr/testify/assert"
)
func TestFishFeatures(t *testing.T) {
got := allFeatures.Lines(FISH).String("// these are the features")
want := `// these are the features
enable_poshtooltips
set --global _omp_transient_prompt 1
set --global _omp_ftcs_marks 1
"$_omp_executable" upgrade --auto
"$_omp_executable" notice
set --global _omp_prompt_mark 1
set --global _omp_cursor_positioning 1
if not set -q POSH_DISABLE_STREAMING; set --global _omp_enable_streaming 1; end
_omp_enable_vimode
set --global _omp_transient_rprompt 1`
assert.Equal(t, want, got)
}
func TestQuoteFishStr(t *testing.T) {
tests := []struct {
str string
expected string
}{
{str: "", expected: "''"},
{str: `/tmp/"omp's dir"/oh-my-posh`, expected: `'/tmp/"omp\'s dir"/oh-my-posh'`},
{str: `C:/tmp\omp's dir/oh-my-posh.exe`, expected: `'C:/tmp\\omp\'s dir/oh-my-posh.exe'`},
}
for _, tc := range tests {
assert.Equal(t, tc.expected, quoteFishStr(tc.str), fmt.Sprintf("quoteFishStr: %s", tc.str))
}
}