统一原生壳静态断言格式兼容

所有源码片段断言统一兼容格式化拆行

保留严格语义匹配并归一化空白与标点
This commit is contained in:
2026-09-01 19:19:00 +08:00
parent b14e42d9bb
commit 3e8e238286
+19 -17
View File
@@ -177,7 +177,7 @@ function assertNativeShellDependencyVersionGuardrails() {
"'eas-cli': '^20.3.0'",
"assertPackageLockVersion('apps/mobile-shell', 'eas-cli', '20.3.0')",
]) {
if (!mobileShellConfigCheckSource.includes(snippet)) {
if (!sourceIncludesSnippet(mobileShellConfigCheckSource, snippet)) {
throw new Error(
`mobile shell dependency guardrail drifted: missing ${snippet}`,
);
@@ -201,7 +201,7 @@ function assertNativeShellDependencyVersionGuardrails() {
"['tauri', '2.11.2']",
'tauri-plugin-single-instance = { version = "2.4.2", features = ["deep-link"] }',
]) {
if (!desktopShellConfigCheckSource.includes(snippet)) {
if (!sourceIncludesSnippet(desktopShellConfigCheckSource, snippet)) {
throw new Error(
`desktop shell dependency guardrail drifted: missing ${snippet}`,
);
@@ -2440,7 +2440,7 @@ function assertAiGameCreatorShellUserDevBoundary() {
'if (!import.meta.env.DEV)',
"return params.has('dev') || window.location.hash === '#dev';",
]) {
if (!aiGameCreatorShellAppModelSource.includes(snippet)) {
if (!sourceIncludesSnippet(aiGameCreatorShellAppModelSource, snippet)) {
throw new Error(
`AI game creator developer mode boundary drifted: missing ${snippet}`,
);
@@ -2451,7 +2451,7 @@ function assertAiGameCreatorShellUserDevBoundary() {
'{devMode ? (',
'className="developer-pane"',
]) {
if (!aiGameCreatorShellAppSource.includes(snippet)) {
if (!sourceIncludesSnippet(aiGameCreatorShellAppSource, snippet)) {
throw new Error(
`AI game creator user/dev UI boundary drifted: missing ${snippet}`,
);
@@ -2525,7 +2525,9 @@ function assertAiGameCreatorShellUserDevBoundary() {
'sandbox="allow-scripts allow-same-origin allow-forms allow-pointer-lock"',
'src={embeddedUrl}',
]) {
if (!aiGameCreatorLocalGamePreviewFrameSource.includes(snippet)) {
if (
!sourceIncludesSnippet(aiGameCreatorLocalGamePreviewFrameSource, snippet)
) {
throw new Error(
`AI game creator embedded preview boundary drifted: missing ${snippet}`,
);
@@ -2535,7 +2537,7 @@ function assertAiGameCreatorShellUserDevBoundary() {
"await invoke<LocalPreviewStatus>(\n 'activate_local_game_preview'",
'已切换到客户端运行视图',
]) {
if (!aiGameCreatorShellAppSource.includes(snippet)) {
if (!sourceIncludesSnippet(aiGameCreatorShellAppSource, snippet)) {
throw new Error(
`AI game creator client preview activation drifted: missing ${snippet}`,
);
@@ -2545,7 +2547,7 @@ function assertAiGameCreatorShellUserDevBoundary() {
'fn activate_local_game_preview(',
'preview_open_url(&status)?;',
]) {
if (!aiGameCreatorPreviewRustSource.includes(snippet)) {
if (!sourceIncludesSnippet(aiGameCreatorPreviewRustSource, snippet)) {
throw new Error(
`AI game creator client preview command drifted: missing ${snippet}`,
);
@@ -2576,7 +2578,7 @@ function assertAiGameCreatorShellUserDevBoundary() {
'项目总控对话窗口仅在开发构建中可用',
'index.html?supervisor-chat&projectPath=',
]) {
if (!aiGameCreatorShellTauriSource.includes(snippet)) {
if (!sourceIncludesSnippet(aiGameCreatorShellTauriSource, snippet)) {
throw new Error(
`AI game creator supervisor chat window must stay developer-only: ${snippet}`,
);
@@ -3281,7 +3283,7 @@ function assertH5HostBridgePayloadBoundaries() {
"rejects.not.toThrow(\n 'private native detail',",
'expect(consoleError.mock.calls.flat()).not.toContain(navigationError)',
]) {
if (!h5HostBridgeTestSource.includes(snippet)) {
if (!sourceIncludesSnippet(h5HostBridgeTestSource, snippet)) {
throw new Error(
`H5 HostBridge navigation failure test must include ${snippet}`,
);
@@ -3556,7 +3558,7 @@ function assertH5NativeAppMessageSourceBoundaries() {
'if (!isNativeInjectedMessageEvent(event))',
];
for (const snippet of requiredSourceSnippets) {
if (!nativeAppHostBridgeSource.includes(snippet)) {
if (!sourceIncludesSnippet(nativeAppHostBridgeSource, snippet)) {
throw new Error(
`H5 native app transport must verify injected message source and origin: ${snippet}`,
);
@@ -3571,7 +3573,7 @@ function assertH5NativeAppMessageSourceBoundaries() {
'expect(listener).not.toHaveBeenCalled();',
];
for (const snippet of requiredTestSnippets) {
if (!nativeAppHostBridgeTestSource.includes(snippet)) {
if (!sourceIncludesSnippet(nativeAppHostBridgeTestSource, snippet)) {
throw new Error(
`H5 native app transport source boundary test must include ${snippet}`,
);
@@ -3844,7 +3846,7 @@ function assertNativeShellCapabilityPlan() {
'let response = resolve_host_bridge_request(request(method));',
'assert_eq!(error.code, "unsupported_method");',
]) {
if (!desktopDispatchSource.includes(snippet)) {
if (!sourceIncludesSnippet(desktopDispatchSource, snippet)) {
throw new Error(
'desktop dispatch test must derive unsupported methods from Rust capability list',
);
@@ -4421,7 +4423,7 @@ function assertWechatPaymentResultBoundaries() {
"logWechatPayFailure('requestVirtualPayment unavailable')",
"logWechatPayFailure('requestVirtualPayment failed', error)",
]) {
if (!paymentSource.includes(snippet)) {
if (!sourceIncludesSnippet(paymentSource, snippet)) {
throw new Error(`wechat payment bridge must include ${snippet}`);
}
}
@@ -4451,7 +4453,7 @@ function assertWechatPaymentResultBoundaries() {
"expect(console.error).toHaveBeenCalledWith(\n '[wechat-pay] requestVirtualPayment failed'",
'expect(console.error.mock.calls.flat()).not.toContain(payError)',
]) {
if (!paymentTestSource.includes(snippet)) {
if (!sourceIncludesSnippet(paymentTestSource, snippet)) {
throw new Error(`wechat payment bridge test must include ${snippet}`);
}
}
@@ -4605,7 +4607,7 @@ function assertWechatWebViewPageEventBoundaries() {
"expect(console.info).toHaveBeenCalledWith('[web-view] message')",
'expect(console.info.mock.calls.flat()).not.toContain(webViewDetail)',
]) {
if (!webViewTestSource.includes(snippet)) {
if (!sourceIncludesSnippet(webViewTestSource, snippet)) {
throw new Error(
`wechat web-view page event boundary test must include ${snippet}`,
);
@@ -4632,7 +4634,7 @@ function assertWechatShareGridFailureBoundaries() {
'reject(new Error(WECHAT_SHARE_GRID_SAVE_UNAVAILABLE_MESSAGE))',
'errorMessage: WECHAT_SHARE_GRID_SAVE_UNAVAILABLE_MESSAGE',
]) {
if (!shareGridSource.includes(snippet)) {
if (!sourceIncludesSnippet(shareGridSource, snippet)) {
throw new Error(`wechat share-grid shell must include ${snippet}`);
}
}
@@ -4659,7 +4661,7 @@ function assertWechatShareGridFailureBoundaries() {
"expect(consoleError).toHaveBeenCalledWith('[share-grid] save failed')",
"expect(consoleError.mock.calls.flat()).not.toContain('private native download detail')",
]) {
if (!shareGridTestSource.includes(snippet)) {
if (!sourceIncludesSnippet(shareGridTestSource, snippet)) {
throw new Error(
`wechat share-grid boundary test must include ${snippet}`,
);