forked from fyne-io/apps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app_test.go
44 lines (35 loc) · 919 Bytes
/
app_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 (
"runtime"
"testing"
"github.com/stretchr/testify/assert"
)
func TestApp_FilterCompatible(t *testing.T) {
l := AppList{
App{Requires: runtime.GOOS},
App{Requires: runtime.GOOS + ",powerpc"},
App{Requires: "powerpc"},
App{},
}
assert.Equal(t, 4, len(l))
assert.Equal(t, 3, len(l.filterCompatible()))
}
func TestApp_IsCompatible(t *testing.T) {
a := &App{Requires: "linux"}
if runtime.GOOS == "linux" {
assert.True(t, a.isCompatible())
} else {
assert.False(t, a.isCompatible())
}
a.Requires = runtime.GOOS
assert.True(t, a.isCompatible())
}
func TestApp_IsCompatibleWithOS(t *testing.T) {
a := &App{Requires: "darwin"}
assert.True(t, a.isCompatibleWithOS("darwin"))
assert.False(t, a.isCompatibleWithOS("powerpc"))
a.Requires = "linux,powerpc"
assert.True(t, a.isCompatibleWithOS("powerpc"))
a.Requires = ""
assert.True(t, a.isCompatibleWithOS("powerpc"))
}