diff options
author | ZyX <kp-pav@yandex.ru> | 2017-04-09 00:12:26 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-04-09 03:24:08 +0300 |
commit | 65fb622000af8e3dbb65480e1581758ecf4ba3e2 (patch) | |
tree | 7d83429d3762b1f0a44d04eb8fc780eedc0ec049 /test/functional/legacy/057_sort_spec.lua | |
parent | 9158cc171f46ebae0a0d3d1721aa5b7d829bcba5 (diff) | |
download | rneovim-65fb622000af8e3dbb65480e1581758ecf4ba3e2.tar.gz rneovim-65fb622000af8e3dbb65480e1581758ecf4ba3e2.tar.bz2 rneovim-65fb622000af8e3dbb65480e1581758ecf4ba3e2.zip |
functests: Replace execute with either command or feed_command
Hope this will make people using feed_command less likely: this hides bugs.
Already found at least two:
1. msgpackparse() will show internal error: hash_add() in case of duplicate
keys, though it will still work correctly. Currently silenced.
2. ttimeoutlen was spelled incorrectly, resulting in option not being set when
expected. Test was still functioning somehow though. Currently fixed.
Diffstat (limited to 'test/functional/legacy/057_sort_spec.lua')
-rw-r--r-- | test/functional/legacy/057_sort_spec.lua | 147 |
1 files changed, 86 insertions, 61 deletions
diff --git a/test/functional/legacy/057_sort_spec.lua b/test/functional/legacy/057_sort_spec.lua index 6984ad0de2..b3343d3af0 100644 --- a/test/functional/legacy/057_sort_spec.lua +++ b/test/functional/legacy/057_sort_spec.lua @@ -1,9 +1,11 @@ -- Tests for :sort command. local helpers = require('test.functional.helpers')(after_each) -local insert, execute, clear, expect, eq, eval, source = helpers.insert, - helpers.execute, helpers.clear, helpers.expect, helpers.eq, helpers.eval, - helpers.source + +local insert, command, clear, expect, eq, eval, wait = helpers.insert, + helpers.command, helpers.clear, helpers.expect, helpers.eq, helpers.eval, + helpers.wait +local exc_exec = helpers.exc_exec describe(':sort', function() local text = [[ @@ -26,9 +28,10 @@ describe(':sort', function() it('alphabetical', function() insert(text) - execute('sort') + wait() + command('sort') expect([[ - + 123b a a122 @@ -65,12 +68,13 @@ describe(':sort', function() b321 b321b ]]) - execute('sort n') + wait() + command('sort n') expect([[ abc ab a - + -24 x-22 0 @@ -89,9 +93,10 @@ describe(':sort', function() it('hexadecimal', function() insert(text) - execute('sort x') + wait() + command('sort x') expect([[ - + a ab abc @@ -110,9 +115,10 @@ describe(':sort', function() it('alphabetical, unique', function() insert(text) - execute('sort u') + wait() + command('sort u') expect([[ - + 123b a a122 @@ -130,7 +136,8 @@ describe(':sort', function() it('alphabetical, reverse', function() insert(text) - execute('sort!') + wait() + command('sort!') expect([[ c321d c123d @@ -151,7 +158,8 @@ describe(':sort', function() it('numerical, reverse', function() insert(text) - execute('sort! n') + wait() + command('sort! n') expect([[ b322b b321b @@ -164,7 +172,7 @@ describe(':sort', function() b123 a123 a122 - + a ab abc]]) @@ -172,7 +180,8 @@ describe(':sort', function() it('unique, reverse', function() insert(text) - execute('sort! u') + wait() + command('sort! u') expect([[ c321d c123d @@ -192,12 +201,13 @@ describe(':sort', function() it('octal', function() insert(text) - execute('sort o') + wait() + command('sort o') expect([[ abc ab a - + a122 a123 b123 @@ -213,7 +223,8 @@ describe(':sort', function() it('reverse, hexadecimal', function() insert(text) - execute('sort! x') + wait() + command('sort! x') expect([[ c321d c123d @@ -234,10 +245,11 @@ describe(':sort', function() it('alphabetical, skip first character', function() insert(text) - execute('sort/./') + wait() + command('sort/./') expect([[ a - + a122 a123 b123 @@ -255,11 +267,12 @@ describe(':sort', function() it('alphabetical, skip first 2 characters', function() insert(text) - execute('sort/../') + wait() + command('sort/../') expect([[ ab a - + a321 b321 b321 @@ -276,11 +289,12 @@ describe(':sort', function() it('alphabetical, unique, skip first 2 characters', function() insert(text) - execute('sort/../u') + wait() + command('sort/../u') expect([[ ab a - + a321 b321 b321b @@ -296,12 +310,13 @@ describe(':sort', function() it('numerical, skip first character', function() insert(text) - execute('sort/./n') + wait() + command('sort/./n') expect([[ abc ab a - + a122 a123 b123 @@ -317,9 +332,10 @@ describe(':sort', function() it('alphabetical, sort on first character', function() insert(text) - execute('sort/./r') + wait() + command('sort/./r') expect([[ - + 123b abc ab @@ -338,10 +354,11 @@ describe(':sort', function() it('alphabetical, sort on first 2 characters', function() insert(text) - execute('sort/../r') + wait() + command('sort/../r') expect([[ a - + 123b a123 a122 @@ -359,7 +376,8 @@ describe(':sort', function() it('numerical, sort on first character', function() insert(text) - execute('sort/./rn') + wait() + command('sort/./rn') expect([[ abc ab @@ -380,12 +398,13 @@ describe(':sort', function() it('alphabetical, skip past first digit', function() insert(text) - execute([[sort/\d/]]) + wait() + command([[sort/\d/]]) expect([[ abc ab a - + a321 b321 b321 @@ -401,12 +420,13 @@ describe(':sort', function() it('alphabetical, sort on first digit', function() insert(text) - execute([[sort/\d/r]]) + wait() + command([[sort/\d/r]]) expect([[ abc ab a - + a123 a122 b123 @@ -422,12 +442,13 @@ describe(':sort', function() it('numerical, skip past first digit', function() insert(text) - execute([[sort/\d/n]]) + wait() + command([[sort/\d/n]]) expect([[ abc ab a - + a321 b321 c321d @@ -443,12 +464,13 @@ describe(':sort', function() it('numerical, sort on first digit', function() insert(text) - execute([[sort/\d/rn]]) + wait() + command([[sort/\d/rn]]) expect([[ abc ab a - + a123 a122 b123 @@ -464,12 +486,13 @@ describe(':sort', function() it('alphabetical, skip past first 2 digits', function() insert(text) - execute([[sort/\d\d/]]) + wait() + command([[sort/\d\d/]]) expect([[ abc ab a - + a321 b321 b321 @@ -485,12 +508,13 @@ describe(':sort', function() it('numerical, skip past first 2 digits', function() insert(text) - execute([[sort/\d\d/n]]) + wait() + command([[sort/\d\d/n]]) expect([[ abc ab a - + a321 b321 c321d @@ -506,12 +530,13 @@ describe(':sort', function() it('hexadecimal, skip past first 2 digits', function() insert(text) - execute([[sort/\d\d/x]]) + wait() + command([[sort/\d\d/x]]) expect([[ abc ab a - + a321 b321 b321 @@ -527,12 +552,13 @@ describe(':sort', function() it('alpha, on first 2 digits', function() insert(text) - execute([[sort/\d\d/r]]) + wait() + command([[sort/\d\d/r]]) expect([[ abc ab a - + a123 a122 b123 @@ -548,12 +574,13 @@ describe(':sort', function() it('numeric, on first 2 digits', function() insert(text) - execute([[sort/\d\d/rn]]) + wait() + command([[sort/\d\d/rn]]) expect([[ abc ab a - + a123 a122 b123 @@ -569,12 +596,13 @@ describe(':sort', function() it('hexadecimal, on first 2 digits', function() insert(text) - execute([[sort/\d\d/rx]]) + wait() + command([[sort/\d\d/rx]]) expect([[ abc ab a - + a123 a122 b123 @@ -591,13 +619,7 @@ describe(':sort', function() it('fails with wrong arguments', function() insert(text) -- This should fail with "E474: Invalid argument". - source([[ - try - sort no - catch - let tmpvar = v:exception - endtry]]) - eq('Vim(sort):E474: Invalid argument', eval('tmpvar')) + eq('Vim(sort):E474: Invalid argument', exc_exec('sort no')) expect(text) end) @@ -617,7 +639,8 @@ describe(':sort', function() 0b100010 0b100100 0b100010]]) - execute([[sort b]]) + wait() + command([[sort b]]) expect([[ 0b000000 0b001000 @@ -651,7 +674,8 @@ describe(':sort', function() 0b101010 0b000000 b0b111000]]) - execute([[sort b]]) + wait() + command([[sort b]]) expect([[ 0b000000 a0b001000 @@ -677,7 +701,8 @@ describe(':sort', function() 1.15e-6 -1.1e3 -1.01e3]]) - execute([[sort f]]) + wait() + command([[sort f]]) expect([[ -1.1e3 -1.01e3 |