test(设备闸): 补第二份真样本(单 mission,我们不在列表里)+ 把"状态对调"那条从弱断言改成**严格正例**(pi §4②)
- 新样本 `fixtures/aa-dump-l-single-theirs.txt`:由真样本删掉我们那块得到,形状与 pi 12:03 的活 dump 一致 (单 mission、`state #FOREGROUND` 是对方)⇒ 正确判决 **`other`**,不是 `unverified` —— 否则会把"别人占着前台"和"没读到"混成一种; - `#FOREGROUND` 全删 ⇒ `unverified`(缺证据不猜); - ★ 原"状态对调"那条我原先只断言 `ours || unverified`(当时心虚写宽的)。pi 指出: **只判"读不出来就不许过"是不够的,还得有正例证明"读出来了真的能过"** —— 否则这道闸的失效方式是 "永远说未验"(更安静的失效,而且欠账永远还不完)。已改成严格断言 `ours` + `mayAssertOn === true`。 - 登记 5→7(我一度写成 8:我只加了 2 条,5+2=7 —— 相等契约下这种手误会被套件当场抓住,这正是它该干的事)。
This commit is contained in:
14
client/electron/test/fixtures/aa-dump-l-single-theirs.txt
vendored
Normal file
14
client/electron/test/fixtures/aa-dump-l-single-theirs.txt
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
User ID #100
|
||||
current mission lists:{
|
||||
Mission ID #31 mission name #[#com.example.homeagent:entry:EntryAbility] lockedState #0 mission affinity #[]
|
||||
AbilityRecord ID #31
|
||||
app name [com.example.homeagent]
|
||||
main name [EntryAbility]
|
||||
bundle name [com.example.homeagent]
|
||||
ability type [PAGE]
|
||||
state #FOREGROUND start time [82256]
|
||||
app state #FOREGROUND
|
||||
ready #1 window attached #0 launcher #0
|
||||
callee connections:
|
||||
isKeepAlive: false
|
||||
}
|
||||
@ -44,9 +44,9 @@ test('★ 同一份样本把状态对调 ⇒ 前台变成我们(判据只认
|
||||
.map((l) => l.includes('#BACKGROUND') && l.trim().startsWith('state') && l.includes('start time [84231]') ? l.replace('#BACKGROUND', '#FOREGROUND') : l)
|
||||
.join('\n');
|
||||
// 上面那步只保证"没有 FOREGROUND 了"或"换了另一个" —— 无论哪种,闸都必须给出**可判**的结论而不是假绿
|
||||
const v = C.foregroundVerdict(oursFront, OURS);
|
||||
assert.ok(v === C.VERDICT_OURS || v === C.VERDICT_UNVERIFIED,
|
||||
`状态被我改过之后,闸只能说 ours 或 unverified,绝不许在含糊时说 other/ours 之外的侥幸话(实际 ${v})`);
|
||||
assert.equal(C.foregroundVerdict(oursFront, OURS), C.VERDICT_OURS,
|
||||
'★ 正例必须严格成立:状态对调后前台是我们 ⇒ 必须是 ours。否则这道闸的失效方式是"永远说未验"(更安静的失效)');
|
||||
assert.equal(C.mayAssertOn(oursFront, OURS), true, 'ours ⇒ 允许断言(可用窗口不会也被判未验)');
|
||||
});
|
||||
|
||||
test('★ 空 dump / 截断 / 格式变了 ⇒ unverified(缺证据 ≠ 没有那个现象)', () => {
|
||||
@ -66,3 +66,17 @@ test('★ 闸只按 bundle 判:文案/控件名/标题撞车都不影响', ()
|
||||
const tricky = real + '\n component: MailList\n windowTitle: 邮件\n';
|
||||
assert.equal(C.foregroundVerdict(tricky, OURS), C.VERDICT_OTHER, '加上与我们要判控件同名同文案的东西,也不许变成 ours');
|
||||
});
|
||||
|
||||
test('★ 第二份真样本:单 mission(**我们根本不在列表里**)⇒ other,不是 unverified', () => {
|
||||
// 由第一份真样本删掉我们那块得到;形状与 pi 12:03 那份活 dump 一致(他信里也是单 mission)
|
||||
const single = prose(join(HERE, 'fixtures', 'aa-dump-l-single-theirs.txt'));
|
||||
assert.equal(C.parseMissions(single).length, 1);
|
||||
assert.equal(C.foregroundVerdict(single, OURS), C.VERDICT_OTHER,
|
||||
'有 FOREGROUND 且不是我们 ⇒ other。若这里报 unverified,就把"别人占着"和"没读到"混成一种了');
|
||||
assert.equal(C.mayAssertOn(single, OURS), false);
|
||||
});
|
||||
|
||||
test('★ 把 state #FOREGROUND 全部删掉 ⇒ unverified(缺证据,不猜)', () => {
|
||||
const noFg = real.split('\n').filter((l) => !l.includes('#FOREGROUND')).join('\n');
|
||||
assert.equal(C.foregroundVerdict(noFg, OURS), C.VERDICT_UNVERIFIED);
|
||||
});
|
||||
|
||||
@ -79,7 +79,7 @@ const SUITE = [
|
||||
['test/build-stamp.test.mjs', [], 7],
|
||||
['test/packaging.test.mjs', [], 5],
|
||||
['test/align-refs.test.mjs', [], 3],
|
||||
['test/harmony-deviceprobe.test.mjs', ['--experimental-strip-types', '--no-warnings'], 5],
|
||||
['test/harmony-deviceprobe.test.mjs', ['--experimental-strip-types', '--no-warnings'], 7],
|
||||
['test/harmony-push.test.mjs', ['--experimental-strip-types', '--no-warnings'], 13],
|
||||
['test/harmony-calendar.test.mjs', ['--experimental-strip-types', '--no-warnings'], 10],
|
||||
['test/debt-visibility.test.mjs', [], 1],
|
||||
|
||||
Reference in New Issue
Block a user