@@ -30,6 +30,25 @@ func TestSyncMacOSBundleVersionScript(t *testing.T) {
3030 }
3131 })
3232
33+ t .Run ("syncs binary plist bundle metadata" , func (t * testing.T ) {
34+ appPath := createTempAppBundle (t )
35+ convertPlistToBinary (t , filepath .Join (appPath , "Contents" , "Info.plist" ))
36+
37+ cmd := exec .Command ("bash" , "scripts/sync-macos-bundle-version.sh" , appPath , "v0.1.11" )
38+ output , err := cmd .CombinedOutput ()
39+ if err != nil {
40+ t .Fatalf ("sync-macos-bundle-version.sh error = %v, output = %s" , err , output )
41+ }
42+
43+ plist := readPlistAsJSON (t , filepath .Join (appPath , "Contents" , "Info.plist" ))
44+ if got := plist ["CFBundleShortVersionString" ]; got != "0.1.11" {
45+ t .Fatalf ("CFBundleShortVersionString = %#v, want %q" , got , "0.1.11" )
46+ }
47+ if got := plist ["CFBundleVersion" ]; got != "0.1.11" {
48+ t .Fatalf ("CFBundleVersion = %#v, want %q" , got , "0.1.11" )
49+ }
50+ })
51+
3352 t .Run ("rejects non release version" , func (t * testing.T ) {
3453 appPath := createTempAppBundle (t )
3554
@@ -91,3 +110,13 @@ func readPlistAsJSON(t *testing.T, plistPath string) map[string]any {
91110
92111 return data
93112}
113+
114+ func convertPlistToBinary (t * testing.T , plistPath string ) {
115+ t .Helper ()
116+
117+ cmd := exec .Command ("plutil" , "-convert" , "binary1" , plistPath )
118+ output , err := cmd .CombinedOutput ()
119+ if err != nil {
120+ t .Fatalf ("plutil binary convert error = %v, output = %s" , err , output )
121+ }
122+ }
0 commit comments