jashkenas--coffeescript/test/importing.coffee

19 lines
429 B
CoffeeScript
Raw Normal View History

2010-12-29 05:48:54 +00:00
# Importing
# ---------
unless window? or testingBrowser?
test "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?
2010-12-29 05:48:54 +00:00
ok require(__filename).method() is magicValue
delete global[magicKey]