mirror of https://github.com/lukechilds/node.git
Browse Source
PR-URL: https://github.com/nodejs/io.js/pull/2013 Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>v2.3.1-release
committed by
Rod Vagg
2 changed files with 17 additions and 11 deletions
@ -1,17 +1,23 @@ |
|||||
'use strict'; |
'use strict'; |
||||
var common = require('../common'); |
const common = require('../common'); |
||||
var fs = require('fs'); |
const fs = require('fs'); |
||||
var path = require('path'); |
const path = require('path'); |
||||
var assert = require('assert'); |
|
||||
|
|
||||
// make a path that is more than 260 chars long.
|
// make a path that is more than 260 chars long.
|
||||
var fileNameLen = Math.max(261 - common.tmpDir.length - 1, 1); |
const dirNameLen = Math.max(260 - common.tmpDir.length, 1); |
||||
var fileName = path.join(common.tmpDir, new Array(fileNameLen + 1).join('x')); |
const dirName = path.join(common.tmpDir, 'x'.repeat(dirNameLen)); |
||||
var fullPath = path.resolve(fileName); |
const fullDirPath = path.resolve(dirName); |
||||
|
|
||||
|
const indexFile = path.join(fullDirPath, 'index.js'); |
||||
|
const otherFile = path.join(fullDirPath, 'other.js'); |
||||
|
|
||||
common.refreshTmpDir(); |
common.refreshTmpDir(); |
||||
fs.writeFileSync(fullPath, 'module.exports = 42;'); |
|
||||
|
|
||||
assert.equal(require(fullPath), 42); |
fs.mkdirSync(fullDirPath); |
||||
|
fs.writeFileSync(indexFile, 'require("./other");'); |
||||
|
fs.writeFileSync(otherFile, ''); |
||||
|
|
||||
|
require(indexFile); |
||||
|
require(otherFile); |
||||
|
|
||||
fs.unlinkSync(fullPath); |
common.refreshTmpDir(); |
||||
|
Loading…
Reference in new issue