Skip to content

Commit f800969

Browse files
pmoprhywatkyn
andauthored
Swift testing conversion (#145)
* started on a claude.md and converting a couple tests * added plan * phase 3 done * phase 4 * phase 5 * phase 6 * phase 7 * swift format --------- Co-authored-by: Tony Eichelberger <tony.eichelberger@jamf.com>
1 parent e0862fe commit f800969

11 files changed

Lines changed: 470 additions & 420 deletions

File tree

CLAUDE.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# PPPC Utility
2+
3+
## Swift Concurrency
4+
5+
- `SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor` is set on both app and test targets — don't add explicit `@MainActor` to production code or test structs/functions, it's already the default
6+
7+
## Swift Testing Migration
8+
9+
- Place `@Test` and `@Suite` annotations on the line **above** the declaration, not inline
10+
- Use `// when` and `// then` comment blocks; skip `// given` (assumed from context)
11+
- When XCTest assertions have message strings, preserve them as `#expect` messages, not code comments (e.g. `#expect(x == false, "reason")`)
12+
- Avoid `#require` on `Bool?` — it's ambiguous; use `#expect(x == true)` instead
13+
- Capture a baseline of compiler warnings before each phase, then verify no new warnings after. Use this command and compare the output before/after:
14+
```
15+
xcodebuild clean build-for-testing -project "PPPC Utility.xcodeproj" -scheme "PPPC Utility" -destination "platform=macOS" 2>&1 | grep -i "warning:" | grep -v "xcodebuild: WARNING"
16+
```
17+
- Use parameterized tests with Traits where it reduces duplication; 1–2 args is ideal, max 3
18+
- Beyond 3 params: create separate tests with some values hard-coded

PPPC Utility.xcodeproj/project.pbxproj

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -547,9 +547,10 @@
547547
BUNDLE_LOADER = "$(TEST_HOST)";
548548
CLANG_ENABLE_MODULES = YES;
549549
CODE_SIGN_IDENTITY = "Apple Development";
550-
CODE_SIGN_STYLE = Automatic;
550+
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
551+
CODE_SIGN_STYLE = Manual;
551552
COMBINE_HIDPI_IMAGES = YES;
552-
DEVELOPMENT_TEAM = XPLDEEDNHE;
553+
DEVELOPMENT_TEAM = "";
553554
INFOPLIST_FILE = "PPPC UtilityTests/Info.plist";
554555
LD_RUNPATH_SEARCH_PATHS = (
555556
"$(inherited)",
@@ -571,9 +572,10 @@
571572
BUNDLE_LOADER = "$(TEST_HOST)";
572573
CLANG_ENABLE_MODULES = YES;
573574
CODE_SIGN_IDENTITY = "Apple Development";
574-
CODE_SIGN_STYLE = Automatic;
575+
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
576+
CODE_SIGN_STYLE = Manual;
575577
COMBINE_HIDPI_IMAGES = YES;
576-
DEVELOPMENT_TEAM = XPLDEEDNHE;
578+
DEVELOPMENT_TEAM = "";
577579
INFOPLIST_FILE = "PPPC UtilityTests/Info.plist";
578580
LD_RUNPATH_SEARCH_PATHS = (
579581
"$(inherited)",
@@ -711,9 +713,10 @@
711713
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
712714
CODE_SIGN_ENTITLEMENTS = "Resources/PPPC Utility.entitlements";
713715
CODE_SIGN_IDENTITY = "Apple Development";
714-
CODE_SIGN_STYLE = Automatic;
716+
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
717+
CODE_SIGN_STYLE = Manual;
715718
COMBINE_HIDPI_IMAGES = YES;
716-
DEVELOPMENT_TEAM = XPLDEEDNHE;
719+
DEVELOPMENT_TEAM = "";
717720
ENABLE_HARDENED_RUNTIME = NO;
718721
INFOPLIST_FILE = Resources/Info.plist;
719722
LD_RUNPATH_SEARCH_PATHS = (
@@ -734,9 +737,10 @@
734737
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
735738
CODE_SIGN_ENTITLEMENTS = "Resources/PPPC Utility.entitlements";
736739
CODE_SIGN_IDENTITY = "Apple Development";
737-
CODE_SIGN_STYLE = Automatic;
740+
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
741+
CODE_SIGN_STYLE = Manual;
738742
COMBINE_HIDPI_IMAGES = YES;
739-
DEVELOPMENT_TEAM = XPLDEEDNHE;
743+
DEVELOPMENT_TEAM = "";
740744
ENABLE_HARDENED_RUNTIME = YES;
741745
INFOPLIST_FILE = Resources/Info.plist;
742746
LD_RUNPATH_SEARCH_PATHS = (

0 commit comments

Comments
 (0)