File: patch-8.1.0189-function-defined-in-sandbox-not-tested.patch

package info (click to toggle)
vim 2%3A8.0.0197-4%2Bdeb9u3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 60,600 kB
  • sloc: ansic: 320,650; cpp: 4,144; makefile: 3,536; perl: 1,179; awk: 715; sh: 682; xml: 526; lisp: 501; cs: 458; python: 410; asm: 114; csh: 6
file content (52 lines) | stat: -rw-r--r-- 1,449 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
From: Bram Moolenaar <Bram@vim.org>
Date: Sun, 15 Jul 2018 20:24:31 +0200
Subject: patch 8.1.0189: function defined in sandbox not tested

Problem:    Function defined in sandbox not tested.
Solution:   Add a text.

(cherry picked from commit d90a144eda047816acffc7a8f297b43a7120710e)

Signed-off-by: James McCoy <jamessan@debian.org>
---
 src/testdir/test_functions.vim | 16 ++++++++++++++++
 src/version.c                  |  2 ++
 2 files changed, 18 insertions(+)

diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index ec816d1..1bbfc37 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -16,3 +16,19 @@ func Test_str2nr()
   call assert_equal(123456789, str2nr('123456789'))
   call assert_equal(-123456789, str2nr('-123456789'))
 endfunc
+
+sandbox function Fsandbox()
+  normal ix
+endfunc
+
+func Test_func_sandbox()
+  sandbox let F = {-> 'hello'}
+  call assert_equal('hello', F())
+
+  sandbox let F = {-> execute("normal ix\<Esc>")}
+  call assert_fails('call F()', 'E48:')
+  unlet F
+
+  call assert_fails('call Fsandbox()', 'E48:')
+  delfunc Fsandbox
+endfunc
diff --git a/src/version.c b/src/version.c
index 8bc64f9..56a66d2 100644
--- a/src/version.c
+++ b/src/version.c
@@ -1195,6 +1195,8 @@ static int included_patches[] =
  */
 static char *(extra_patches[]) =
 {   /* Add your patch description below this line */
+/**/
+    "8.1.0189",
 /**/
     "8.1.0177",
 /**/