summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorFelix Geisendörfer <felix@debuggable.com>2010-03-08 19:02:19 +0100
committerRyan Dahl <ry@tinyclouds.org>2010-03-08 10:20:07 -0800
commit44dde5f24cf53ca1b01b5a4307dc861d53a53f4b (patch)
tree69da4a08e3e15fc0a5ed4fec970d6d00c5646d6d /test
parente898c1f2e30a05dd6a45f061468392ca44754b5f (diff)
downloadnode-new-44dde5f24cf53ca1b01b5a4307dc861d53a53f4b.tar.gz
Remove fs/path globals from test suite
It is way too easy to not notice bugs due to those modules being exported as globals while running the test suite. See: http://github.com/ry/node/issues#issue/75
Diffstat (limited to 'test')
-rw-r--r--test/common.js4
-rw-r--r--test/simple/test-chdir.js8
-rw-r--r--test/simple/test-eio-race2.js1
-rw-r--r--test/simple/test-eio-race4.js2
-rw-r--r--test/simple/test-file-read-noexist.js2
-rw-r--r--test/simple/test-file-read-stream.js2
-rw-r--r--test/simple/test-file-write-stream.js2
-rw-r--r--test/simple/test-fs-chmod.js3
-rw-r--r--test/simple/test-fs-realpath.js3
-rw-r--r--test/simple/test-fs-stat.js2
-rw-r--r--test/simple/test-fs-symlink.js3
-rw-r--r--test/simple/test-fs-write.js3
-rw-r--r--test/simple/test-ini.js3
-rw-r--r--test/simple/test-mkdir-rmdir.js2
-rw-r--r--test/simple/test-module-loading.js1
-rw-r--r--test/simple/test-readdir.js2
-rw-r--r--test/simple/test-stdio.js1
-rw-r--r--test/simple/test-stdout-flush.js1
-rw-r--r--test/simple/test-sync-fileread.js2
19 files changed, 32 insertions, 15 deletions
diff --git a/test/common.js b/test/common.js
index 6f7a4e1c77..035fe7a00b 100644
--- a/test/common.js
+++ b/test/common.js
@@ -11,6 +11,4 @@ var assert = require('assert');
var sys = require("sys");
process.mixin(exports, sys);
-exports.assert = require('assert');
-exports.fs = require("fs");
-exports.path = path;
+exports.assert = require('assert'); \ No newline at end of file
diff --git a/test/simple/test-chdir.js b/test/simple/test-chdir.js
index 1fd58ddaf6..12ade044b6 100644
--- a/test/simple/test-chdir.js
+++ b/test/simple/test-chdir.js
@@ -1,9 +1,7 @@
process.mixin(require("../common"));
-var dirname = path.dirname(__filename);
+assert.equal(true, process.cwd() !== __dirname);
-assert.equal(true, process.cwd() !== dirname);
+process.chdir(__dirname);
-process.chdir(dirname);
-
-assert.equal(true, process.cwd() === dirname);
+assert.equal(true, process.cwd() === __dirname);
diff --git a/test/simple/test-eio-race2.js b/test/simple/test-eio-race2.js
index 11f989a61a..c96aa8c473 100644
--- a/test/simple/test-eio-race2.js
+++ b/test/simple/test-eio-race2.js
@@ -1,4 +1,5 @@
process.mixin(require("../common"));
+var path = require('path');
var testTxt = path.join(fixturesDir, "x.txt");
var fs = require('fs');
diff --git a/test/simple/test-eio-race4.js b/test/simple/test-eio-race4.js
index 1792798284..f5fb65a8ee 100644
--- a/test/simple/test-eio-race4.js
+++ b/test/simple/test-eio-race4.js
@@ -1,5 +1,5 @@
process.mixin(require("../common"));
-
+var fs = require('fs');
var N = 100;
var j = 0;
diff --git a/test/simple/test-file-read-noexist.js b/test/simple/test-file-read-noexist.js
index a68c4662c6..ae162f2a97 100644
--- a/test/simple/test-file-read-noexist.js
+++ b/test/simple/test-file-read-noexist.js
@@ -1,4 +1,6 @@
process.mixin(require("../common"));
+var path = require('path');
+var fs = require('fs');
var got_error = false;
var filename = path.join(fixturesDir, "does_not_exist.txt");
diff --git a/test/simple/test-file-read-stream.js b/test/simple/test-file-read-stream.js
index 445957f6dc..ab41487090 100644
--- a/test/simple/test-file-read-stream.js
+++ b/test/simple/test-file-read-stream.js
@@ -1,6 +1,8 @@
process.mixin(require('../common'));
var
+ path = require('path'),
+ fs = require('fs'),
fn = path.join(fixturesDir, 'multipart.js'),
file = fs.createReadStream(fn),
diff --git a/test/simple/test-file-write-stream.js b/test/simple/test-file-write-stream.js
index bb74db58a2..60f693a222 100644
--- a/test/simple/test-file-write-stream.js
+++ b/test/simple/test-file-write-stream.js
@@ -1,6 +1,8 @@
process.mixin(require('../common'));
var
+ path = require('path'),
+ fs = require('fs'),
fn = path.join(fixturesDir, "write.txt"),
file = fs.createWriteStream(fn),
diff --git a/test/simple/test-fs-chmod.js b/test/simple/test-fs-chmod.js
index c4a7829b15..7b6cd52b92 100644
--- a/test/simple/test-fs-chmod.js
+++ b/test/simple/test-fs-chmod.js
@@ -1,5 +1,6 @@
process.mixin(require("../common"));
-
+var path = require('path');
+var fs = require('fs');
var got_error = false;
var success_count = 0;
diff --git a/test/simple/test-fs-realpath.js b/test/simple/test-fs-realpath.js
index d6c1c3fc89..7efb0b4509 100644
--- a/test/simple/test-fs-realpath.js
+++ b/test/simple/test-fs-realpath.js
@@ -1,5 +1,6 @@
process.mixin(require("../common"));
-
+var fs = require('fs');
+var path = require('path');
var async_completed = 0, async_expected = 0, unlink = [];
function asynctest(testBlock, args, callback, assertBlock) {
diff --git a/test/simple/test-fs-stat.js b/test/simple/test-fs-stat.js
index 088ad696a9..3f85032cef 100644
--- a/test/simple/test-fs-stat.js
+++ b/test/simple/test-fs-stat.js
@@ -1,5 +1,5 @@
process.mixin(require("../common"));
-
+var fs = require('fs');
var got_error = false;
var success_count = 0;
diff --git a/test/simple/test-fs-symlink.js b/test/simple/test-fs-symlink.js
index ac9a3ab803..79eedb90e4 100644
--- a/test/simple/test-fs-symlink.js
+++ b/test/simple/test-fs-symlink.js
@@ -1,5 +1,6 @@
process.mixin(require("../common"));
-
+var path = require('path');
+var fs = require('fs');
var completed = 0;
// test creating and reading symbolic link
diff --git a/test/simple/test-fs-write.js b/test/simple/test-fs-write.js
index d2bd1d581e..4670570ab3 100644
--- a/test/simple/test-fs-write.js
+++ b/test/simple/test-fs-write.js
@@ -1,5 +1,6 @@
process.mixin(require("../common"));
-
+var path = require('path');
+var fs = require('fs');
var fn = path.join(fixturesDir, "write.txt");
var expected = "hello";
var found;
diff --git a/test/simple/test-ini.js b/test/simple/test-ini.js
index 820bb34a3f..c9d0f8897f 100644
--- a/test/simple/test-ini.js
+++ b/test/simple/test-ini.js
@@ -1,5 +1,6 @@
process.mixin(require("../common"));
-require("fs");
+var path = require('path');
+var fs = require("fs");
parse = require("ini").parse;
debug("load fixtures/fixture.ini");
diff --git a/test/simple/test-mkdir-rmdir.js b/test/simple/test-mkdir-rmdir.js
index b19d6ac295..24e8835991 100644
--- a/test/simple/test-mkdir-rmdir.js
+++ b/test/simple/test-mkdir-rmdir.js
@@ -1,4 +1,6 @@
process.mixin(require("../common"));
+var path = require('path');
+var fs = require('fs');
var dirname = path.dirname(__filename);
var fixtures = path.join(dirname, "../fixtures");
diff --git a/test/simple/test-module-loading.js b/test/simple/test-module-loading.js
index 0c453b6d72..1d796d0324 100644
--- a/test/simple/test-module-loading.js
+++ b/test/simple/test-module-loading.js
@@ -1,4 +1,5 @@
process.mixin(require("../common"));
+var path = require('path');
debug("load test-module-loading.js");
diff --git a/test/simple/test-readdir.js b/test/simple/test-readdir.js
index c65b06d5f0..67d1151c11 100644
--- a/test/simple/test-readdir.js
+++ b/test/simple/test-readdir.js
@@ -1,4 +1,6 @@
process.mixin(require("../common"));
+var path = require('path');
+var fs = require('fs');
var got_error = false,
readdirDir = path.join(fixturesDir, "readdir")
diff --git a/test/simple/test-stdio.js b/test/simple/test-stdio.js
index e30378c868..c88774a9a2 100644
--- a/test/simple/test-stdio.js
+++ b/test/simple/test-stdio.js
@@ -1,4 +1,5 @@
process.mixin(require("../common"));
+var path = require('path');
var sub = path.join(fixturesDir, 'echo.js');
diff --git a/test/simple/test-stdout-flush.js b/test/simple/test-stdout-flush.js
index 38f61d9084..fe0273fc62 100644
--- a/test/simple/test-stdout-flush.js
+++ b/test/simple/test-stdout-flush.js
@@ -1,4 +1,5 @@
process.mixin(require("../common"));
+var path = require('path');
var sub = path.join(fixturesDir, 'print-chars.js');
diff --git a/test/simple/test-sync-fileread.js b/test/simple/test-sync-fileread.js
index adbe2e84a6..318d0621bd 100644
--- a/test/simple/test-sync-fileread.js
+++ b/test/simple/test-sync-fileread.js
@@ -1,4 +1,6 @@
process.mixin(require('../common'));
+var path = require('path');
+var fs = require('fs');
var fixture = path.join(__dirname, "../fixtures/x.txt");