forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-regress-GH-3739.js
More file actions
45 lines (40 loc) · 839 Bytes
/
test-regress-GH-3739.js
File metadata and controls
45 lines (40 loc) · 839 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
var common = require('../common'),
assert = require('assert'),
fs = require('fs'),
path = require('path');
var dir = path.resolve(common.fixturesDir),
dirs = [];
// Make a long path.
for (var i = 0; i < 50; i++) {
dir = dir + '/123456790';
try {
fs.mkdirSync(dir, '0777');
} catch (e) {
if (e.code == 'EEXIST') {
// Ignore;
} else {
cleanup();
throw e;
}
}
dirs.push(dir);
}
// Test existsSync
var r = common.fileExists(dir);
if (r !== true) {
cleanup();
throw new Error('fs.accessSync returned false');
}
// Text exists
fs.access(dir, function(err) {
cleanup();
if (err) {
throw new Error('fs.access reported false');
}
});
// Remove all created directories
function cleanup() {
for (var i = dirs.length - 1; i >= 0; i--) {
fs.rmdirSync(dirs[i]);
}
}