Files
stack/packages/bus/tests/address-cases.mjs
2026-10-23 23:57:31 -05:00

17 lines
1007 B
JavaScript

// C2-09b / C2-10c: reusable parser vectors. Keep the expected result independent of the parser.
export const addressCases = [
['one', '@continuity x', { tags: ['continuity'], body: 'x' }],
['many', '@bean @chet hello', { tags: ['bean', 'chet'], body: 'hello' }],
['repeat', '@bean @bean hi', { tags: ['bean', 'bean'], body: 'hi' }],
['plain', 'hello @bean', { tags: [], body: 'hello @bean' }],
['stop', '@bean hello @chet', { tags: ['bean'], body: 'hello @chet' }],
['EOF tag', '@continuity', { tags: ['continuity'], body: '' }],
['EOF last tag', '@bean @chet', { tags: ['bean', 'chet'], body: '' }],
['leading whitespace', ' \t\n@bean\t@chet\nhello ', { tags: ['bean', 'chet'], body: 'hello ' }],
['tags only', '@bean \t\n', { tags: ['bean'], body: '' }],
['empty', '', { tags: [], body: '' }],
['whitespace', ' \t', { tags: [], body: '' }],
['bare at', '@ hello', { tags: [], body: '@ hello' }],
['punctuation is a name', '@unknown, hi', { tags: ['unknown,'], body: 'hi' }],
];