import Testing @testable import Ch01Kit @Suite("模块边界") struct ModuleBoundaryTests { @Test func fileIDBeginsWithModuleName() { #expect(ModuleIdentity.kitFileID.hasPrefix("Ch01Kit/")) #expect(ModuleIdentity.moduleName == "Ch01Kit") #expect(!ModuleIdentity.kitFileID.contains("01-toolchain-and-mindset")) } /// 这条断言能编译,靠的就是 `@testable import`;普通 `import` 看不到 `internalNote`。 @Test func testableImportReachesInternalMember() { #expect(ModuleBoundary.internalNote.contains("internal")) #expect(ModuleBoundary.composedNote.contains(ModuleBoundary.publicNote)) #expect(ModuleBoundary.composedNote.contains(ModuleBoundary.internalNote)) } @Test func topicsCoverKitFiles() { #expect(Topic.allCases.count == 4) #expect( Topic.allCases.map(\.rawValue).sorted() == [ "buildConditions", "launchContext", "moduleIdentity", "toolchainInfo", ]) } }