-- readIOSBundleID --.
(t *testing.T)
| 2679 | // -- readIOSBundleID --. |
| 2680 | |
| 2681 | func TestReadIOSBundleID(t *testing.T) { |
| 2682 | t.Run("reads PRODUCT_BUNDLE_IDENTIFIER from project.pbxproj", func(t *testing.T) { |
| 2683 | dir := t.TempDir() |
| 2684 | require.NoError(t, os.MkdirAll(filepath.Join(dir, "ios", "Runner.xcodeproj"), 0755)) |
| 2685 | writeTestFile(t, dir, filepath.Join("ios", "Runner.xcodeproj", "project.pbxproj"), |
| 2686 | `PRODUCT_BUNDLE_IDENTIFIER = com.example.pbxproj;`) |
| 2687 | assert.Equal(t, "com.example.pbxproj", readIOSBundleID(dir)) |
| 2688 | }) |
| 2689 | |
| 2690 | t.Run("falls back to Info.plist when project.pbxproj missing", func(t *testing.T) { |
| 2691 | dir := t.TempDir() |
| 2692 | require.NoError(t, os.MkdirAll(filepath.Join(dir, "ios", "Runner"), 0755)) |
| 2693 | writeTestFile(t, dir, filepath.Join("ios", "Runner", "Info.plist"), |
| 2694 | `<key>CFBundleIdentifier</key> |
| 2695 | <string>com.example.plist</string>`) |
| 2696 | assert.Equal(t, "com.example.plist", readIOSBundleID(dir)) |
| 2697 | }) |
| 2698 | |
| 2699 | t.Run("Info.plist variable reference returns empty", func(t *testing.T) { |
| 2700 | dir := t.TempDir() |
| 2701 | require.NoError(t, os.MkdirAll(filepath.Join(dir, "ios", "Runner"), 0755)) |
| 2702 | writeTestFile(t, dir, filepath.Join("ios", "Runner", "Info.plist"), |
| 2703 | `<key>CFBundleIdentifier</key><string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>`) |
| 2704 | assert.Empty(t, readIOSBundleID(dir)) |
| 2705 | }) |
| 2706 | |
| 2707 | t.Run("no iOS files returns empty", func(t *testing.T) { |
| 2708 | assert.Empty(t, readIOSBundleID(t.TempDir())) |
| 2709 | }) |
| 2710 | } |
| 2711 | |
| 2712 | // -- extractPbxprojBundleID --. |
| 2713 |
nothing calls this directly
no test coverage detected