forked from JanDeDobbeleer/oh-my-posh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsegment_os_test.go
44 lines (40 loc) · 886 Bytes
/
segment_os_test.go
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
41
42
43
44
package main
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestOsInfo(t *testing.T) {
env := new(MockedEnvironment)
env.On("getRuntimeGOOS", nil).Return("windows")
props := &properties{
values: map[Property]interface{}{Windows: "win"},
foreground: "#fff",
background: "#000",
}
osInfo := &osInfo{
env: env,
props: props,
}
want := "win"
got := osInfo.string()
assert.Equal(t, want, got)
}
func TestWSL(t *testing.T) {
env := new(MockedEnvironment)
env.On("getRuntimeGOOS", nil).Return("linux")
env.On("getenv", "WSL_DISTRO_NAME").Return("debian")
env.On("getPlatform", nil).Return("debian")
props := &properties{
values: map[Property]interface{}{
WSL: "WSL TEST",
WSLSeparator: " @ ",
},
}
osInfo := &osInfo{
env: env,
props: props,
}
want := "WSL TEST @ \uF306"
got := osInfo.string()
assert.Equal(t, want, got)
}