From 119ec16e5ec913d0e86a7947734a55ca40e5fd13 Mon Sep 17 00:00:00 2001 From: Demian Ferreiro Date: Mon, 11 Mar 2013 20:16:48 -0300 Subject: [PATCH] Add REPL scoping tests --- test/repl.coffee | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/repl.coffee b/test/repl.coffee index 25877cee..b48def74 100644 --- a/test/repl.coffee +++ b/test/repl.coffee @@ -80,3 +80,14 @@ testRepl "evaluates multiline", (input, output) -> input.emitLine ' 1 + 1' input.emit 'keypress', null, ctrlV eq '2', output.lastWrite() + +testRepl "variables in scope are preserved", (input, output) -> + input.emitLine 'a = 1' + input.emitLine 'do -> a = 2' + input.emitLine 'a' + eq '2', output.lastWrite() + +testRepl "existencial assignment of previously declared variable", (input, output) -> + input.emitLine 'a = null' + input.emitLine 'a ?= 42' + eq '42', output.lastWrite() \ No newline at end of file