-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathdarwin_min_version_test.go
More file actions
74 lines (58 loc) · 1.83 KB
/
Copy pathdarwin_min_version_test.go
File metadata and controls
74 lines (58 loc) · 1.83 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package test
import (
"os"
"path/filepath"
"strings"
"testing"
"howett.net/plist"
)
func TestDarwinInfoPlistMinVersion(t *testing.T) {
templates := []string{
"../../internal/commands/updatable_build_assets/darwin/Info.plist.tmpl",
"../../internal/commands/updatable_build_assets/darwin/Info.dev.plist.tmpl",
}
expectedVersion := "12.0"
for _, tmpl := range templates {
t.Run(filepath.Base(tmpl), func(t *testing.T) {
data, err := os.ReadFile(tmpl)
if err != nil {
t.Fatalf("Failed to read template: %v", err)
}
content := string(data)
if !strings.Contains(content, expectedVersion) {
t.Errorf("Template %s does not contain expected minimum version %s", tmpl, expectedVersion)
}
if strings.Contains(content, "10.15") {
t.Errorf("Template %s still contains outdated 10.15 version", tmpl)
}
var plistDict map[string]any
_, err = plist.Unmarshal(data, &plistDict)
if err == nil {
minVer, ok := plistDict["LSMinimumSystemVersion"]
if ok && minVer != expectedVersion {
t.Errorf("LSMinimumSystemVersion = %v, want %s", minVer, expectedVersion)
}
}
})
}
}
func TestDarwinTaskfileMinVersion(t *testing.T) {
taskfile := "../../internal/commands/build_assets/darwin/Taskfile.yml"
data, err := os.ReadFile(taskfile)
if err != nil {
t.Fatalf("Failed to read Taskfile: %v", err)
}
content := string(data)
if strings.Contains(content, "10.15") {
t.Errorf("Taskfile still contains outdated 10.15 version")
}
if !strings.Contains(content, "12.0") {
t.Errorf("Taskfile does not contain expected minimum version 12.0")
}
if !strings.Contains(content, "-mmacosx-version-min=12.0") {
t.Errorf("Taskfile CGO flags not updated to 12.0")
}
if !strings.Contains(content, `MACOSX_DEPLOYMENT_TARGET: "12.0"`) {
t.Errorf("Taskfile MACOSX_DEPLOYMENT_TARGET not updated to 12.0")
}
}