2 # Copyright Simon Lydell 2015.
4 # This file is part of VimFx.
6 # VimFx is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # VimFx is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with VimFx. If not, see <http://www.gnu.org/licenses/>.
20 legacy = require('../lib/legacy')
22 exports['test convertKey'] = (assert) ->
23 assert.deepEqual(legacy.convertKey('a'), ['a'])
24 assert.deepEqual(legacy.convertKey('Esc'), ['<escape>'])
25 assert.deepEqual(legacy.convertKey('a,Esc'), ['a', '<escape>'])
26 assert.deepEqual(legacy.convertKey(','), [','])
27 assert.deepEqual(legacy.convertKey(',,a'), [',', 'a'])
28 assert.deepEqual(legacy.convertKey('a,,'), ['a', ','])
29 assert.deepEqual(legacy.convertKey('a,,,b'), ['a', ',', 'b'])
30 assert.deepEqual(legacy.convertKey(',,,,a'), [',', ',', 'a'])
31 assert.deepEqual(legacy.convertKey('a,,,,'), ['a', ',', ','])
33 exports['test convertPattern'] = (assert) ->
34 assert.equal(legacy.convertPattern('aB. t*o! *!'), 'aB\\.\\s+t.*o.\\s+.*.')