import { Configuration } from './testConfiguration'; import { newTest } from './testSimplifier'; import { cleanUpWorkspace, setupWorkspace } from './testUtils'; suite('incsearch motion', () => { setup(async () => { const configuration = new Configuration(); configuration.wrapscan = true; configuration.incsearch = true; await setupWorkspace(configuration); }); teardown(cleanUpWorkspace); suite('', () => { newTest({ title: ' advances current match forward during forward search.', start: ['|one two two two'], keysPressed: '/two\n', end: ['one two |two two'], }); newTest({ title: ' advances current match forward during backward search.', start: ['one two |two two'], keysPressed: '?two\n', end: ['one two |two two'], }); newTest({ title: ' advances current match forward by search count', start: ['|one two two two two two two'], keysPressed: '3/tw\n', end: ['one two two two two two |two'], }); newTest({ title: ' wraps to top of buffer when wrapscan is true', start: ['|one two two two'], keysPressed: '/tw\n', end: ['one |two two two'], }); newTest({ title: ' stops at last match in buffer when wrapscan is false', config: { wrapscan: false }, start: ['|one two two two'], keysPressed: '/tw\n', end: ['one two two |two'], }); newTest({ title: ' during search with count stops at last reachable match in buffer when wrapscan is false', config: { wrapscan: false }, start: ['|one two two two'], keysPressed: '2/tw\n', end: ['one two |two two'], }); }); suite('', () => { newTest({ title: ' moves backward during forward search.', start: ['one |two two two'], keysPressed: '/two\n', end: ['one |two two two'], }); newTest({ title: ' moves backward during backward search.', start: ['one two two |two'], keysPressed: '?two\n', end: ['one |two two two'], }); newTest({ title: ' wraps to last match in buffer with wrapscan', start: ['one two |two two'], keysPressed: '/tw\n', end: ['one two two |two'], }); newTest({ title: ' stays at first match in buffer with nowrapscan', config: { wrapscan: false }, start: ['one two |two two'], keysPressed: '/tw\n', end: ['one |two two two'], }); newTest({ title: ' during search with count stays at first reachable match in buffer with nowrapscan', config: { wrapscan: false }, start: ['one two |two two'], keysPressed: '2/tw\n', end: ['one two |two two'], }); }); });