@@ -37,11 +37,14 @@ function tmp(p) {
37
37
return path . join ( common . tmpDir , p ) ;
38
38
}
39
39
40
- var fixturesAbsDir = common . fixturesDir ;
40
+ var targetsAbsDir = path . join ( common . tmpDir , 'targets' ) ;
41
41
var tmpAbsDir = common . tmpDir ;
42
- assert ( fixturesAbsDir !== tmpAbsDir ) ;
43
42
44
- console . error ( 'absolutes\n%s\n%s' , fixturesAbsDir , tmpAbsDir ) ;
43
+ // Set up targetsAbsDir and expected subdirectories
44
+ fs . mkdirSync ( targetsAbsDir ) ;
45
+ fs . mkdirSync ( path . join ( targetsAbsDir , 'nested-index' ) ) ;
46
+ fs . mkdirSync ( path . join ( targetsAbsDir , 'nested-index' , 'one' ) ) ;
47
+ fs . mkdirSync ( path . join ( targetsAbsDir , 'nested-index' , 'two' ) ) ;
45
48
46
49
function asynctest ( testBlock , args , callback , assertBlock ) {
47
50
async_expected ++ ;
@@ -109,7 +112,7 @@ function test_simple_absolute_symlink(callback) {
109
112
console . log ( 'using type=%s' , type ) ;
110
113
111
114
var entry = tmpAbsDir + '/symlink' ,
112
- expected = fixturesAbsDir + '/nested-index/one' ;
115
+ expected = common . fixturesDir + '/nested-index/one' ;
113
116
[
114
117
[ entry , expected ]
115
118
] . forEach ( function ( t ) {
@@ -133,14 +136,15 @@ function test_deep_relative_file_symlink(callback) {
133
136
}
134
137
135
138
var expected = path . join ( common . fixturesDir , 'cycles' , 'root.js' ) ;
136
- var linkData1 = '../../cycles/root.js' ;
137
- var linkPath1 = path . join ( common . fixturesDir ,
139
+ var linkData1 = path . relative ( path . join ( targetsAbsDir , 'nested-index' , 'one' ) ,
140
+ expected ) ;
141
+ var linkPath1 = path . join ( targetsAbsDir ,
138
142
'nested-index' , 'one' , 'symlink1.js' ) ;
139
143
try { fs . unlinkSync ( linkPath1 ) ; } catch ( e ) { }
140
144
fs . symlinkSync ( linkData1 , linkPath1 , 'file' ) ;
141
145
142
146
var linkData2 = '../one/symlink1.js' ;
143
- var entry = path . join ( common . fixturesDir ,
147
+ var entry = path . join ( targetsAbsDir ,
144
148
'nested-index' , 'two' , 'symlink1-b.js' ) ;
145
149
try { fs . unlinkSync ( entry ) ; } catch ( e ) { }
146
150
fs . symlinkSync ( linkData2 , entry , 'file' ) ;
@@ -160,14 +164,14 @@ function test_deep_relative_dir_symlink(callback) {
160
164
return runNextTest ( ) ;
161
165
}
162
166
var expected = path . join ( common . fixturesDir , 'cycles' , 'folder' ) ;
163
- var linkData1b = '../../cycles/folder' ;
164
- var linkPath1b = path . join ( common . fixturesDir ,
165
- 'nested-index' , 'one' , 'symlink1-dir' ) ;
167
+ var path1b = path . join ( targetsAbsDir , 'nested-index' , 'one' ) ;
168
+ var linkPath1b = path . join ( path1b , 'symlink1-dir' ) ;
169
+ var linkData1b = path . relative ( path1b , expected ) ;
166
170
try { fs . unlinkSync ( linkPath1b ) ; } catch ( e ) { }
167
171
fs . symlinkSync ( linkData1b , linkPath1b , 'dir' ) ;
168
172
169
173
var linkData2b = '../one/symlink1-dir' ;
170
- var entry = path . join ( common . fixturesDir ,
174
+ var entry = path . join ( targetsAbsDir ,
171
175
'nested-index' , 'two' , 'symlink12-dir' ) ;
172
176
try { fs . unlinkSync ( entry ) ; } catch ( e ) { }
173
177
fs . symlinkSync ( linkData2b , entry , 'dir' ) ;
@@ -277,11 +281,11 @@ function test_deep_symlink_mix(callback) {
277
281
/tmp/node-test-realpath-d1 -> $tmpDir/node-test-realpath-d2
278
282
/tmp/node-test-realpath-d2/foo -> $tmpDir/node-test-realpath-f2
279
283
/tmp/node-test-realpath-f2
280
- -> /node/test/fixtures /nested-index/one/realpath-c
281
- /node/test/fixtures /nested-index/one/realpath-c
282
- -> /node/test/fixtures /nested-index/two/realpath-c
283
- /node/test/fixtures /nested-index/two/realpath-c -> $tmpDir/cycles/root.js
284
- /node/test/fixtures /cycles/root.js (hard)
284
+ -> $tmpDir/targets /nested-index/one/realpath-c
285
+ $tmpDir/targets /nested-index/one/realpath-c
286
+ -> $tmpDir/targets /nested-index/two/realpath-c
287
+ $tmpDir/targets /nested-index/two/realpath-c -> $tmpDir/cycles/root.js
288
+ $tmpDir/targets /cycles/root.js (hard)
285
289
*/
286
290
var entry = tmp ( 'node-test-realpath-f1' ) ;
287
291
try { fs . unlinkSync ( tmp ( 'node-test-realpath-d2/foo' ) ) ; } catch ( e ) { }
@@ -293,11 +297,11 @@ function test_deep_symlink_mix(callback) {
293
297
[ tmp ( 'node-test-realpath-d1' ) ,
294
298
common . tmpDir + '/node-test-realpath-d2' ] ,
295
299
[ tmp ( 'node-test-realpath-d2/foo' ) , '../node-test-realpath-f2' ] ,
296
- [ tmp ( 'node-test-realpath-f2' ) , fixturesAbsDir +
300
+ [ tmp ( 'node-test-realpath-f2' ) , targetsAbsDir +
297
301
'/nested-index/one/realpath-c' ] ,
298
- [ fixturesAbsDir + '/nested-index/one/realpath-c' , fixturesAbsDir +
302
+ [ targetsAbsDir + '/nested-index/one/realpath-c' , targetsAbsDir +
299
303
'/nested-index/two/realpath-c' ] ,
300
- [ fixturesAbsDir + '/nested-index/two/realpath-c' ,
304
+ [ targetsAbsDir + '/nested-index/two/realpath-c' ,
301
305
common . tmpDir + '/cycles/root.js' ]
302
306
] . forEach ( function ( t ) {
303
307
try { fs . unlinkSync ( t [ 0 ] ) ; } catch ( e ) { }
0 commit comments