Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMaciej MaƂecki <maciej.malecki@notimplemented.org>2012-01-21 05:37:57 +0400
committerBen Noordhuis <info@bnoordhuis.nl>2012-01-21 17:37:14 +0400
commite10ed097cb3b506009ab28af4dec93402aa48693 (patch)
treee262d6ffe8b9bc20aa2c4fda1e2c85ddec49364a /test
parent56e34c2f814905a8fc3329485c64a70d59d8eeba (diff)
path fs: move `path.exists*` to `fs.exists*`
`path.exists*` functions show a deprecation warning and call functions from `fs`. They should be removed later. test: fix references to `path.exists*` in tests test fs: add test for `fs.exists` and `fs.existsSync` doc: reflect moving `path.exists*` to `fs`
Diffstat (limited to 'test')
-rw-r--r--test/simple/test-fs-exists.js42
-rw-r--r--test/simple/test-fs-mkdir.js7
-rw-r--r--test/simple/test-path.js3
3 files changed, 45 insertions, 7 deletions
diff --git a/test/simple/test-fs-exists.js b/test/simple/test-fs-exists.js
new file mode 100644
index 00000000000..cf785ccdb12
--- /dev/null
+++ b/test/simple/test-fs-exists.js
@@ -0,0 +1,42 @@
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+var assert = require('assert');
+var fs = require('fs');
+var f = __filename;
+var exists;
+var doesNotExist;
+
+fs.exists(f, function(y) {
+ exists = y;
+});
+
+fs.exists(f + '-NO', function (y) {
+ doesNotExist = y;
+});
+
+assert(fs.existsSync(f));
+assert(!fs.existsSync(f + '-NO'));
+
+process.on('exit', function () {
+ assert.strictEqual(exists, true);
+ assert.strictEqual(doesNotExist, false);
+});
diff --git a/test/simple/test-fs-mkdir.js b/test/simple/test-fs-mkdir.js
index 324c08a5f91..9d00b1e75a0 100644
--- a/test/simple/test-fs-mkdir.js
+++ b/test/simple/test-fs-mkdir.js
@@ -21,7 +21,6 @@
var common = require('../common');
var assert = require('assert');
-var path = require('path');
var fs = require('fs');
function unlink(pathname) {
@@ -39,7 +38,7 @@ function unlink(pathname) {
fs.mkdir(pathname, function(err) {
assert.equal(err, null);
- assert.equal(path.existsSync(pathname), true);
+ assert.equal(fs.existsSync(pathname), true);
ncalls++;
});
@@ -57,7 +56,7 @@ function unlink(pathname) {
fs.mkdir(pathname, 511 /*=0777*/, function(err) {
assert.equal(err, null);
- assert.equal(path.existsSync(pathname), true);
+ assert.equal(fs.existsSync(pathname), true);
ncalls++;
});
@@ -73,7 +72,7 @@ function unlink(pathname) {
unlink(pathname);
fs.mkdirSync(pathname);
- var exists = path.existsSync(pathname);
+ var exists = fs.existsSync(pathname);
unlink(pathname);
assert.equal(exists, true);
diff --git a/test/simple/test-path.js b/test/simple/test-path.js
index e16b459d924..c60230ab814 100644
--- a/test/simple/test-path.js
+++ b/test/simple/test-path.js
@@ -76,9 +76,6 @@ if (isWindows) {
'\\\\unc\\share\\foo\\bar');
}
-path.exists(f, function(y) { assert.equal(y, true) });
-
-assert.equal(path.existsSync(f), true);
assert.equal(path.extname(''), '');
assert.equal(path.extname('/path/to/file'), '');