jashkenas--coffeescript/test/importing.coffee

19 lines
429 B
CoffeeScript

# 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?
ok require(__filename).method() is magicValue
delete global[magicKey]