Fix indents.

This commit is contained in:
KillTheMule
2016-06-02 22:13:51 +02:00
committed by Justin M. Keyes
parent dfaf720442
commit 5a387dddc6

View File

@@ -15,9 +15,9 @@ describe('list and dictionary types', function()
$put =string(l[-1]) $put =string(l[-1])
$put =string(l[-4]) $put =string(l[-4])
try try
$put =string(l[-5]) $put =string(l[-5])
catch catch
$put =v:exception[:14] $put =v:exception[:14]
endtry]]) endtry]])
expect([[ expect([[
@@ -54,10 +54,10 @@ describe('list and dictionary types', function()
let ll = l let ll = l
let lx = copy(l) let lx = copy(l)
try try
$put =(l == ll) . (l isnot ll) . (l is ll) . (l == lx) . $put =(l == ll) . (l isnot ll) . (l is ll) . (l == lx) .
\ (l is lx) . (l isnot lx) \ (l is lx) . (l isnot lx)
catch catch
$put =v:exception $put =v:exception
endtry]]) endtry]])
expect('\n101101') expect('\n101101')
end) end)
@@ -70,15 +70,15 @@ describe('list and dictionary types', function()
$put =string(sort(keys(d))) $put =string(sort(keys(d)))
$put =string (values(d)) $put =string (values(d))
for [key, val] in items(d) for [key, val] in items(d)
$put =key . ':' . string(val) $put =key . ':' . string(val)
unlet key val unlet key val
endfor endfor
call extend (d, {3:33, 1:99}) call extend (d, {3:33, 1:99})
call extend(d, {'b':'bbb', 'c':'ccc'}, "keep") call extend(d, {'b':'bbb', 'c':'ccc'}, "keep")
try try
call extend(d, {3:333,4:444}, "error") call extend(d, {3:333,4:444}, "error")
catch catch
$put =v:exception[:15] . v:exception[-1:-1] $put =v:exception[:15] . v:exception[-1:-1]
endtry endtry
$put =string(d) $put =string(d)
call filter(d, 'v:key =~ ''[ac391]''') call filter(d, 'v:key =~ ''[ac391]''')
@@ -104,10 +104,10 @@ describe('list and dictionary types', function()
let dd = d let dd = d
let dx = copy(d) let dx = copy(d)
try try
$put =(d == dd) . (d isnot dd) . (d is dd) . (d == dx) . (d is dx) . $put =(d == dd) . (d isnot dd) . (d is dd) . (d == dx) . (d is dx) .
\ (d isnot dx) \ (d isnot dx)
catch catch
$put =v:exception $put =v:exception
endtry]]) endtry]])
expect('\n101101') expect('\n101101')
end) end)
@@ -120,14 +120,14 @@ describe('list and dictionary types', function()
" The dict from the first test repeated after splitting the tests. " The dict from the first test repeated after splitting the tests.
let d = {'c': 'ccc', '1': 99, '3': 33, '-1': {'a': 1}} let d = {'c': 'ccc', '1': 99, '3': 33, '-1': {'a': 1}}
try try
let d = [] let d = []
catch catch
$put =v:exception[:14] . v:exception[-1:-1] $put =v:exception[:14] . v:exception[-1:-1]
endtry endtry
try try
let l = {} let l = {}
catch catch
$put =v:exception[:14] . v:exception[-1:-1] $put =v:exception[:14] . v:exception[-1:-1]
endtry]]) endtry]])
expect([[ expect([[
@@ -146,10 +146,10 @@ describe('list and dictionary types', function()
$put =string(l) $put =string(l)
let l = range(8) let l = range(8)
try try
unlet l[:3] unlet l[:3]
unlet l[1:] unlet l[1:]
catch catch
$put =v:exception $put =v:exception
endtry endtry
$put =string(l) $put =string(l)
@@ -221,14 +221,14 @@ describe('list and dictionary types', function()
$put =va $put =va
$put =vb $put =vb
try try
let [va, vb] = l let [va, vb] = l
catch catch
$put =v:exception[:14] $put =v:exception[:14]
endtry endtry
try try
let [va, vb] = l[1:1] let [va, vb] = l[1:1]
catch catch
$put =v:exception[:14] $put =v:exception[:14]
endtry]]) endtry]])
expect([[ expect([[
@@ -244,38 +244,38 @@ describe('list and dictionary types', function()
source([[ source([[
let d = {} let d = {}
for i in range(1500) for i in range(1500)
let d[i] = 3000 - i let d[i] = 3000 - i
endfor endfor
$put =d[0] . ' ' . d[100] . ' ' . d[999] . ' ' . d[1400] . ' ' . $put =d[0] . ' ' . d[100] . ' ' . d[999] . ' ' . d[1400] . ' ' .
\ d[1499] \ d[1499]
try try
let n = d[1500] let n = d[1500]
catch catch
$put =substitute(v:exception, '\v(.{14}).*( \d{4}).*', '\1\2', '') $put =substitute(v:exception, '\v(.{14}).*( \d{4}).*', '\1\2', '')
endtry endtry
" Lookup each items. " Lookup each items.
for i in range(1500) for i in range(1500)
if d[i] != 3000 - i if d[i] != 3000 - i
$put =d[i] $put =d[i]
endif endif
endfor endfor
let i += 1 let i += 1
" Delete even items. " Delete even items.
while i >= 2 while i >= 2
let i -= 2 let i -= 2
unlet d[i] unlet d[i]
endwhile endwhile
$put =get(d, 1500 - 100, 'NONE') . ' ' . d[1] $put =get(d, 1500 - 100, 'NONE') . ' ' . d[1]
" Delete odd items, checking value, one intentionally wrong. " Delete odd items, checking value, one intentionally wrong.
let d[33] = 999 let d[33] = 999
let i = 1 let i = 1
while i < 1500 while i < 1500
if d[i] != 3000 - i if d[i] != 3000 - i
$put =i . '=' . d[i] $put =i . '=' . d[i]
else else
unlet d[i] unlet d[i]
endif endif
let i += 2 let i += 2
endwhile endwhile
" Must be almost empty now. " Must be almost empty now.
$put =string(d)]]) $put =string(d)]])
@@ -292,16 +292,16 @@ describe('list and dictionary types', function()
source([[ source([[
let dict = {} let dict = {}
func dict.func(a) dict func dict.func(a) dict
$put =a:a . len(self.data) $put =a:a . len(self.data)
endfunc endfunc
let dict.data = [1,2,3] let dict.data = [1,2,3]
call dict.func("len: ") call dict.func("len: ")
let x = dict.func("again: ") let x = dict.func("again: ")
try try
let Fn = dict.func let Fn = dict.func
call Fn('xxx') call Fn('xxx')
catch catch
$put =v:exception[:15] $put =v:exception[:15]
endtry]]) endtry]])
expect([[ expect([[
@@ -314,7 +314,7 @@ describe('list and dictionary types', function()
source([[ source([[
let g:dict = {} let g:dict = {}
function g:dict.func() dict function g:dict.func() dict
$put ='g:dict.func'.self.foo[1].self.foo[0]('asdf') $put ='g:dict.func'.self.foo[1].self.foo[0]('asdf')
endfunc endfunc
let g:dict.foo = ['-', 2, 3] let g:dict.foo = ['-', 2, 3]
call insert(g:dict.foo, function('strlen')) call insert(g:dict.foo, function('strlen'))
@@ -326,7 +326,7 @@ describe('list and dictionary types', function()
source([[ source([[
let d = {1:1} let d = {1:1}
func d.func(a) func d.func(a)
return "a:". a:a return "a:". a:a
endfunc endfunc
$put =d.func(string(remove(d, 'func')))]]) $put =d.func(string(remove(d, 'func')))]])
-- The function number changed from 3 to 1 because we split the test. -- The function number changed from 3 to 1 because we split the test.
@@ -342,9 +342,9 @@ describe('list and dictionary types', function()
let d[3] = l let d[3] = l
let dc = deepcopy(d) let dc = deepcopy(d)
try try
let dc = deepcopy(d, 1) let dc = deepcopy(d, 1)
catch catch
$put =v:exception[:14] $put =v:exception[:14]
endtry endtry
let l2 = [0, l, l, 3] let l2 = [0, l, l, 3]
let l[1] = l2 let l[1] = l2
@@ -360,65 +360,65 @@ describe('list and dictionary types', function()
source([=[ source([=[
let l = [] let l = []
for depth in range(5) for depth in range(5)
$put ='depth is ' . depth $put ='depth is ' . depth
for u in range(3) for u in range(3)
unlet l unlet l
let l = [0, [1, [2, 3]], {4: 5, 6: {7: 8}}] let l = [0, [1, [2, 3]], {4: 5, 6: {7: 8}}]
exe "lockvar " . depth . " l" exe "lockvar " . depth . " l"
if u == 1 if u == 1
exe "unlockvar l" exe "unlockvar l"
elseif u == 2 elseif u == 2
exe "unlockvar " . depth . " l" exe "unlockvar " . depth . " l"
endif endif
let ps = islocked("l") . islocked("l[1]") . islocked("l[1][1]") . let ps = islocked("l") . islocked("l[1]") . islocked("l[1][1]") .
\ islocked("l[1][1][0]") . '-' . islocked("l[2]") . \ islocked("l[1][1][0]") . '-' . islocked("l[2]") .
\ islocked("l[2]['6']") . islocked("l[2]['6'][7]") \ islocked("l[2]['6']") . islocked("l[2]['6'][7]")
$put =ps $put =ps
let ps = '' let ps = ''
try try
let l[1][1][0] = 99 let l[1][1][0] = 99
let ps .= 'p' let ps .= 'p'
catch catch
let ps .= 'F' let ps .= 'F'
endtry endtry
try try
let l[1][1] = [99] let l[1][1] = [99]
let ps .= 'p' let ps .= 'p'
catch catch
let ps .= 'F' let ps .= 'F'
endtry endtry
try try
let l[1] = [99] let l[1] = [99]
let ps .= 'p' let ps .= 'p'
catch catch
let ps .= 'F' let ps .= 'F'
endtry endtry
try try
let l[2]['6'][7] = 99 let l[2]['6'][7] = 99
let ps .= 'p' let ps .= 'p'
catch catch
let ps .= 'F' let ps .= 'F'
endtry endtry
try try
let l[2][6] = {99: 99} let l[2][6] = {99: 99}
let ps .= 'p' let ps .= 'p'
catch catch
let ps .= 'F' let ps .= 'F'
endtry endtry
try try
let l[2] = {99: 99} let l[2] = {99: 99}
let ps .= 'p' let ps .= 'p'
catch catch
let ps .= 'F' let ps .= 'F'
endtry endtry
try try
let l = [99] let l = [99]
let ps .= 'p' let ps .= 'p'
catch catch
let ps .= 'F' let ps .= 'F'
endtry endtry
$put =ps $put =ps
endfor endfor
endfor]=]) endfor]=])
expect([[ expect([[
@@ -476,8 +476,8 @@ describe('list and dictionary types', function()
exe "unlockvar " . depth . " l" exe "unlockvar " . depth . " l"
endif endif
let ps = islocked("l") . islocked("l[1]") . islocked("l[1][1]") . let ps = islocked("l") . islocked("l[1]") . islocked("l[1][1]") .
\ islocked("l[1][1][0]") . '-' . islocked("l[2]") . \ islocked("l[1][1][0]") . '-' . islocked("l[2]") .
\ islocked("l[2]['6']") . islocked("l[2]['6'][7]") \ islocked("l[2]['6']") . islocked("l[2]['6'][7]")
$put =ps $put =ps
let ps = '' let ps = ''
try try
@@ -744,37 +744,37 @@ describe('list and dictionary types', function()
it('a:000 function argument', function() it('a:000 function argument', function()
source([[ source([[
function Test(...) function Test(...)
" First the tests that should fail. " First the tests that should fail.
try try
let a:000 = [1, 2] let a:000 = [1, 2]
catch catch
$put ='caught a:000' $put ='caught a:000'
endtry endtry
try try
let a:000[0] = 9 let a:000[0] = 9
catch catch
$put ='caught a:000[0]' $put ='caught a:000[0]'
endtry endtry
try try
let a:000[2] = [9, 10] let a:000[2] = [9, 10]
catch catch
$put ='caught a:000[2]' $put ='caught a:000[2]'
endtry endtry
try try
let a:000[3] = {9: 10} let a:000[3] = {9: 10}
catch catch
$put ='caught a:000[3]' $put ='caught a:000[3]'
endtry endtry
" Now the tests that should pass. " Now the tests that should pass.
try try
let a:000[2][1] = 9 let a:000[2][1] = 9
call extend(a:000[2], [5, 6]) call extend(a:000[2], [5, 6])
let a:000[3][5] = 8 let a:000[3][5] = 8
let a:000[3]['a'] = 12 let a:000[3]['a'] = 12
$put =string(a:000) $put =string(a:000)
catch catch
$put ='caught ' . v:exception $put ='caught ' . v:exception
endtry endtry
endfunction]]) endfunction]])
execute('call Test(1, 2, [3, 4], {5: 6})') execute('call Test(1, 2, [3, 4], {5: 6})')
expect([=[ expect([=[
@@ -789,7 +789,7 @@ describe('list and dictionary types', function()
it('reverse(), sort(), uniq()', function() it('reverse(), sort(), uniq()', function()
source([=[ source([=[
let l = ['-0', 'A11', 2, 2, 'xaaa', 4, 'foo', 'foo6', 'foo', let l = ['-0', 'A11', 2, 2, 'xaaa', 4, 'foo', 'foo6', 'foo',
\ [0, 1, 2], 'x8', [0, 1, 2], 1.5] \ [0, 1, 2], 'x8', [0, 1, 2], 1.5]
$put =string(uniq(copy(l))) $put =string(uniq(copy(l)))
$put =string(reverse(l)) $put =string(reverse(l))
$put =string(reverse(reverse(l))) $put =string(reverse(reverse(l)))
@@ -798,10 +798,10 @@ describe('list and dictionary types', function()
$put =string(sort(reverse(sort(l)))) $put =string(sort(reverse(sort(l))))
$put =string(uniq(sort(l))) $put =string(uniq(sort(l)))
let l=[7, 9, 'one', 18, 12, 22, 'two', 10.0e-16, -1, 'three', 0xff, let l=[7, 9, 'one', 18, 12, 22, 'two', 10.0e-16, -1, 'three', 0xff,
\ 0.22, 'four'] \ 0.22, 'four']
$put =string(sort(copy(l), 'n')) $put =string(sort(copy(l), 'n'))
let l=[7, 9, 18, 12, 22, 10.0e-16, -1, 0xff, 0, -0, 0.22, 'bar', let l=[7, 9, 18, 12, 22, 10.0e-16, -1, 0xff, 0, -0, 0.22, 'bar',
\ 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', {}, []] \ 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', {}, []]
$put =string(sort(copy(l), 1)) $put =string(sort(copy(l), 1))
$put =string(sort(copy(l), 'i')) $put =string(sort(copy(l), 'i'))
$put =string(sort(copy(l)))]=]) $put =string(sort(copy(l)))]=])
@@ -902,9 +902,9 @@ describe('list and dictionary types', function()
" Copy dict from previous test. " Copy dict from previous test.
let d = { 'a': {'b': 'B'}} let d = { 'a': {'b': 'B'}}
try try
call extend(d, d, "error") call extend(d, d, "error")
catch catch
$put =v:exception[:15] . v:exception[-1:-1] $put =v:exception[:15] . v:exception[-1:-1]
endtry endtry
$put =string(d)]]) $put =string(d)]])
expect([[ expect([[