summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2012-09-05 19:17:42 +0200
committerBram Moolenaar <Bram@vim.org>2012-09-05 19:17:42 +0200
commitc11073c9aa2b668a9c1faa8a2419d7984d8367ca (patch)
tree1cd5f3b715678316695a156688962d5613d7b8ff
parentafa6b9af865c18dd865ccf7b804a4645570027bd (diff)
downloadvim-git-c11073c9aa2b668a9c1faa8a2419d7984d8367ca.tar.gz
updated for version 7.3.659v7.3.659
Problem: Recent Python changes are not tested. Solution: Add tests for Python bindings. (ZyX)
-rw-r--r--src/testdir/test86.in54
-rw-r--r--src/testdir/test86.ok12
-rw-r--r--src/testdir/test87.in54
-rw-r--r--src/testdir/test87.ok12
-rw-r--r--src/version.c2
5 files changed, 110 insertions, 24 deletions
diff --git a/src/testdir/test86.in b/src/testdir/test86.in
index 395ba96c4..93eb40085 100644
--- a/src/testdir/test86.in
+++ b/src/testdir/test86.in
@@ -176,28 +176,62 @@ STARTTEST
:else
: $put ='[0.0, 0.0]'
:endif
+:let messages=[]
+:py <<EOF
+d=vim.bindeval('{}')
+m=vim.bindeval('messages')
+try:
+ d['abc']
+except Exception as e:
+ m.extend([e.__class__.__name__])
+
+try:
+ d['abc']="\0"
+except Exception as e:
+ m.extend([e.__class__.__name__])
+
+try:
+ d['abc']=vim
+except Exception as e:
+ m.extend([e.__class__.__name__])
+
+try:
+ d['']=1
+except Exception as e:
+ m.extend([e.__class__.__name__])
+
+try:
+ d['a\0b']=1
+except Exception as e:
+ m.extend([e.__class__.__name__])
+
+try:
+ d[b'a\0b']=1
+except Exception as e:
+ m.extend([e.__class__.__name__])
+EOF
+:$put =messages
:"
:" pyeval()
:let l=pyeval('range(3)')
:$put =string(l)
:let d=pyeval('{"a": "b", "c": 1, "d": ["e"]}')
:$put =sort(items(d))
-:try
-: let undef=pyeval('undefined_name')
-:catch
-: $put =v:exception[:13]
-:endtry
-:try
-: let vim=pyeval('vim')
-:catch
-: $put =v:exception[:13]
-:endtry
:if has('float')
: let f=pyeval('0.0')
: $put =string(f)
:else
: $put ='0.0'
:endif
+:" Invalid values:
+:for e in ['"\0"', '{"\0": 1}', 'undefined_name', 'vim']
+: try
+: let v=pyeval(e)
+: catch
+: let toput=e.":\t".v:exception[:13]
+: $put =toput
+: endtry
+:endfor
:endfun
:"
:call Test()
diff --git a/src/testdir/test86.ok b/src/testdir/test86.ok
index ebf9f88b0..94f36e970 100644
--- a/src/testdir/test86.ok
+++ b/src/testdir/test86.ok
@@ -38,10 +38,18 @@ Vim(put):E684:
Vim(python):E725:
Vim(python):E117:
[0.0, 0.0]
+IndexError
+TypeError
+TypeError
+ValueError
+TypeError
+TypeError
[0, 1, 2]
['a', 'b']
['c', 1]
['d', ['e']]
-Vim(let):E858:
-Vim(let):E859:
0.0
+"\0": Vim(let):E859:
+{"\0": 1}: Vim(let):E859:
+undefined_name: Vim(let):E858:
+vim: Vim(let):E859:
diff --git a/src/testdir/test87.in b/src/testdir/test87.in
index 8e48605be..312763c80 100644
--- a/src/testdir/test87.in
+++ b/src/testdir/test87.in
@@ -176,28 +176,62 @@ STARTTEST
:else
: $put ='[0.0, 0.0]'
:endif
+:let messages=[]
+:py3 <<EOF
+d=vim.bindeval('{}')
+m=vim.bindeval('messages')
+try:
+ d['abc']
+except Exception as e:
+ m.extend([e.__class__.__name__])
+
+try:
+ d['abc']="\0"
+except Exception as e:
+ m.extend([e.__class__.__name__])
+
+try:
+ d['abc']=vim
+except Exception as e:
+ m.extend([e.__class__.__name__])
+
+try:
+ d['']=1
+except Exception as e:
+ m.extend([e.__class__.__name__])
+
+try:
+ d['a\0b']=1
+except Exception as e:
+ m.extend([e.__class__.__name__])
+
+try:
+ d[b'a\0b']=1
+except Exception as e:
+ m.extend([e.__class__.__name__])
+EOF
+:$put =messages
:"
:" py3eval()
:let l=py3eval('[0, 1, 2]')
:$put =string(l)
:let d=py3eval('{"a": "b", "c": 1, "d": ["e"]}')
:$put =sort(items(d))
-:try
-: let undef=py3eval('undefined_name')
-:catch
-: $put =v:exception[:13]
-:endtry
-:try
-: let vim=py3eval('vim')
-:catch
-: $put =v:exception[:13]
-:endtry
:if has('float')
: let f=py3eval('0.0')
: $put =string(f)
:else
: $put ='0.0'
:endif
+:" Invalid values:
+:for e in ['"\0"', '{"\0": 1}', 'undefined_name', 'vim']
+: try
+: let v=py3eval(e)
+: catch
+: let toput=e.":\t".v:exception[:13]
+: $put =toput
+: endtry
+:endfor
:endfun
:"
:call Test()
diff --git a/src/testdir/test87.ok b/src/testdir/test87.ok
index bcc4872bd..4eab84530 100644
--- a/src/testdir/test87.ok
+++ b/src/testdir/test87.ok
@@ -38,10 +38,18 @@ Vim(put):E684:
Vim(py3):E725:
Vim(py3):E117:
[0.0, 0.0]
+IndexError
+TypeError
+TypeError
+ValueError
+TypeError
+TypeError
[0, 1, 2]
['a', 'b']
['c', 1]
['d', ['e']]
-Vim(let):E860:
-Vim(let):E861:
0.0
+"\0": Vim(let):E861:
+{"\0": 1}: Vim(let):E861:
+undefined_name: Vim(let):E860:
+vim: Vim(let):E861:
diff --git a/src/version.c b/src/version.c
index 62bc81957..06afdf2cc 100644
--- a/src/version.c
+++ b/src/version.c
@@ -720,6 +720,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 659,
+/**/
658,
/**/
657,