mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 12:19:12 +00:00
REPL unblock event loop AND fix REPL setTimeout fire problems
This commit is contained in:
parent
89096c9210
commit
09aa9b9698
3 changed files with 26 additions and 10 deletions
|
@ -86,6 +86,19 @@ class Repl(object):
|
|||
assertEqual(err, '')
|
||||
assertEqual(code, 0)
|
||||
|
||||
def test_set_timeout(self):
|
||||
# Special treatment
|
||||
p = Popen([self.deno_exe], stdout=PIPE, stderr=PIPE, stdin=PIPE)
|
||||
# Print after 0.1 second
|
||||
p.stdin.write(
|
||||
"setTimeout(() => console.log('HI'), 100)\n".encode("utf-8"))
|
||||
sleep(0.2) # Wait 0.2 second before proceed
|
||||
out, err = p.communicate()
|
||||
code = p.poll()
|
||||
assertEqual(out.replace('\r\n', '\n'), '1\nHI\n')
|
||||
assertEqual(err.replace('\r\n', '\n'), '')
|
||||
assertEqual(code, 0)
|
||||
|
||||
def test_exit_command(self):
|
||||
out, err, code = self.input(".exit", "'ignored'", exit=False)
|
||||
assertEqual(out, '')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue