This commit is contained in:
Jeremy Ashkenas
2013-04-06 09:31:30 +08:00
15 changed files with 162 additions and 37 deletions

View File

@@ -76,3 +76,6 @@ test "#1055: invalid keys in real (but not work-product) objects", ->
test "#1066: interpolated strings are not implicit functions", ->
cantCompile '"int#{er}polated" arg'
test "#2846: while with empty body", ->
CoffeeScript.compile 'while 1 then', {sourceMap: true}

View File

@@ -1,5 +1,7 @@
return if global.testingBrowser
fs = require 'fs'
# REPL
# ----
Stream = require 'stream'
@@ -25,16 +27,23 @@ class MockOutputStream extends Stream
lastWrite: (fromEnd = -1) ->
@written[@written.length - 1 + fromEnd].replace /\n$/, ''
# Create a dummy history file
historyFile = '.coffee_history_test'
fs.writeFileSync historyFile, '1 + 2\n'
testRepl = (desc, fn) ->
input = new MockInputStream
output = new MockOutputStream
Repl.start {input, output}
test desc, -> fn input, output
repl = Repl.start {input, output, historyFile}
test desc, -> fn input, output, repl
ctrlV = { ctrl: true, name: 'v'}
testRepl 'reads history file', (input, output, repl) ->
input.emitLine repl.rli.history[0]
eq '3', output.lastWrite()
testRepl "starts with coffee prompt", (input, output) ->
eq 'coffee> ', output.lastWrite(0)
@@ -97,3 +106,6 @@ testRepl "keeps running after runtime error", (input, output) ->
eq 0, output.lastWrite().indexOf 'ReferenceError: b is not defined'
input.emitLine 'a'
eq 'undefined', output.lastWrite()
process.on 'exit', ->
fs.unlinkSync historyFile

View File

@@ -112,6 +112,8 @@
'soaks'
'strings'
]
# allow utf-8 chars in comments
# 智に働けば角が立つ情に掉させば流される
</script>
</body>