diff options
author | isaacs <i@izs.me> | 2011-06-12 10:36:05 -0700 |
---|---|---|
committer | isaacs <i@izs.me> | 2011-06-13 16:11:13 -0700 |
commit | 9967c369c9272335bb0343558673b689725c6d7c (patch) | |
tree | 9dd3f51f2df4e761f5e3405c408006c0d6df9a29 /test/fixtures | |
parent | 2eb1274d6cf136a1873b0c7cd33043c8203d0676 (diff) | |
download | nodejs-9967c369c9272335bb0343558673b689725c6d7c.tar.gz nodejs-9967c369c9272335bb0343558673b689725c6d7c.tar.bz2 nodejs-9967c369c9272335bb0343558673b689725c6d7c.zip |
AMD compatibility for node, with docs and tests
Closes #1173
Closes #1170
Diffstat (limited to 'test/fixtures')
-rw-r--r-- | test/fixtures/amd-modules/extra-args.js | 3 | ||||
-rw-r--r-- | test/fixtures/amd-modules/module-exports.js | 3 | ||||
-rw-r--r-- | test/fixtures/amd-modules/object.js | 1 | ||||
-rw-r--r-- | test/fixtures/amd-modules/regular.js | 14 | ||||
-rw-r--r-- | test/fixtures/amd-modules/return.js | 3 |
5 files changed, 24 insertions, 0 deletions
diff --git a/test/fixtures/amd-modules/extra-args.js b/test/fixtures/amd-modules/extra-args.js new file mode 100644 index 000000000..a81d48c3b --- /dev/null +++ b/test/fixtures/amd-modules/extra-args.js @@ -0,0 +1,3 @@ +define(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, function(r, e, m) { + exports.ok = require("./regular.js").ok; +}); diff --git a/test/fixtures/amd-modules/module-exports.js b/test/fixtures/amd-modules/module-exports.js new file mode 100644 index 000000000..496440eed --- /dev/null +++ b/test/fixtures/amd-modules/module-exports.js @@ -0,0 +1,3 @@ +define(function(require, exports, module) { + module.exports = { ok: require("./regular.js").ok }; +}); diff --git a/test/fixtures/amd-modules/object.js b/test/fixtures/amd-modules/object.js new file mode 100644 index 000000000..93b840b61 --- /dev/null +++ b/test/fixtures/amd-modules/object.js @@ -0,0 +1 @@ +define({ ok: require("./regular.js").ok }); diff --git a/test/fixtures/amd-modules/regular.js b/test/fixtures/amd-modules/regular.js new file mode 100644 index 000000000..013a6cfd4 --- /dev/null +++ b/test/fixtures/amd-modules/regular.js @@ -0,0 +1,14 @@ +var R = require; +var E = exports; +var M = module; + +define(function(require, exports, module, nothingHere) { + if (R !== require) throw new Error("invalid require in AMD cb"); + if (E !== exports) throw new Error("invalid exports in AMD cb"); + if (M !== module) throw new Error("invalid module in AMD cb"); + if (nothingHere !== undefined) { + throw new Error("unknown args to AMD cb"); + } + + exports.ok = { ok: true }; +}); diff --git a/test/fixtures/amd-modules/return.js b/test/fixtures/amd-modules/return.js new file mode 100644 index 000000000..6ad01321c --- /dev/null +++ b/test/fixtures/amd-modules/return.js @@ -0,0 +1,3 @@ +define(function() { + return { ok: require("./regular.js").ok }; +}); |