diff options
author | Bram Moolenaar <Bram@vim.org> | 2013-02-13 14:17:08 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2013-02-13 14:17:08 +0100 |
commit | 76d711c3b5397b749a67d229150d3c1ff3f33add (patch) | |
tree | ca5c0745ab1f3995faacee77be1bf4369ae4765d /src/testdir | |
parent | 51971b33988e590901b9f6ad14a5a36f276afd0b (diff) | |
download | vim-git-76d711c3b5397b749a67d229150d3c1ff3f33add.tar.gz |
updated for version 7.3.808v7.3.808
Problem: Python threads still do not work properly.
Solution: Fix both Python 2 and 3. Add tests. (Ken Takata)
Diffstat (limited to 'src/testdir')
-rw-r--r-- | src/testdir/test86.in | 48 | ||||
-rw-r--r-- | src/testdir/test86.ok | 2 | ||||
-rw-r--r-- | src/testdir/test87.in | 48 | ||||
-rw-r--r-- | src/testdir/test87.ok | 2 |
4 files changed, 100 insertions, 0 deletions
diff --git a/src/testdir/test86.in b/src/testdir/test86.in index 1309643d8..71635bda2 100644 --- a/src/testdir/test86.in +++ b/src/testdir/test86.in @@ -267,6 +267,54 @@ EOF : $put =toput : endtry :endfor +:" +:" threading +:let l = [0] +:py l=vim.bindeval('l') +:py <<EOF +import threading +import time + +class T(threading.Thread): + def __init__(self): + threading.Thread.__init__(self) + self.t = 0 + self.running = True + + def run(self): + while self.running: + self.t += 1 + time.sleep(0.1) + +t = T() +t.start() +EOF +:sleep 1 +:py t.running = False +:py t.join() +:py l[0] = t.t > 8 # check if the background thread is working +:$put =string(l) +:" +:" settrace +:let l = [] +:py l=vim.bindeval('l') +:py <<EOF +import sys + +def traceit(frame, event, arg): + global l + if event == "line": + l.extend([frame.f_lineno]) + return traceit + +def trace_main(): + for i in range(5): + pass +EOF +:py sys.settrace(traceit) +:py trace_main() +:py sys.settrace(None) +:$put =string(l) :endfun :" :call Test() diff --git a/src/testdir/test86.ok b/src/testdir/test86.ok index 5ef8689a2..3dd8d7994 100644 --- a/src/testdir/test86.ok +++ b/src/testdir/test86.ok @@ -63,3 +63,5 @@ ll:[1] {"\0": 1}: Vim(let):E859: undefined_name: Vim(let):E858: vim: Vim(let):E859: +[1] +[1, 10, 11, 10, 11, 10, 11, 10, 11, 10, 11, 10, 1] diff --git a/src/testdir/test87.in b/src/testdir/test87.in index 1d7ccedd5..5115e5be7 100644 --- a/src/testdir/test87.in +++ b/src/testdir/test87.in @@ -267,6 +267,54 @@ EOF : $put =toput : endtry :endfor +:" +:" threading +:let l = [0] +:py3 l=vim.bindeval('l') +:py3 <<EOF +import threading +import time + +class T(threading.Thread): + def __init__(self): + threading.Thread.__init__(self) + self.t = 0 + self.running = True + + def run(self): + while self.running: + self.t += 1 + time.sleep(0.1) + +t = T() +t.start() +EOF +:sleep 1 +:py3 t.running = False +:py3 t.join() +:py3 l[0] = t.t > 8 # check if the background thread is working +:$put =string(l) +:" +:" settrace +:let l = [] +:py3 l=vim.bindeval('l') +:py3 <<EOF +import sys + +def traceit(frame, event, arg): + global l + if event == "line": + l += [frame.f_lineno] + return traceit + +def trace_main(): + for i in range(5): + pass +EOF +:py3 sys.settrace(traceit) +:py3 trace_main() +:py3 sys.settrace(None) +:$put =string(l) :endfun :" :call Test() diff --git a/src/testdir/test87.ok b/src/testdir/test87.ok index 4c0bb799d..3dffa26d4 100644 --- a/src/testdir/test87.ok +++ b/src/testdir/test87.ok @@ -63,3 +63,5 @@ ll:[1] {"\0": 1}: Vim(let):E861: undefined_name: Vim(let):E860: vim: Vim(let):E861: +[1] +[1, 10, 11, 10, 11, 10, 11, 10, 11, 10, 11, 10, 1] |