Name: js-handler/node_modules/nodeunit/node_modules/tap/test/expose-gc-test.js
| 1: | var tap = require("../") |
| 2: | , fs = require("fs") |
| 3: | , cp = require("child_process") |
| 4: | |
| 5: | fs.writeFileSync("gc-script.js", "console.log(!!global.gc)", "utf8") |
| 6: | |
| 7: | tap.test("gc test when the gc isn't there", function (t) { |
| 8: | console.error("gc test") |
| 9: | t.plan(1) |
| 10: | console.error("t.plan="+t._plan) |
| 11: | |
| 12: | cp.exec("../bin/tap.js ./gc-script", function (err, stdo, stde) { |
| 13: | console.error("assert gc does not exist") |
| 14: | t.ok("false", stdo) |
| 15: | }) |
| 16: | }) |
| 17: | |
| 18: | tap.test("gc test when the gc should be there", function (t) { |
| 19: | console.error("gc test") |
| 20: | t.plan(2) |
| 21: | console.error("t.plan="+t._plan) |
| 22: | |
| 23: | t.test("test for gc using --gc", function (t) { |
| 24: | console.error("gc test using --gc") |
| 25: | t.plan(1) |
| 26: | console.error("t.plan="+t._plan) |
| 27: | |
| 28: | cp.exec("../bin/tap.js --gc ./gc-script", function (err, stdo, stde) { |
| 29: | console.error("assert gc exists") |
| 30: | t.ok("true", stdo) |
| 31: | }) |
| 32: | }) |
| 33: | |
| 34: | t.test("test for gc using --expose-gc", function (t) { |
| 35: | console.error("gc test using --expose-gc") |
| 36: | t.plan(1) |
| 37: | console.error("t.plan="+t._plan) |
| 38: | |
| 39: | cp.exec("../bin/tap.js --expose-gc ./gc-script", function (err, stdo) { |
| 40: | console.error("assert gc exists") |
| 41: | t.ok("true", stdo) |
| 42: | }) |
| 43: | }) |
| 44: | }) |
| 45: | |
| 46: | fs.unlinkSync("gc-script.js"); |
