test(speckl): lock in enum interface classification (cycle 60)
Adds a regression test that confirms a bare-identifier interface (no
methods with parens, no fields with colons) parses as kind: 'enum'
with the variants on its methods[] array. The .proto generator already
emits these correctly as 'enum X { X_UNSPECIFIED = 0; FOO = 1; ... }'
- confirmed end-to-end by running generateProtobuf against the
federated-meetup CustodyTier shape.
This was a verification cycle rather than a feature cycle: the compiler
already does the right thing for enums, but without a regression test
a future refactor of classifyInterfaces or parseInterface could break
this silently. The test pins the behavior so a PR that breaks enum
emission will fail CI.
All 49 tests pass (48 + 1 new). tsc build clean.
Reference: federated-meetup.speckdl CustodyTier shape
interface CustodyTier {
ColdHardware
HotSigning
ThresholdSplit
BackupOnly
Compromised
}
This commit is contained in:
parent
0ab3174314
commit
ec0f213448
1 changed files with 24 additions and 0 deletions
|
|
@ -742,4 +742,28 @@ speck Second {
|
|||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Cycle 60: enum interfaces (e.g. CustodyTier) parse as `kind: 'enum'`
|
||||
// and the .proto generator emits a real `enum X { ... }` block.
|
||||
describe('enum interfaces (cycle 60)', () => {
|
||||
it('should classify bare-identifier interfaces as enums', () => {
|
||||
const content = `speck FederatedMeetup {
|
||||
interface CustodyTier {
|
||||
ColdHardware
|
||||
HotSigning
|
||||
ThresholdSplit
|
||||
BackupOnly
|
||||
Compromised
|
||||
}
|
||||
}`;
|
||||
const ast = parseSpeckContent(content);
|
||||
const tier = ast.specks[0].members.find(m => m.name === 'CustodyTier');
|
||||
if (tier?.type === 'interface') {
|
||||
expect(tier.kind).toBe('enum');
|
||||
expect(tier.methods.map(m => m.name)).toEqual([
|
||||
'ColdHardware', 'HotSigning', 'ThresholdSplit', 'BackupOnly', 'Compromised'
|
||||
]);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue