mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-05-03 03:00:14 -04:00
Merge branch 'master' of https://github.com/jashkenas/coffee-script
This commit is contained in:
@@ -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}
|
||||
@@ -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
|
||||
|
||||
@@ -112,6 +112,8 @@
|
||||
'soaks'
|
||||
'strings'
|
||||
]
|
||||
# allow utf-8 chars in comments
|
||||
# 智に働けば角が立つ、情に掉させば流される。
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user