Skip to content

Commit

Permalink
fix channel_test: use \n as a delimiter
Browse files Browse the repository at this point in the history
  • Loading branch information
haya14busa committed Aug 23, 2016
1 parent eaa2ad1 commit e140240
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/testdir/test_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ def handle(self):
print("received: {0}".format(received))

# We may receive two messages at once. Take the part up to the
# matching "]" (recognized by finding "][").
# matching "]" (recognized by finding "\n" as a delimiter).
todo = received
while todo != '':
splitidx = todo.find('][')
splitidx = todo.find('\n')
if splitidx < 0:
used = todo
todo = ''
Expand Down Expand Up @@ -202,6 +202,10 @@ def handle(self):
elif decoded[1] == 'wait a bit':
time.sleep(0.2)
response = "waited"
elif decoded[1] == 'contains `][`':
response = "ok"
elif decoded[1] == 'contains `\n`':
response = "ok"
elif decoded[1] == '!quit!':
# we're done
self.server.shutdown()
Expand Down
6 changes: 6 additions & 0 deletions src/testdir/test_channel.vim
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,12 @@ func Ch_communicate(port)
call assert_equal(type(11), type(resp[0]))
call assert_equal('waited', resp[1])

" contains `][`
call assert_equal('ok', ch_evalexpr(handle, 'contains `][`'))

" contains \n
call assert_equal('ok', ch_evalexpr(handle, "contains `\n`"))

" make the server quit, can't check if this works, should not hang.
call ch_sendexpr(handle, '!quit!')
endfunc
Expand Down

0 comments on commit e140240

Please sign in to comment.