Add test for .coffee.md loading

This commit is contained in:
Sam Gentle
2013-05-25 22:51:54 +10:00
parent 088b8b3ec5
commit 9b1bdd4b36
2 changed files with 19 additions and 1 deletions

View File

@@ -224,7 +224,7 @@ runTests = (CoffeeScript) ->
# Run every test in the `test` folder, recording failures.
files = fs.readdirSync 'test'
for file in files when file.match /\.(lit)?coffee$/i
for file in files when file.match(/\.(lit)?coffee$/i) or file.match(/\.coffee\.md$/i)
literate = helpers.isLiterate file
currentFile = filename = path.join 'test', file
code = fs.readFileSync filename

18
test/importing.coffee.md Normal file
View File

@@ -0,0 +1,18 @@
Importing
---------
unless window? or testingBrowser?
test "literate coffeescript modules can be imported and executed", ->
magicKey = __filename
magicValue = 0xFFFF
if global[magicKey]?
if exports?
local = magicValue
exports.method = -> local
else
global[magicKey] = {}
if require?.extensions?
ok require(__filename).method() is magicValue
delete global[magicKey]