-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3a74e78
commit 3780bf8
Showing
4 changed files
with
73 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import * as assert from 'assert'; | ||
import * as TestUtil from '../Util'; | ||
import {window, Selection} from 'vscode'; | ||
|
||
import {Configuration} from '../../src/Configuration'; | ||
import {ActionDelete} from '../../src/Actions/Delete'; | ||
import {MotionWord} from '../../src/Motions/Word'; | ||
|
||
export function run() { | ||
|
||
Configuration.init(); | ||
|
||
test('ActionDelete.byMotions', (done) => { | ||
|
||
const testCases = [ | ||
{ | ||
message: 'MotionWord.nextStart at line end', | ||
motions: [MotionWord.nextStart()], | ||
in: 'Foo end\nBar end', | ||
selection: new Selection(0, 6, 0, 6), | ||
out: 'Foo en\nBar end', | ||
}, | ||
{ | ||
message: 'MotionWord.prevStart at line start', | ||
motions: [MotionWord.prevStart()], | ||
in: 'Foo end\nBar end', | ||
selection: new Selection(1, 0, 1, 0), | ||
out: 'Foo end\nBar end', | ||
} | ||
]; | ||
|
||
let promise = Promise.resolve(); | ||
|
||
while (testCases.length > 0) { | ||
const testCase = testCases.shift(); | ||
promise = promise.then(() => { | ||
|
||
return TestUtil.createTempDocument(testCase.in).then(() => { | ||
TestUtil.setSelection(testCase.selection); | ||
|
||
return ActionDelete.byMotions({ | ||
motions: testCase.motions | ||
}).then(() => { | ||
assert.equal(TestUtil.getDocument().getText(), testCase.out, testCase.message); | ||
}); | ||
}); | ||
|
||
}); | ||
} | ||
|
||
promise.then(() => { | ||
done(); | ||
}, (error) => { | ||
done(error); | ||
}); | ||
|
||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters