Mercurial > vim
annotate src/testdir/test_channel_pipe.py @ 23179:821701ecbde7 v8.2.2135
patch 8.2.2135: Vim9: #{ still seen as start of dict in some places
Commit: https://github.com/vim/vim/commit/93f82cbee515e13b564f51ddcd5e3d6694358ba4
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Dec 12 21:25:56 2020 +0100
patch 8.2.2135: Vim9: #{ still seen as start of dict in some places
Problem: Vim9: #{ still seen as start of dict in some places.
Solution: Remove check for { after #. (closes https://github.com/vim/vim/issues/7456)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 12 Dec 2020 21:30:03 +0100 |
parents | 62c209f02b04 |
children | 06e3c6bac36d |
rev | line source |
---|---|
8031
ece323e2b57f
commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 #!/usr/bin/python |
ece323e2b57f
commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 # |
ece323e2b57f
commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 # Server that will communicate over stdin/stderr |
ece323e2b57f
commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 # |
ece323e2b57f
commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 # This requires Python 2.6 or later. |
ece323e2b57f
commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 |
ece323e2b57f
commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 from __future__ import print_function |
ece323e2b57f
commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 import sys |
9238
7d13d180a6ae
commit https://github.com/vim/vim/commit/bbe8d91e695184771d7e45315258fab8eb3e6b07
Christian Brabandt <cb@256bit.org>
parents:
9003
diff
changeset
|
9 import time |
8031
ece323e2b57f
commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 |
ece323e2b57f
commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 if __name__ == "__main__": |
ece323e2b57f
commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 |
ece323e2b57f
commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 if len(sys.argv) > 1: |
8455
d0717262d802
commit https://github.com/vim/vim/commit/f65333c9b59654a70f2a07200f65c93dfcaa49b3
Christian Brabandt <cb@256bit.org>
parents:
8447
diff
changeset
|
14 if sys.argv[1].startswith("err"): |
d0717262d802
commit https://github.com/vim/vim/commit/f65333c9b59654a70f2a07200f65c93dfcaa49b3
Christian Brabandt <cb@256bit.org>
parents:
8447
diff
changeset
|
15 print(sys.argv[1], file=sys.stderr) |
d0717262d802
commit https://github.com/vim/vim/commit/f65333c9b59654a70f2a07200f65c93dfcaa49b3
Christian Brabandt <cb@256bit.org>
parents:
8447
diff
changeset
|
16 sys.stderr.flush() |
13010
c522585ce88d
patch 8.0.1381: ch_readraw() waits for NL if channel mode is NL
Christian Brabandt <cb@256bit.org>
parents:
10845
diff
changeset
|
17 elif sys.argv[1].startswith("incomplete"): |
c522585ce88d
patch 8.0.1381: ch_readraw() waits for NL if channel mode is NL
Christian Brabandt <cb@256bit.org>
parents:
10845
diff
changeset
|
18 print(sys.argv[1], end='') |
c522585ce88d
patch 8.0.1381: ch_readraw() waits for NL if channel mode is NL
Christian Brabandt <cb@256bit.org>
parents:
10845
diff
changeset
|
19 sys.stdout.flush() |
c522585ce88d
patch 8.0.1381: ch_readraw() waits for NL if channel mode is NL
Christian Brabandt <cb@256bit.org>
parents:
10845
diff
changeset
|
20 sys.exit(0) |
15764
208bf8b36075
patch 8.1.0889: MS-Windows: a channel write may hang
Bram Moolenaar <Bram@vim.org>
parents:
15621
diff
changeset
|
21 elif sys.argv[1].startswith("busy"): |
208bf8b36075
patch 8.1.0889: MS-Windows: a channel write may hang
Bram Moolenaar <Bram@vim.org>
parents:
15621
diff
changeset
|
22 time.sleep(100) |
208bf8b36075
patch 8.1.0889: MS-Windows: a channel write may hang
Bram Moolenaar <Bram@vim.org>
parents:
15621
diff
changeset
|
23 sys.exit(0) |
8455
d0717262d802
commit https://github.com/vim/vim/commit/f65333c9b59654a70f2a07200f65c93dfcaa49b3
Christian Brabandt <cb@256bit.org>
parents:
8447
diff
changeset
|
24 else: |
d0717262d802
commit https://github.com/vim/vim/commit/f65333c9b59654a70f2a07200f65c93dfcaa49b3
Christian Brabandt <cb@256bit.org>
parents:
8447
diff
changeset
|
25 print(sys.argv[1]) |
d0717262d802
commit https://github.com/vim/vim/commit/f65333c9b59654a70f2a07200f65c93dfcaa49b3
Christian Brabandt <cb@256bit.org>
parents:
8447
diff
changeset
|
26 sys.stdout.flush() |
9003
072556995a8e
commit https://github.com/vim/vim/commit/b2658a1ab02cd0ba848164f70c7c464fdc398162
Christian Brabandt <cb@256bit.org>
parents:
8455
diff
changeset
|
27 if sys.argv[1].startswith("quit"): |
072556995a8e
commit https://github.com/vim/vim/commit/b2658a1ab02cd0ba848164f70c7c464fdc398162
Christian Brabandt <cb@256bit.org>
parents:
8455
diff
changeset
|
28 sys.exit(0) |
8031
ece323e2b57f
commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 |
ece323e2b57f
commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 while True: |
ece323e2b57f
commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 typed = sys.stdin.readline() |
20293
62c209f02b04
patch 8.2.0702: running channel tests may leave running process behind
Bram Moolenaar <Bram@vim.org>
parents:
15764
diff
changeset
|
32 if typed == "": # EOF -- stop |
62c209f02b04
patch 8.2.0702: running channel tests may leave running process behind
Bram Moolenaar <Bram@vim.org>
parents:
15764
diff
changeset
|
33 break |
8031
ece323e2b57f
commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 if typed.startswith("quit"): |
ece323e2b57f
commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 print("Goodbye!") |
ece323e2b57f
commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 sys.stdout.flush() |
ece323e2b57f
commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
37 break |
8384
764dba33605c
commit https://github.com/vim/vim/commit/c25558bff4ed10d2642e6f5c016701641c494916
Christian Brabandt <cb@256bit.org>
parents:
8084
diff
changeset
|
38 if typed.startswith("echo "): |
8031
ece323e2b57f
commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
39 print(typed[5:-1]) |
ece323e2b57f
commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
40 sys.stdout.flush() |
10845
c31782d57569
patch 8.0.0312: failure when a channel receives a split json message
Christian Brabandt <cb@256bit.org>
parents:
9238
diff
changeset
|
41 if typed.startswith("echosplit "): |
c31782d57569
patch 8.0.0312: failure when a channel receives a split json message
Christian Brabandt <cb@256bit.org>
parents:
9238
diff
changeset
|
42 for part in typed[10:-1].split('|'): |
c31782d57569
patch 8.0.0312: failure when a channel receives a split json message
Christian Brabandt <cb@256bit.org>
parents:
9238
diff
changeset
|
43 sys.stdout.write(part) |
c31782d57569
patch 8.0.0312: failure when a channel receives a split json message
Christian Brabandt <cb@256bit.org>
parents:
9238
diff
changeset
|
44 sys.stdout.flush() |
c31782d57569
patch 8.0.0312: failure when a channel receives a split json message
Christian Brabandt <cb@256bit.org>
parents:
9238
diff
changeset
|
45 time.sleep(0.05) |
8447
6f26b680c243
commit https://github.com/vim/vim/commit/e98d12105213975f37b8d653bd909bd787a2cda9
Christian Brabandt <cb@256bit.org>
parents:
8384
diff
changeset
|
46 if typed.startswith("double "): |
6f26b680c243
commit https://github.com/vim/vim/commit/e98d12105213975f37b8d653bd909bd787a2cda9
Christian Brabandt <cb@256bit.org>
parents:
8384
diff
changeset
|
47 print(typed[7:-1] + "\nAND " + typed[7:-1]) |
6f26b680c243
commit https://github.com/vim/vim/commit/e98d12105213975f37b8d653bd909bd787a2cda9
Christian Brabandt <cb@256bit.org>
parents:
8384
diff
changeset
|
48 sys.stdout.flush() |
9238
7d13d180a6ae
commit https://github.com/vim/vim/commit/bbe8d91e695184771d7e45315258fab8eb3e6b07
Christian Brabandt <cb@256bit.org>
parents:
9003
diff
changeset
|
49 if typed.startswith("split "): |
7d13d180a6ae
commit https://github.com/vim/vim/commit/bbe8d91e695184771d7e45315258fab8eb3e6b07
Christian Brabandt <cb@256bit.org>
parents:
9003
diff
changeset
|
50 print(typed[6:-1], end='') |
7d13d180a6ae
commit https://github.com/vim/vim/commit/bbe8d91e695184771d7e45315258fab8eb3e6b07
Christian Brabandt <cb@256bit.org>
parents:
9003
diff
changeset
|
51 sys.stdout.flush() |
7d13d180a6ae
commit https://github.com/vim/vim/commit/bbe8d91e695184771d7e45315258fab8eb3e6b07
Christian Brabandt <cb@256bit.org>
parents:
9003
diff
changeset
|
52 time.sleep(0.05) |
7d13d180a6ae
commit https://github.com/vim/vim/commit/bbe8d91e695184771d7e45315258fab8eb3e6b07
Christian Brabandt <cb@256bit.org>
parents:
9003
diff
changeset
|
53 print(typed[6:-1], end='') |
7d13d180a6ae
commit https://github.com/vim/vim/commit/bbe8d91e695184771d7e45315258fab8eb3e6b07
Christian Brabandt <cb@256bit.org>
parents:
9003
diff
changeset
|
54 sys.stdout.flush() |
7d13d180a6ae
commit https://github.com/vim/vim/commit/bbe8d91e695184771d7e45315258fab8eb3e6b07
Christian Brabandt <cb@256bit.org>
parents:
9003
diff
changeset
|
55 time.sleep(0.05) |
7d13d180a6ae
commit https://github.com/vim/vim/commit/bbe8d91e695184771d7e45315258fab8eb3e6b07
Christian Brabandt <cb@256bit.org>
parents:
9003
diff
changeset
|
56 print(typed[6:-1]) |
7d13d180a6ae
commit https://github.com/vim/vim/commit/bbe8d91e695184771d7e45315258fab8eb3e6b07
Christian Brabandt <cb@256bit.org>
parents:
9003
diff
changeset
|
57 sys.stdout.flush() |
8447
6f26b680c243
commit https://github.com/vim/vim/commit/e98d12105213975f37b8d653bd909bd787a2cda9
Christian Brabandt <cb@256bit.org>
parents:
8384
diff
changeset
|
58 if typed.startswith("echoerr "): |
8384
764dba33605c
commit https://github.com/vim/vim/commit/c25558bff4ed10d2642e6f5c016701641c494916
Christian Brabandt <cb@256bit.org>
parents:
8084
diff
changeset
|
59 print(typed[8:-1], file=sys.stderr) |
764dba33605c
commit https://github.com/vim/vim/commit/c25558bff4ed10d2642e6f5c016701641c494916
Christian Brabandt <cb@256bit.org>
parents:
8084
diff
changeset
|
60 sys.stderr.flush() |
8447
6f26b680c243
commit https://github.com/vim/vim/commit/e98d12105213975f37b8d653bd909bd787a2cda9
Christian Brabandt <cb@256bit.org>
parents:
8384
diff
changeset
|
61 if typed.startswith("doubleerr "): |
6f26b680c243
commit https://github.com/vim/vim/commit/e98d12105213975f37b8d653bd909bd787a2cda9
Christian Brabandt <cb@256bit.org>
parents:
8384
diff
changeset
|
62 print(typed[10:-1] + "\nAND " + typed[10:-1], file=sys.stderr) |
6f26b680c243
commit https://github.com/vim/vim/commit/e98d12105213975f37b8d653bd909bd787a2cda9
Christian Brabandt <cb@256bit.org>
parents:
8384
diff
changeset
|
63 sys.stderr.flush() |
15621
bfbdef46aa7d
patch 8.1.0818: MS-Windows: cannot send large data with ch_sendraw()
Bram Moolenaar <Bram@vim.org>
parents:
13010
diff
changeset
|
64 if typed.startswith("XXX"): |
bfbdef46aa7d
patch 8.1.0818: MS-Windows: cannot send large data with ch_sendraw()
Bram Moolenaar <Bram@vim.org>
parents:
13010
diff
changeset
|
65 print(typed, end='') |
bfbdef46aa7d
patch 8.1.0818: MS-Windows: cannot send large data with ch_sendraw()
Bram Moolenaar <Bram@vim.org>
parents:
13010
diff
changeset
|
66 sys.stderr.flush() |
bfbdef46aa7d
patch 8.1.0818: MS-Windows: cannot send large data with ch_sendraw()
Bram Moolenaar <Bram@vim.org>
parents:
13010
diff
changeset
|
67 break |
8031
ece323e2b57f
commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
68 |