-- extractPbxprojBundleID --.
(t *testing.T)
| 2712 | // -- extractPbxprojBundleID --. |
| 2713 | |
| 2714 | func TestExtractPbxprojBundleID(t *testing.T) { |
| 2715 | tests := []struct { |
| 2716 | name string |
| 2717 | content string |
| 2718 | want string |
| 2719 | }{ |
| 2720 | { |
| 2721 | name: "single app target returns it", |
| 2722 | content: `PRODUCT_BUNDLE_IDENTIFIER = com.example.app;`, |
| 2723 | want: "com.example.app", |
| 2724 | }, |
| 2725 | { |
| 2726 | name: "test target appears first - skipped, app target returned", |
| 2727 | content: `PRODUCT_BUNDLE_IDENTIFIER = com.example.app.RunnerTests; |
| 2728 | PRODUCT_BUNDLE_IDENTIFIER = com.example.app;`, |
| 2729 | want: "com.example.app", |
| 2730 | }, |
| 2731 | { |
| 2732 | name: ".Tests suffix skipped", |
| 2733 | content: `PRODUCT_BUNDLE_IDENTIFIER = com.example.app.Tests; |
| 2734 | PRODUCT_BUNDLE_IDENTIFIER = com.example.app;`, |
| 2735 | want: "com.example.app", |
| 2736 | }, |
| 2737 | { |
| 2738 | name: ".UITests suffix skipped", |
| 2739 | content: `PRODUCT_BUNDLE_IDENTIFIER = com.example.app.UITests; |
| 2740 | PRODUCT_BUNDLE_IDENTIFIER = com.example.app;`, |
| 2741 | want: "com.example.app", |
| 2742 | }, |
| 2743 | { |
| 2744 | name: "no match returns empty", |
| 2745 | content: `OTHER_KEY = some.value;`, |
| 2746 | want: "", |
| 2747 | }, |
| 2748 | { |
| 2749 | name: "all test targets - returns empty", |
| 2750 | content: `PRODUCT_BUNDLE_IDENTIFIER = com.example.app.RunnerTests; |
| 2751 | PRODUCT_BUNDLE_IDENTIFIER = com.example.app.UITests;`, |
| 2752 | want: "", |
| 2753 | }, |
| 2754 | { |
| 2755 | // Com.example.appTests (no dot) previously passed the filter. |
| 2756 | name: "no-dot Tests suffix skipped", |
| 2757 | content: `PRODUCT_BUNDLE_IDENTIFIER = com.example.appTests; |
| 2758 | PRODUCT_BUNDLE_IDENTIFIER = com.example.app;`, |
| 2759 | want: "com.example.app", |
| 2760 | }, |
| 2761 | { |
| 2762 | name: "no-dot UITests suffix skipped", |
| 2763 | content: `PRODUCT_BUNDLE_IDENTIFIER = com.example.appUITests; |
| 2764 | PRODUCT_BUNDLE_IDENTIFIER = com.example.app;`, |
| 2765 | want: "com.example.app", |
| 2766 | }, |
| 2767 | } |
| 2768 | for _, tc := range tests { |
| 2769 | tc := tc |
| 2770 | t.Run(tc.name, func(t *testing.T) { |
| 2771 | assert.Equal(t, tc.want, extractPbxprojBundleID(tc.content)) |
nothing calls this directly
no test coverage detected