Skip to content

Commit 7bc692c

Browse files
abueideclaude
andcommitted
fix(tests): make ios-app-resolution tests cross-platform for Linux CI
Replace PlistBuddy (macOS-only) with raw XML plist in create_fake_app helper so .app directory search tests work on Linux CI. Skip ios_extract_bundle_id tests on non-macOS since the function itself requires PlistBuddy. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent e9afa46 commit 7bc692c

1 file changed

Lines changed: 26 additions & 12 deletions

File tree

plugins/tests/ios/test-app-resolution.sh

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,16 @@ create_fake_app() {
3838
app_dir="$1"
3939
bundle_id="${2:-com.test.app}"
4040
mkdir -p "$app_dir"
41-
/usr/libexec/PlistBuddy -c "Add :CFBundleIdentifier string $bundle_id" "$app_dir/Info.plist" 2>/dev/null || true
41+
cat > "$app_dir/Info.plist" <<PLIST
42+
<?xml version="1.0" encoding="UTF-8"?>
43+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
44+
<plist version="1.0">
45+
<dict>
46+
<key>CFBundleIdentifier</key>
47+
<string>${bundle_id}</string>
48+
</dict>
49+
</plist>
50+
PLIST
4251
}
4352

4453
echo "========================================"
@@ -171,19 +180,24 @@ assert_contains "$error_output" "No .app bundle found" "Error should mention no
171180
assert_contains "$error_output" "IOS_APP_ARTIFACT" "Error should mention env var"
172181

173182
# ============================================================================
174-
# Tests: ios_extract_bundle_id
183+
# Tests: ios_extract_bundle_id (macOS only - uses PlistBuddy)
175184
# ============================================================================
176185

177-
start_test "ios_extract_bundle_id - extracts from Info.plist"
178-
test_root="$TMPDIR_BASE/test_bundle"
179-
create_fake_app "$test_root/MyApp.app" "com.example.myapp"
180-
result=$(ios_extract_bundle_id "$test_root/MyApp.app" 2>/dev/null)
181-
assert_equal "com.example.myapp" "$result" "Should extract correct bundle ID"
182-
183-
start_test "ios_extract_bundle_id - fails on missing Info.plist"
184-
test_root="$TMPDIR_BASE/test_bundle_missing"
185-
mkdir -p "$test_root/NoInfo.app"
186-
assert_failure "ios_extract_bundle_id '$test_root/NoInfo.app'" "Should fail without Info.plist"
186+
if [ -x /usr/libexec/PlistBuddy ]; then
187+
start_test "ios_extract_bundle_id - extracts from Info.plist"
188+
test_root="$TMPDIR_BASE/test_bundle"
189+
create_fake_app "$test_root/MyApp.app" "com.example.myapp"
190+
result=$(ios_extract_bundle_id "$test_root/MyApp.app" 2>/dev/null)
191+
assert_equal "com.example.myapp" "$result" "Should extract correct bundle ID"
192+
193+
start_test "ios_extract_bundle_id - fails on missing Info.plist"
194+
test_root="$TMPDIR_BASE/test_bundle_missing"
195+
mkdir -p "$test_root/NoInfo.app"
196+
assert_failure "ios_extract_bundle_id '$test_root/NoInfo.app'" "Should fail without Info.plist"
197+
else
198+
echo ""
199+
echo "SKIP: ios_extract_bundle_id tests (PlistBuddy not available on this platform)"
200+
fi
187201

188202
# ============================================================================
189203
# Tests: ios_resolve_app_glob

0 commit comments

Comments
 (0)