@@ -16,102 +16,102 @@ if (!common.isWindows) {
16
16
uid = process . getuid ( ) ;
17
17
}
18
18
19
- tests [ 'fs.sync.access' ] = 'fs.writeFileSync("fs .txt", "123", "utf8");' +
20
- 'fs.accessSync("fs .txt");' +
21
- 'fs.unlinkSync("fs .txt")' ;
22
- tests [ 'fs.sync.chmod' ] = 'fs.writeFileSync("fs .txt", "123", "utf8");' +
23
- 'fs.chmodSync("fs .txt",100);' +
24
- 'fs.unlinkSync("fs .txt")' ;
25
- tests [ 'fs.sync.chown' ] = 'fs.writeFileSync("fs .txt", "123", "utf8");' +
26
- `fs.chownSync("fs .txt", ${ uid } , ${ gid } );` +
27
- 'fs.unlinkSync("fs .txt")' ;
28
- tests [ 'fs.sync.close' ] = 'fs.writeFileSync("fs .txt", "123", "utf8");' +
29
- 'fs.unlinkSync("fs .txt")' ;
30
- tests [ 'fs.sync.copyfile' ] = 'fs.writeFileSync("fs .txt", "123", "utf8");' +
31
- 'fs.copyFileSync("fs .txt","a.txt");' +
32
- 'fs.unlinkSync("fs .txt")' ;
33
- tests [ 'fs.sync.fchmod' ] = 'fs.writeFileSync("fs .txt", "123", "utf8");' +
34
- 'const fd = fs.openSync("fs .txt", "r+");' +
19
+ tests [ 'fs.sync.access' ] = 'fs.writeFileSync("fs0 .txt", "123", "utf8");' +
20
+ 'fs.accessSync("fs0 .txt");' +
21
+ 'fs.unlinkSync("fs0 .txt")' ;
22
+ tests [ 'fs.sync.chmod' ] = 'fs.writeFileSync("fs1 .txt", "123", "utf8");' +
23
+ 'fs.chmodSync("fs1 .txt",100);' +
24
+ 'fs.unlinkSync("fs1 .txt")' ;
25
+ tests [ 'fs.sync.chown' ] = 'fs.writeFileSync("fs2 .txt", "123", "utf8");' +
26
+ `fs.chownSync("fs2 .txt", ${ uid } , ${ gid } );` +
27
+ 'fs.unlinkSync("fs2 .txt")' ;
28
+ tests [ 'fs.sync.close' ] = 'fs.writeFileSync("fs3 .txt", "123", "utf8");' +
29
+ 'fs.unlinkSync("fs3 .txt")' ;
30
+ tests [ 'fs.sync.copyfile' ] = 'fs.writeFileSync("fs4 .txt", "123", "utf8");' +
31
+ 'fs.copyFileSync("fs4 .txt","a.txt");' +
32
+ 'fs.unlinkSync("fs4 .txt")' ;
33
+ tests [ 'fs.sync.fchmod' ] = 'fs.writeFileSync("fs5 .txt", "123", "utf8");' +
34
+ 'const fd = fs.openSync("fs5 .txt", "r+");' +
35
35
'fs.fchmodSync(fd,100);' +
36
- 'fs.unlinkSync("fs .txt")' ;
37
- tests [ 'fs.sync.fchown' ] = 'fs.writeFileSync("fs .txt", "123", "utf8");' +
38
- 'const fd = fs.openSync("fs .txt", "r+");' +
36
+ 'fs.unlinkSync("fs5 .txt")' ;
37
+ tests [ 'fs.sync.fchown' ] = 'fs.writeFileSync("fs6 .txt", "123", "utf8");' +
38
+ 'const fd = fs.openSync("fs6 .txt", "r+");' +
39
39
`fs.fchownSync(fd, ${ uid } , ${ gid } );` +
40
- 'fs.unlinkSync("fs .txt")' ;
41
- tests [ 'fs.sync.fdatasync' ] = 'fs.writeFileSync("fs .txt", "123", "utf8");' +
42
- 'const fd = fs.openSync("fs .txt", "r+");' +
40
+ 'fs.unlinkSync("fs6 .txt")' ;
41
+ tests [ 'fs.sync.fdatasync' ] = 'fs.writeFileSync("fs7 .txt", "123", "utf8");' +
42
+ 'const fd = fs.openSync("fs7 .txt", "r+");' +
43
43
'fs.fdatasyncSync(fd);' +
44
- 'fs.unlinkSync("fs .txt")' ;
45
- tests [ 'fs.sync.fstat' ] = 'fs.writeFileSync("fs .txt", "123", "utf8");' +
46
- 'fs.readFileSync("fs .txt");' +
47
- 'fs.unlinkSync("fs .txt")' ;
48
- tests [ 'fs.sync.fsync' ] = 'fs.writeFileSync("fs .txt", "123", "utf8");' +
49
- 'const fd = fs.openSync("fs .txt", "r+");' +
44
+ 'fs.unlinkSync("fs7 .txt")' ;
45
+ tests [ 'fs.sync.fstat' ] = 'fs.writeFileSync("fs8 .txt", "123", "utf8");' +
46
+ 'fs.readFileSync("fs8 .txt");' +
47
+ 'fs.unlinkSync("fs8 .txt")' ;
48
+ tests [ 'fs.sync.fsync' ] = 'fs.writeFileSync("fs9 .txt", "123", "utf8");' +
49
+ 'const fd = fs.openSync("fs9 .txt", "r+");' +
50
50
'fs.fsyncSync(fd);' +
51
- 'fs.unlinkSync("fs .txt")' ;
52
- tests [ 'fs.sync.ftruncate' ] = 'fs.writeFileSync("fs .txt", "123", "utf8");' +
53
- 'const fd = fs.openSync("fs .txt", "r+");' +
51
+ 'fs.unlinkSync("fs9 .txt")' ;
52
+ tests [ 'fs.sync.ftruncate' ] = 'fs.writeFileSync("fs10 .txt", "123", "utf8");' +
53
+ 'const fd = fs.openSync("fs10 .txt", "r+");' +
54
54
'fs.ftruncateSync(fd, 1);' +
55
- 'fs.unlinkSync("fs .txt")' ;
56
- tests [ 'fs.sync.futimes' ] = 'fs.writeFileSync("fs .txt", "123", "utf8");' +
57
- 'const fd = fs.openSync("fs .txt", "r+");' +
55
+ 'fs.unlinkSync("fs10 .txt")' ;
56
+ tests [ 'fs.sync.futimes' ] = 'fs.writeFileSync("fs11 .txt", "123", "utf8");' +
57
+ 'const fd = fs.openSync("fs11 .txt", "r+");' +
58
58
'fs.futimesSync(fd,1,1);' +
59
- 'fs.unlinkSync("fs .txt")' ;
60
- tests [ 'fs.sync.lchown' ] = 'fs.writeFileSync("fs .txt", "123", "utf8");' +
61
- `fs.lchownSync("fs .txt", ${ uid } , ${ gid } );` +
62
- 'fs.unlinkSync("fs .txt")' ;
63
- tests [ 'fs.sync.link' ] = 'fs.writeFileSync("fs .txt", "123", "utf8");' +
64
- 'fs.linkSync("fs .txt", "linkx ");' +
65
- 'fs.unlinkSync("linkx ");' +
66
- 'fs.unlinkSync("fs .txt")' ;
67
- tests [ 'fs.sync.lstat' ] = 'fs.writeFileSync("fs .txt", "123", "utf8");' +
68
- 'fs.lstatSync("fs .txt");' +
69
- 'fs.unlinkSync("fs .txt")' ;
70
- tests [ 'fs.sync.mkdir' ] = 'fs.mkdirSync("fstemp ");' +
71
- 'fs.rmdirSync("fstemp ")' ;
72
- tests [ 'fs.sync.mkdtemp' ] = 'const fp = fs.mkdtempSync("fstest ");' +
59
+ 'fs.unlinkSync("fs11 .txt")' ;
60
+ tests [ 'fs.sync.lchown' ] = 'fs.writeFileSync("fs12 .txt", "123", "utf8");' +
61
+ `fs.lchownSync("fs12 .txt", ${ uid } , ${ gid } );` +
62
+ 'fs.unlinkSync("fs12 .txt")' ;
63
+ tests [ 'fs.sync.link' ] = 'fs.writeFileSync("fs13 .txt", "123", "utf8");' +
64
+ 'fs.linkSync("fs13 .txt", "fs14.txt ");' +
65
+ 'fs.unlinkSync("fs13.txt ");' +
66
+ 'fs.unlinkSync("fs14 .txt")' ;
67
+ tests [ 'fs.sync.lstat' ] = 'fs.writeFileSync("fs15 .txt", "123", "utf8");' +
68
+ 'fs.lstatSync("fs15 .txt");' +
69
+ 'fs.unlinkSync("fs15 .txt")' ;
70
+ tests [ 'fs.sync.mkdir' ] = 'fs.mkdirSync("fstemp0 ");' +
71
+ 'fs.rmdirSync("fstemp0 ")' ;
72
+ tests [ 'fs.sync.mkdtemp' ] = 'const fp = fs.mkdtempSync("fstemp1 ");' +
73
73
'fs.rmdirSync(fp)' ;
74
- tests [ 'fs.sync.open' ] = 'fs.writeFileSync("fs .txt", "123", "utf8");' +
75
- 'fs.unlinkSync("fs .txt")' ;
76
- tests [ 'fs.sync.read' ] = 'fs.writeFileSync("fs .txt", "123", "utf8");' +
77
- 'fs.readFileSync("fs .txt");' +
78
- 'fs.unlinkSync("fs .txt")' ;
74
+ tests [ 'fs.sync.open' ] = 'fs.writeFileSync("fs16 .txt", "123", "utf8");' +
75
+ 'fs.unlinkSync("fs16 .txt")' ;
76
+ tests [ 'fs.sync.read' ] = 'fs.writeFileSync("fs17 .txt", "123", "utf8");' +
77
+ 'fs.readFileSync("fs17 .txt");' +
78
+ 'fs.unlinkSync("fs17 .txt")' ;
79
79
tests [ 'fs.sync.readdir' ] = 'fs.readdirSync("./")' ;
80
- tests [ 'fs.sync.realpath' ] = 'fs.writeFileSync("fs .txt", "123", "utf8");' +
81
- 'fs.linkSync("fs .txt", "linkx ");' +
82
- 'fs.realpathSync.native("linkx ");' +
83
- 'fs.unlinkSync("linkx ");' +
84
- 'fs.unlinkSync("fs .txt")' ;
85
- tests [ 'fs.sync.rename' ] = 'fs.writeFileSync("fs .txt", "123", "utf8");' +
86
- 'fs.renameSync("fs .txt","xyz .txt"); ' +
87
- 'fs.unlinkSync("xyz .txt")' ;
88
- tests [ 'fs.sync.rmdir' ] = 'fs.mkdirSync("fstemp ");' +
89
- 'fs.rmdirSync("fstemp ")' ;
90
- tests [ 'fs.sync.stat' ] = 'fs.writeFileSync("fs .txt", "123", "utf8");' +
91
- 'fs.statSync("fs .txt");' +
92
- 'fs.unlinkSync("fs .txt")' ;
93
- tests [ 'fs.sync.unlink' ] = 'fs.writeFileSync("fs .txt", "123", "utf8");' +
94
- 'fs.linkSync("fs .txt", "linkx ");' +
95
- 'fs.unlinkSync("linkx ");' +
96
- 'fs.unlinkSync("fs .txt")' ;
97
- tests [ 'fs.sync.utimes' ] = 'fs.writeFileSync("fs .txt", "123", "utf8");' +
98
- 'fs.utimesSync("fs .txt",1,1);' +
99
- 'fs.unlinkSync("fs .txt")' ;
100
- tests [ 'fs.sync.write' ] = 'fs.writeFileSync("fs .txt", "123", "utf8");' +
101
- 'fs.unlinkSync("fs .txt")' ;
80
+ tests [ 'fs.sync.realpath' ] = 'fs.writeFileSync("fs18 .txt", "123", "utf8");' +
81
+ 'fs.linkSync("fs18 .txt", "fs19.txt ");' +
82
+ 'fs.realpathSync.native("fs19.txt ");' +
83
+ 'fs.unlinkSync("fs18.txt ");' +
84
+ 'fs.unlinkSync("fs19 .txt")' ;
85
+ tests [ 'fs.sync.rename' ] = 'fs.writeFileSync("fs20 .txt", "123", "utf8");' +
86
+ 'fs.renameSync("fs20 .txt","fs21 .txt"); ' +
87
+ 'fs.unlinkSync("fs21 .txt")' ;
88
+ tests [ 'fs.sync.rmdir' ] = 'fs.mkdirSync("fstemp2 ");' +
89
+ 'fs.rmdirSync("fstemp2 ")' ;
90
+ tests [ 'fs.sync.stat' ] = 'fs.writeFileSync("fs22 .txt", "123", "utf8");' +
91
+ 'fs.statSync("fs22 .txt");' +
92
+ 'fs.unlinkSync("fs22 .txt")' ;
93
+ tests [ 'fs.sync.unlink' ] = 'fs.writeFileSync("fs23 .txt", "123", "utf8");' +
94
+ 'fs.linkSync("fs23 .txt", "fs24.txt ");' +
95
+ 'fs.unlinkSync("fs23.txt ");' +
96
+ 'fs.unlinkSync("fs24 .txt")' ;
97
+ tests [ 'fs.sync.utimes' ] = 'fs.writeFileSync("fs25 .txt", "123", "utf8");' +
98
+ 'fs.utimesSync("fs25 .txt",1,1);' +
99
+ 'fs.unlinkSync("fs25 .txt")' ;
100
+ tests [ 'fs.sync.write' ] = 'fs.writeFileSync("fs26 .txt", "123", "utf8");' +
101
+ 'fs.unlinkSync("fs26 .txt")' ;
102
102
103
103
// On windows, we need permissions to test symlink and readlink.
104
104
// We'll only try to run these tests if we have enough privileges.
105
105
if ( common . canCreateSymLink ( ) ) {
106
- tests [ 'fs.sync.symlink' ] = 'fs.writeFileSync("fs .txt", "123", "utf8");' +
107
- 'fs.symlinkSync("fs .txt", "linkx ");' +
108
- 'fs.unlinkSync("linkx ");' +
109
- 'fs.unlinkSync("fs .txt")' ;
110
- tests [ 'fs.sync.readlink' ] = 'fs.writeFileSync("fs .txt", "123", "utf8");' +
111
- 'fs.symlinkSync("fs .txt", "linkx ");' +
112
- 'fs.readlinkSync("linkx ");' +
113
- 'fs.unlinkSync("linkx ");' +
114
- 'fs.unlinkSync("fs .txt")' ;
106
+ tests [ 'fs.sync.symlink' ] = 'fs.writeFileSync("fs27 .txt", "123", "utf8");' +
107
+ 'fs.symlinkSync("fs27 .txt", "fs28.txt ");' +
108
+ 'fs.unlinkSync("fs27.txt ");' +
109
+ 'fs.unlinkSync("fs28 .txt")' ;
110
+ tests [ 'fs.sync.readlink' ] = 'fs.writeFileSync("fs29 .txt", "123", "utf8");' +
111
+ 'fs.symlinkSync("fs29 .txt", "fs30.txt ");' +
112
+ 'fs.readlinkSync("fs30.txt ");' +
113
+ 'fs.unlinkSync("fs29.txt ");' +
114
+ 'fs.unlinkSync("fs30 .txt")' ;
115
115
}
116
116
117
117
const tmpdir = require ( '../common/tmpdir' ) ;
0 commit comments