feat(m0): complete scaffold, logging and signature checks (T0.2-T0.6)
Add os.Logger categories, OSSignposter wrapper and shortHash helper; enforce exact Debug/Release/install signatures; lint tests; update M0 docs and progress.
This commit is contained in:
1 parent
374085ec2f
commit
7ca5c710ec
17 files changed
+331
-9
No files matched your search
@@ -0,0 +1,54 @@
|
||||
import os
|
||||
import Testing
|
||||
@testable import SprachmittlerCore
|
||||
|
||||
/// T0.4: the logging helper must stay in sync with ARCHITECTURE §15.
|
||||
@Suite("Logging contract")
|
||||
struct LoggingContractTests {
|
||||
@Test func categoriesMatchArchitecture() {
|
||||
#expect(LogCategory.allCases.map(\.rawValue) == [
|
||||
"capture",
|
||||
"pasteboard",
|
||||
"session",
|
||||
"ollama",
|
||||
"engine",
|
||||
"validate",
|
||||
"insert",
|
||||
"panel",
|
||||
"settings",
|
||||
])
|
||||
}
|
||||
|
||||
@Test func signpostNamesMatchArchitecture() {
|
||||
#expect(SignpostName.allCases.map(\.rawValue) == [
|
||||
"capture",
|
||||
"panel",
|
||||
"request",
|
||||
"firstToken",
|
||||
"translate",
|
||||
"validate",
|
||||
"copy",
|
||||
"insert",
|
||||
])
|
||||
}
|
||||
|
||||
/// `OSSignposter.beginInterval` needs a `StaticString`; this catches a hand-written switch drift.
|
||||
@Test func signpostLiteralsMatchRawValues() {
|
||||
for name in SignpostName.allCases {
|
||||
#expect(String(describing: name.literal) == name.rawValue)
|
||||
}
|
||||
}
|
||||
|
||||
@Test func loggersWorkForEveryCategory() {
|
||||
let loggers = Loggers(subsystem: "test.sprachmittler")
|
||||
for category in LogCategory.allCases {
|
||||
loggers.logger(category).debug("logging contract test")
|
||||
|
||||
let signposts = loggers.signposts(category)
|
||||
let interval = signposts.begin(.capture)
|
||||
#expect(interval.name.rawValue == "capture")
|
||||
signposts.end(interval)
|
||||
signposts.event(.panel)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user