From c16508c87ad86fd55fc5317efd89c92f90341603 Mon Sep 17 00:00:00 2001 From: Herbert Vojcik Date: Thu, 8 Apr 2010 16:15:56 +0200 Subject: [PATCH] Better require.async throw test --- test/fixtures/throws_error1.js | 1 + test/simple/test-module-loading.js | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 test/fixtures/throws_error1.js diff --git a/test/fixtures/throws_error1.js b/test/fixtures/throws_error1.js new file mode 100644 index 00000000000..728ece555f5 --- /dev/null +++ b/test/fixtures/throws_error1.js @@ -0,0 +1 @@ +throw new Error("blah"); diff --git a/test/simple/test-module-loading.js b/test/simple/test-module-loading.js index 56515b8850c..460c7942677 100644 --- a/test/simple/test-module-loading.js +++ b/test/simple/test-module-loading.js @@ -56,6 +56,14 @@ try { assert.equal("blah", e.message); } +var errorThrownAsync = false; +require.async("../fixtures/throws_error1", function(err, a) { + if (err) { + errorThrownAsync = true; + assert.equal("blah", err.message); + } +}); + assert.equal(require('path').dirname(__filename), __dirname); var asyncRun = false; @@ -103,5 +111,7 @@ process.addListener("exit", function () { assert.equal(true, asyncRun); + assert.equal(true, errorThrownAsync); + puts("exit"); });