⚠
Compilation errors. Some tests may have lines omitted
A domain specific language for testing the text editor state
<command> ::= <press-command> | <type> | <expect-cursor> | <expect-selection>
<type> ::= TYPE "text"
<press-command> ::= <press> [quantification] [with <modifiers>]
| <press> [with <modifiers>] [quantification]
<press> ::= PRESS (<char> | <special-key>) | <special-key>
<expect-cursor> ::= EXPECT cursor at <row>,<col>
<expect-selection> ::= EXPECT selection at <startRow>,<startCol>-<endRow>,<endCol>
<char> ::= a | " " | ';' | ...
<special-key> ::= backspace | enter | left | right | up | down
<quantification> ::= once | N time(s) (default: once)
<modifiers> ::= shift | meta | meta, shift
Examples in Normalized Form → Transpilation
TYPE "Hello" → fixture.type('Hello');
PRESS a once → fixture.press('a').once();
PRESS ";" → fixture.press(';').once();
PRESS ' ' → fixture.press(' ').times(1);
enter 1 time → fixture.press(Key.Enter).once();
backspace → fixture.press(Key.Backspace).times(3);
left 3 times with meta → fixture.press(Key.ArrowLeft).withMetaKey().once();
right with meta, shift → fixture.press(Key.ArrowRight).withMetaKey().withShiftKey().once();
EXPECT cursor at 0,5 → expect(fixture).toHaveCursorAt(0, 5);
EXPECT selection at 1,2-4,5 → expect(fixture).toHaveSelectionAt(1, 2, 4, 5);
JavaScript pass-through for lines ending with ";", starting with "//" and empty lines:
expect(3+5).toBe(8); → expect(3+5).toBe(8);
// This is a comment → // This is a comment
(empty line) → (empty line)