mirror of
https://github.com/VSCodeVim/Vim.git
synced 2024-10-26 20:23:50 +03:00
6c8e67776d
I'd love to enable `prefer-const` in tslint, but with 17 pull requests outstanding, I think it might cause some merge conflicts. Making the switch in test/** is a step toward that goal which should result in essentially no conflicts.
76 lines
2.2 KiB
TypeScript
76 lines
2.2 KiB
TypeScript
import { getTestingFunctions } from './testSimplifier';
|
|
import { cleanUpWorkspace, setupWorkspace } from './testUtils';
|
|
|
|
suite('Record and execute a macro', () => {
|
|
const { newTest, newTestOnly, newTestSkip } = getTestingFunctions();
|
|
|
|
setup(async () => {
|
|
await setupWorkspace();
|
|
});
|
|
|
|
teardown(cleanUpWorkspace);
|
|
|
|
newTest({
|
|
title: 'Can record and execute',
|
|
start: ['|foo = 1', "bar = 'a'", 'foobar = foo + bar'],
|
|
keysPressed: 'qaA;<Esc>Ivar <Esc>qj@a',
|
|
end: ['var foo = 1;', "var| bar = 'a';", 'foobar = foo + bar'],
|
|
});
|
|
|
|
newTest({
|
|
title: 'Can repeat last invoked macro',
|
|
start: ['|foo = 1', "bar = 'a'", 'foobar = foo + bar'],
|
|
keysPressed: 'qaA;<Esc>Ivar <Esc>qj@aj@@',
|
|
end: ['var foo = 1;', "var bar = 'a';", 'var| foobar = foo + bar;'],
|
|
});
|
|
|
|
newTest({
|
|
title: 'Can play back with count',
|
|
start: ['|"("+a+","+b+","+c+","+d+","+e+")"'],
|
|
keysPressed: 'f+s + <Esc>qq;.q8@q',
|
|
end: ['"(" + a + "," + b + "," + c + "," + d + "," + e +| ")"'],
|
|
});
|
|
|
|
newTest({
|
|
title: 'Can play back with count, abort when a motion fails',
|
|
start: ['|"("+a+","+b+","+c+","+d+","+e+")"'],
|
|
keysPressed: 'f+s + <Esc>qq;.q22@q',
|
|
end: ['"(" + a + "," + b + "," + c + "," + d + "," + e +| ")"'],
|
|
});
|
|
|
|
newTest({
|
|
title: 'Repeat change on contiguous lines',
|
|
start: ['1. |one', '2. two', '3. three', '4. four'],
|
|
keysPressed: 'qa0f.r)w~jq3@a',
|
|
end: ['1) One', '2) Two', '3) Three', '4) F|our'],
|
|
});
|
|
|
|
newTest({
|
|
title: 'Append command to a macro',
|
|
start: ['1. |one', '2. two', '3. three', '4. four'],
|
|
keysPressed: 'qa0f.r)qqAw~jq3@a',
|
|
end: ['1) One', '2) Two', '3) Three', '4) F|our'],
|
|
});
|
|
|
|
newTest({
|
|
title: 'Can record Ctrl Keys and repeat',
|
|
start: ['1|.'],
|
|
keysPressed: 'qayyp<C-a>q4@a',
|
|
end: ['1.', '2.', '3.', '4.', '5.', '|6.'],
|
|
});
|
|
|
|
newTest({
|
|
title: 'Can execute macros with dot commands properly',
|
|
start: ['|test', 'test', 'test', 'test', 'test', 'test', 'test'],
|
|
keysPressed: 'qadd.q@a@a',
|
|
end: ['|test'],
|
|
});
|
|
|
|
newTest({
|
|
title: ': (command) register can be used as a macro',
|
|
start: ['|old', 'old', 'old'],
|
|
keysPressed: ':s/old/new\nj@:j@@',
|
|
end: ['new', 'new', '|new'],
|
|
});
|
|
});
|