-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmain_test.go
More file actions
31 lines (23 loc) · 869 Bytes
/
main_test.go
File metadata and controls
31 lines (23 loc) · 869 Bytes
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
package main
import "testing"
func TestShouldCheckForUpdatesDisabledByEnv(t *testing.T) {
t.Setenv("OPENCORE_DISABLE_UPDATE_CHECK", "1")
if shouldCheckForUpdates([]string{"opencore", "build"}) {
t.Fatalf("expected update check to be disabled by env")
}
}
func TestShouldCheckForUpdatesSkipsVersionAndUpdate(t *testing.T) {
t.Setenv("OPENCORE_DISABLE_UPDATE_CHECK", "")
if shouldCheckForUpdates([]string{"opencore", "update"}) {
t.Fatalf("expected update command to skip update checks")
}
if shouldCheckForUpdates([]string{"opencore", "--version"}) {
t.Fatalf("expected --version command to skip update checks")
}
}
func TestShouldCheckForUpdatesSkipsShortVersionFlag(t *testing.T) {
t.Setenv("OPENCORE_DISABLE_UPDATE_CHECK", "")
if shouldCheckForUpdates([]string{"opencore", "-v"}) {
t.Fatalf("expected -v command to skip update checks")
}
}