@@ -37,11 +37,14 @@ function tmp(p) {
3737 return path . join ( common . tmpDir , p ) ;
3838}
3939
40- var fixturesAbsDir = common . fixturesDir ;
40+ var targetsAbsDir = path . join ( common . tmpDir , 'targets' ) ;
4141var tmpAbsDir = common . tmpDir ;
42- assert ( fixturesAbsDir !== tmpAbsDir ) ;
4342
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' ) ) ;
4548
4649function asynctest ( testBlock , args , callback , assertBlock ) {
4750 async_expected ++ ;
@@ -109,7 +112,7 @@ function test_simple_absolute_symlink(callback) {
109112 console . log ( 'using type=%s' , type ) ;
110113
111114 var entry = tmpAbsDir + '/symlink' ,
112- expected = fixturesAbsDir + '/nested-index/one' ;
115+ expected = common . fixturesDir + '/nested-index/one' ;
113116 [
114117 [ entry , expected ]
115118 ] . forEach ( function ( t ) {
@@ -133,14 +136,15 @@ function test_deep_relative_file_symlink(callback) {
133136 }
134137
135138 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 ,
138142 'nested-index' , 'one' , 'symlink1.js' ) ;
139143 try { fs . unlinkSync ( linkPath1 ) ; } catch ( e ) { }
140144 fs . symlinkSync ( linkData1 , linkPath1 , 'file' ) ;
141145
142146 var linkData2 = '../one/symlink1.js' ;
143- var entry = path . join ( common . fixturesDir ,
147+ var entry = path . join ( targetsAbsDir ,
144148 'nested-index' , 'two' , 'symlink1-b.js' ) ;
145149 try { fs . unlinkSync ( entry ) ; } catch ( e ) { }
146150 fs . symlinkSync ( linkData2 , entry , 'file' ) ;
@@ -160,14 +164,14 @@ function test_deep_relative_dir_symlink(callback) {
160164 return runNextTest ( ) ;
161165 }
162166 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 ) ;
166170 try { fs . unlinkSync ( linkPath1b ) ; } catch ( e ) { }
167171 fs . symlinkSync ( linkData1b , linkPath1b , 'dir' ) ;
168172
169173 var linkData2b = '../one/symlink1-dir' ;
170- var entry = path . join ( common . fixturesDir ,
174+ var entry = path . join ( targetsAbsDir ,
171175 'nested-index' , 'two' , 'symlink12-dir' ) ;
172176 try { fs . unlinkSync ( entry ) ; } catch ( e ) { }
173177 fs . symlinkSync ( linkData2b , entry , 'dir' ) ;
@@ -277,11 +281,11 @@ function test_deep_symlink_mix(callback) {
277281 /tmp/node-test-realpath-d1 -> $tmpDir/node-test-realpath-d2
278282 /tmp/node-test-realpath-d2/foo -> $tmpDir/node-test-realpath-f2
279283 /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)
285289 */
286290 var entry = tmp ( 'node-test-realpath-f1' ) ;
287291 try { fs . unlinkSync ( tmp ( 'node-test-realpath-d2/foo' ) ) ; } catch ( e ) { }
@@ -293,11 +297,11 @@ function test_deep_symlink_mix(callback) {
293297 [ tmp ( 'node-test-realpath-d1' ) ,
294298 common . tmpDir + '/node-test-realpath-d2' ] ,
295299 [ tmp ( 'node-test-realpath-d2/foo' ) , '../node-test-realpath-f2' ] ,
296- [ tmp ( 'node-test-realpath-f2' ) , fixturesAbsDir +
300+ [ tmp ( 'node-test-realpath-f2' ) , targetsAbsDir +
297301 '/nested-index/one/realpath-c' ] ,
298- [ fixturesAbsDir + '/nested-index/one/realpath-c' , fixturesAbsDir +
302+ [ targetsAbsDir + '/nested-index/one/realpath-c' , targetsAbsDir +
299303 '/nested-index/two/realpath-c' ] ,
300- [ fixturesAbsDir + '/nested-index/two/realpath-c' ,
304+ [ targetsAbsDir + '/nested-index/two/realpath-c' ,
301305 common . tmpDir + '/cycles/root.js' ]
302306 ] . forEach ( function ( t ) {
303307 try { fs . unlinkSync ( t [ 0 ] ) ; } catch ( e ) { }
0 commit comments