-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Jason Poon
committed
Feb 6, 2019
1 parent
adff634
commit c863403
Showing
8 changed files
with
150 additions
and
10 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import * as assert from 'assert'; | ||
import { Configuration } from '../../testConfiguration'; | ||
import { NeovimValidator } from '../../../src/configuration/validators/neovimValidator'; | ||
|
||
suite('Neovim Validator', () => { | ||
test('neovim enabled without path', async () => { | ||
// setup | ||
let configuration = new Configuration(); | ||
configuration.enableNeovim = true; | ||
configuration.neovimPath = ''; | ||
|
||
// test | ||
const validator = new NeovimValidator(); | ||
let actual = await validator.validate(configuration); | ||
validator.disable(configuration); | ||
|
||
// assert | ||
assert.equal(actual.numErrors, 1); | ||
assert.equal(actual.hasError, true); | ||
assert.equal(configuration.enableNeovim, false); | ||
}); | ||
|
||
test('neovim disabled', async () => { | ||
// setup | ||
let configuration = new Configuration(); | ||
configuration.enableNeovim = false; | ||
configuration.neovimPath = ''; | ||
|
||
// test | ||
const validator = new NeovimValidator(); | ||
let actual = await validator.validate(configuration); | ||
|
||
// assert | ||
assert.equal(actual.numErrors, 0); | ||
}); | ||
}); |
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,92 @@ | ||
import * as assert from 'assert'; | ||
import { Configuration } from '../../testConfiguration'; | ||
import { RemappingValidator } from '../../../src/configuration/validators/remappingValidator'; | ||
|
||
suite('Remapping Validator', () => { | ||
test('no remappings', async () => { | ||
// setup | ||
const configuration = new Configuration(); | ||
configuration.insertModeKeyBindings = []; | ||
configuration.insertModeKeyBindingsNonRecursive = []; | ||
configuration.normalModeKeyBindings = []; | ||
configuration.normalModeKeyBindingsNonRecursive = []; | ||
configuration.visualModeKeyBindings = []; | ||
configuration.visualModeKeyBindingsNonRecursive = []; | ||
|
||
// test | ||
const validator = new RemappingValidator(); | ||
let actual = await validator.validate(configuration); | ||
|
||
// assert | ||
assert.equal(actual.numErrors, 0); | ||
assert.equal(actual.hasError, false); | ||
|
||
assert.equal(configuration.insertModeKeyBindingsMap.size, 0); | ||
assert.equal(configuration.insertModeKeyBindingsNonRecursiveMap.size, 0); | ||
assert.equal(configuration.normalModeKeyBindingsMap.size, 0); | ||
assert.equal(configuration.normalModeKeyBindingsNonRecursiveMap.size, 0); | ||
assert.equal(configuration.visualModeKeyBindingsMap.size, 0); | ||
assert.equal(configuration.visualModeKeyBindingsNonRecursiveMap.size, 0); | ||
}); | ||
|
||
test('jj->esc', async () => { | ||
// setup | ||
let configuration = new Configuration(); | ||
configuration.insertModeKeyBindings = [ | ||
{ | ||
before: ['j', 'j'], | ||
after: ['<Esc>'], | ||
}]; | ||
configuration.insertModeKeyBindingsNonRecursive = []; | ||
configuration.normalModeKeyBindings = []; | ||
configuration.normalModeKeyBindingsNonRecursive = []; | ||
configuration.visualModeKeyBindings = []; | ||
configuration.visualModeKeyBindingsNonRecursive = []; | ||
|
||
// test | ||
const validator = new RemappingValidator(); | ||
let actual = await validator.validate(configuration); | ||
|
||
// assert | ||
assert.equal(actual.numErrors, 0); | ||
assert.equal(actual.hasError, false); | ||
|
||
assert.equal(configuration.insertModeKeyBindingsMap.size, 1); | ||
assert.equal(configuration.insertModeKeyBindingsNonRecursiveMap.size, 0); | ||
assert.equal(configuration.normalModeKeyBindingsMap.size, 0); | ||
assert.equal(configuration.normalModeKeyBindingsNonRecursiveMap.size, 0); | ||
assert.equal(configuration.visualModeKeyBindingsMap.size, 0); | ||
assert.equal(configuration.visualModeKeyBindingsNonRecursiveMap.size, 0); | ||
|
||
assert.equal(configuration.insertModeKeyBindingsMap.get("jj"), configuration.insertModeKeyBindings[0]); | ||
}); | ||
|
||
test('remapping missing after and command', async () => { | ||
// setup | ||
let configuration = new Configuration(); | ||
configuration.insertModeKeyBindings = [ | ||
{ | ||
before: ['j', 'j'] | ||
}]; | ||
configuration.insertModeKeyBindingsNonRecursive = []; | ||
configuration.normalModeKeyBindings = []; | ||
configuration.normalModeKeyBindingsNonRecursive = []; | ||
configuration.visualModeKeyBindings = []; | ||
configuration.visualModeKeyBindingsNonRecursive = []; | ||
|
||
// test | ||
const validator = new RemappingValidator(); | ||
let actual = await validator.validate(configuration); | ||
|
||
// assert | ||
assert.equal(actual.numErrors, 1); | ||
assert.equal(actual.hasError, true); | ||
|
||
assert.equal(configuration.insertModeKeyBindingsMap.size, 0); | ||
assert.equal(configuration.insertModeKeyBindingsNonRecursiveMap.size, 0); | ||
assert.equal(configuration.normalModeKeyBindingsMap.size, 0); | ||
assert.equal(configuration.normalModeKeyBindingsNonRecursiveMap.size, 0); | ||
assert.equal(configuration.visualModeKeyBindingsMap.size, 0); | ||
assert.equal(configuration.visualModeKeyBindingsNonRecursiveMap.size, 0); | ||
}); | ||
}); |
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