init
This commit is contained in:
		
							
								
								
									
										9
									
								
								node_modules/path-browserify/test/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								node_modules/path-browserify/test/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
			
		||||
require('./test-path');
 | 
			
		||||
require('./test-path-basename');
 | 
			
		||||
require('./test-path-dirname');
 | 
			
		||||
require('./test-path-extname');
 | 
			
		||||
require('./test-path-isabsolute');
 | 
			
		||||
require('./test-path-join');
 | 
			
		||||
require('./test-path-relative');
 | 
			
		||||
require('./test-path-resolve');
 | 
			
		||||
require('./test-path-zero-length-strings');
 | 
			
		||||
							
								
								
									
										79
									
								
								node_modules/path-browserify/test/test-path-basename.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										79
									
								
								node_modules/path-browserify/test/test-path-basename.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,79 @@
 | 
			
		||||
'use strict';
 | 
			
		||||
var tape = require('tape');
 | 
			
		||||
var path = require('../');
 | 
			
		||||
 | 
			
		||||
tape('path.basename', function (t) {
 | 
			
		||||
  t.strictEqual(path.basename(__filename), 'test-path-basename.js');
 | 
			
		||||
  t.strictEqual(path.basename(__filename, '.js'), 'test-path-basename');
 | 
			
		||||
  t.strictEqual(path.basename('.js', '.js'), '');
 | 
			
		||||
  t.strictEqual(path.basename(''), '');
 | 
			
		||||
  t.strictEqual(path.basename('/dir/basename.ext'), 'basename.ext');
 | 
			
		||||
  t.strictEqual(path.basename('/basename.ext'), 'basename.ext');
 | 
			
		||||
  t.strictEqual(path.basename('basename.ext'), 'basename.ext');
 | 
			
		||||
  t.strictEqual(path.basename('basename.ext/'), 'basename.ext');
 | 
			
		||||
  t.strictEqual(path.basename('basename.ext//'), 'basename.ext');
 | 
			
		||||
  t.strictEqual(path.basename('aaa/bbb', '/bbb'), 'bbb');
 | 
			
		||||
  t.strictEqual(path.basename('aaa/bbb', 'a/bbb'), 'bbb');
 | 
			
		||||
  t.strictEqual(path.basename('aaa/bbb', 'bbb'), 'bbb');
 | 
			
		||||
  t.strictEqual(path.basename('aaa/bbb//', 'bbb'), 'bbb');
 | 
			
		||||
  t.strictEqual(path.basename('aaa/bbb', 'bb'), 'b');
 | 
			
		||||
  t.strictEqual(path.basename('aaa/bbb', 'b'), 'bb');
 | 
			
		||||
  t.strictEqual(path.basename('/aaa/bbb', '/bbb'), 'bbb');
 | 
			
		||||
  t.strictEqual(path.basename('/aaa/bbb', 'a/bbb'), 'bbb');
 | 
			
		||||
  t.strictEqual(path.basename('/aaa/bbb', 'bbb'), 'bbb');
 | 
			
		||||
  t.strictEqual(path.basename('/aaa/bbb//', 'bbb'), 'bbb');
 | 
			
		||||
  t.strictEqual(path.basename('/aaa/bbb', 'bb'), 'b');
 | 
			
		||||
  t.strictEqual(path.basename('/aaa/bbb', 'b'), 'bb');
 | 
			
		||||
  t.strictEqual(path.basename('/aaa/bbb'), 'bbb');
 | 
			
		||||
  t.strictEqual(path.basename('/aaa/'), 'aaa');
 | 
			
		||||
  t.strictEqual(path.basename('/aaa/b'), 'b');
 | 
			
		||||
  t.strictEqual(path.basename('/a/b'), 'b');
 | 
			
		||||
  t.strictEqual(path.basename('//a'), 'a');
 | 
			
		||||
  t.end();
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
tape('path.win32.basename', { skip: true }, function (t) {
 | 
			
		||||
  // On Windows a backslash acts as a path separator.
 | 
			
		||||
  t.strictEqual(path.win32.basename('\\dir\\basename.ext'), 'basename.ext');
 | 
			
		||||
  t.strictEqual(path.win32.basename('\\basename.ext'), 'basename.ext');
 | 
			
		||||
  t.strictEqual(path.win32.basename('basename.ext'), 'basename.ext');
 | 
			
		||||
  t.strictEqual(path.win32.basename('basename.ext\\'), 'basename.ext');
 | 
			
		||||
  t.strictEqual(path.win32.basename('basename.ext\\\\'), 'basename.ext');
 | 
			
		||||
  t.strictEqual(path.win32.basename('foo'), 'foo');
 | 
			
		||||
  t.strictEqual(path.win32.basename('aaa\\bbb', '\\bbb'), 'bbb');
 | 
			
		||||
  t.strictEqual(path.win32.basename('aaa\\bbb', 'a\\bbb'), 'bbb');
 | 
			
		||||
  t.strictEqual(path.win32.basename('aaa\\bbb', 'bbb'), 'bbb');
 | 
			
		||||
  t.strictEqual(path.win32.basename('aaa\\bbb\\\\\\\\', 'bbb'), 'bbb');
 | 
			
		||||
  t.strictEqual(path.win32.basename('aaa\\bbb', 'bb'), 'b');
 | 
			
		||||
  t.strictEqual(path.win32.basename('aaa\\bbb', 'b'), 'bb');
 | 
			
		||||
  t.strictEqual(path.win32.basename('C:'), '');
 | 
			
		||||
  t.strictEqual(path.win32.basename('C:.'), '.');
 | 
			
		||||
  t.strictEqual(path.win32.basename('C:\\'), '');
 | 
			
		||||
  t.strictEqual(path.win32.basename('C:\\dir\\base.ext'), 'base.ext');
 | 
			
		||||
  t.strictEqual(path.win32.basename('C:\\basename.ext'), 'basename.ext');
 | 
			
		||||
  t.strictEqual(path.win32.basename('C:basename.ext'), 'basename.ext');
 | 
			
		||||
  t.strictEqual(path.win32.basename('C:basename.ext\\'), 'basename.ext');
 | 
			
		||||
  t.strictEqual(path.win32.basename('C:basename.ext\\\\'), 'basename.ext');
 | 
			
		||||
  t.strictEqual(path.win32.basename('C:foo'), 'foo');
 | 
			
		||||
  t.strictEqual(path.win32.basename('file:stream'), 'file:stream');
 | 
			
		||||
  t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
tape('On unix a backslash is just treated as any other character.', function (t) {
 | 
			
		||||
  t.strictEqual(path.posix.basename('\\dir\\basename.ext'),
 | 
			
		||||
                     '\\dir\\basename.ext');
 | 
			
		||||
  t.strictEqual(path.posix.basename('\\basename.ext'), '\\basename.ext');
 | 
			
		||||
  t.strictEqual(path.posix.basename('basename.ext'), 'basename.ext');
 | 
			
		||||
  t.strictEqual(path.posix.basename('basename.ext\\'), 'basename.ext\\');
 | 
			
		||||
  t.strictEqual(path.posix.basename('basename.ext\\\\'), 'basename.ext\\\\');
 | 
			
		||||
  t.strictEqual(path.posix.basename('foo'), 'foo');
 | 
			
		||||
  t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
tape('POSIX filenames may include control characters', function (t) {
 | 
			
		||||
  // c.f. http://www.dwheeler.com/essays/fixing-unix-linux-filenames.html
 | 
			
		||||
  var controlCharFilename = "Icon" + (String.fromCharCode(13));
 | 
			
		||||
  t.strictEqual(path.posix.basename(("/a/b/" + controlCharFilename)),
 | 
			
		||||
                     controlCharFilename);
 | 
			
		||||
  t.end();
 | 
			
		||||
});
 | 
			
		||||
							
								
								
									
										58
									
								
								node_modules/path-browserify/test/test-path-dirname.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								node_modules/path-browserify/test/test-path-dirname.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,58 @@
 | 
			
		||||
'use strict';
 | 
			
		||||
var tape = require('tape');
 | 
			
		||||
var path = require('../');
 | 
			
		||||
 | 
			
		||||
tape('path.posix.dirname', function (t) {
 | 
			
		||||
  t.strictEqual(path.posix.dirname('/a/b/'), '/a');
 | 
			
		||||
  t.strictEqual(path.posix.dirname('/a/b'), '/a');
 | 
			
		||||
  t.strictEqual(path.posix.dirname('/a'), '/');
 | 
			
		||||
  t.strictEqual(path.posix.dirname(''), '.');
 | 
			
		||||
  t.strictEqual(path.posix.dirname('/'), '/');
 | 
			
		||||
  t.strictEqual(path.posix.dirname('////'), '/');
 | 
			
		||||
  t.strictEqual(path.posix.dirname('//a'), '//');
 | 
			
		||||
  t.strictEqual(path.posix.dirname('foo'), '.');
 | 
			
		||||
  t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
tape('path.win32.dirname', { skip: true }, function (t) {
 | 
			
		||||
  t.strictEqual(path.win32.dirname('c:\\'), 'c:\\');
 | 
			
		||||
  t.strictEqual(path.win32.dirname('c:\\foo'), 'c:\\');
 | 
			
		||||
  t.strictEqual(path.win32.dirname('c:\\foo\\'), 'c:\\');
 | 
			
		||||
  t.strictEqual(path.win32.dirname('c:\\foo\\bar'), 'c:\\foo');
 | 
			
		||||
  t.strictEqual(path.win32.dirname('c:\\foo\\bar\\'), 'c:\\foo');
 | 
			
		||||
  t.strictEqual(path.win32.dirname('c:\\foo\\bar\\baz'), 'c:\\foo\\bar');
 | 
			
		||||
  t.strictEqual(path.win32.dirname('\\'), '\\');
 | 
			
		||||
  t.strictEqual(path.win32.dirname('\\foo'), '\\');
 | 
			
		||||
  t.strictEqual(path.win32.dirname('\\foo\\'), '\\');
 | 
			
		||||
  t.strictEqual(path.win32.dirname('\\foo\\bar'), '\\foo');
 | 
			
		||||
  t.strictEqual(path.win32.dirname('\\foo\\bar\\'), '\\foo');
 | 
			
		||||
  t.strictEqual(path.win32.dirname('\\foo\\bar\\baz'), '\\foo\\bar');
 | 
			
		||||
  t.strictEqual(path.win32.dirname('c:'), 'c:');
 | 
			
		||||
  t.strictEqual(path.win32.dirname('c:foo'), 'c:');
 | 
			
		||||
  t.strictEqual(path.win32.dirname('c:foo\\'), 'c:');
 | 
			
		||||
  t.strictEqual(path.win32.dirname('c:foo\\bar'), 'c:foo');
 | 
			
		||||
  t.strictEqual(path.win32.dirname('c:foo\\bar\\'), 'c:foo');
 | 
			
		||||
  t.strictEqual(path.win32.dirname('c:foo\\bar\\baz'), 'c:foo\\bar');
 | 
			
		||||
  t.strictEqual(path.win32.dirname('file:stream'), '.');
 | 
			
		||||
  t.strictEqual(path.win32.dirname('dir\\file:stream'), 'dir');
 | 
			
		||||
  t.strictEqual(path.win32.dirname('\\\\unc\\share'),
 | 
			
		||||
                '\\\\unc\\share');
 | 
			
		||||
  t.strictEqual(path.win32.dirname('\\\\unc\\share\\foo'),
 | 
			
		||||
                '\\\\unc\\share\\');
 | 
			
		||||
  t.strictEqual(path.win32.dirname('\\\\unc\\share\\foo\\'),
 | 
			
		||||
                '\\\\unc\\share\\');
 | 
			
		||||
  t.strictEqual(path.win32.dirname('\\\\unc\\share\\foo\\bar'),
 | 
			
		||||
                '\\\\unc\\share\\foo');
 | 
			
		||||
  t.strictEqual(path.win32.dirname('\\\\unc\\share\\foo\\bar\\'),
 | 
			
		||||
                '\\\\unc\\share\\foo');
 | 
			
		||||
  t.strictEqual(path.win32.dirname('\\\\unc\\share\\foo\\bar\\baz'),
 | 
			
		||||
                '\\\\unc\\share\\foo\\bar');
 | 
			
		||||
  t.strictEqual(path.win32.dirname('/a/b/'), '/a');
 | 
			
		||||
  t.strictEqual(path.win32.dirname('/a/b'), '/a');
 | 
			
		||||
  t.strictEqual(path.win32.dirname('/a'), '/');
 | 
			
		||||
  t.strictEqual(path.win32.dirname(''), '.');
 | 
			
		||||
  t.strictEqual(path.win32.dirname('/'), '/');
 | 
			
		||||
  t.strictEqual(path.win32.dirname('////'), '/');
 | 
			
		||||
  t.strictEqual(path.win32.dirname('foo'), '.');
 | 
			
		||||
  t.end();
 | 
			
		||||
});
 | 
			
		||||
							
								
								
									
										96
									
								
								node_modules/path-browserify/test/test-path-extname.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										96
									
								
								node_modules/path-browserify/test/test-path-extname.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,96 @@
 | 
			
		||||
'use strict';
 | 
			
		||||
var tape = require('tape');
 | 
			
		||||
var path = require('../');
 | 
			
		||||
 | 
			
		||||
var slashRE = /\//g;
 | 
			
		||||
 | 
			
		||||
var pairs = [
 | 
			
		||||
  [__filename, '.js'],
 | 
			
		||||
  ['', ''],
 | 
			
		||||
  ['/path/to/file', ''],
 | 
			
		||||
  ['/path/to/file.ext', '.ext'],
 | 
			
		||||
  ['/path.to/file.ext', '.ext'],
 | 
			
		||||
  ['/path.to/file', ''],
 | 
			
		||||
  ['/path.to/.file', ''],
 | 
			
		||||
  ['/path.to/.file.ext', '.ext'],
 | 
			
		||||
  ['/path/to/f.ext', '.ext'],
 | 
			
		||||
  ['/path/to/..ext', '.ext'],
 | 
			
		||||
  ['/path/to/..', ''],
 | 
			
		||||
  ['file', ''],
 | 
			
		||||
  ['file.ext', '.ext'],
 | 
			
		||||
  ['.file', ''],
 | 
			
		||||
  ['.file.ext', '.ext'],
 | 
			
		||||
  ['/file', ''],
 | 
			
		||||
  ['/file.ext', '.ext'],
 | 
			
		||||
  ['/.file', ''],
 | 
			
		||||
  ['/.file.ext', '.ext'],
 | 
			
		||||
  ['.path/file.ext', '.ext'],
 | 
			
		||||
  ['file.ext.ext', '.ext'],
 | 
			
		||||
  ['file.', '.'],
 | 
			
		||||
  ['.', ''],
 | 
			
		||||
  ['./', ''],
 | 
			
		||||
  ['.file.ext', '.ext'],
 | 
			
		||||
  ['.file', ''],
 | 
			
		||||
  ['.file.', '.'],
 | 
			
		||||
  ['.file..', '.'],
 | 
			
		||||
  ['..', ''],
 | 
			
		||||
  ['../', ''],
 | 
			
		||||
  ['..file.ext', '.ext'],
 | 
			
		||||
  ['..file', '.file'],
 | 
			
		||||
  ['..file.', '.'],
 | 
			
		||||
  ['..file..', '.'],
 | 
			
		||||
  ['...', '.'],
 | 
			
		||||
  ['...ext', '.ext'],
 | 
			
		||||
  ['....', '.'],
 | 
			
		||||
  ['file.ext/', '.ext'],
 | 
			
		||||
  ['file.ext//', '.ext'],
 | 
			
		||||
  ['file/', ''],
 | 
			
		||||
  ['file//', ''],
 | 
			
		||||
  ['file./', '.'],
 | 
			
		||||
  ['file.//', '.'] ];
 | 
			
		||||
 | 
			
		||||
tape('path.posix.extname', function (t) {
 | 
			
		||||
  pairs.forEach(function (p) {
 | 
			
		||||
    var input = p[0];
 | 
			
		||||
    var expected = p[1];
 | 
			
		||||
    t.strictEqual(expected, path.posix.extname(input));
 | 
			
		||||
  });
 | 
			
		||||
  t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
tape('path.win32.extname', { skip: true }, function (t) {
 | 
			
		||||
  pairs.forEach(function (p) {
 | 
			
		||||
    var input = p[0].replace(slashRE, '\\');
 | 
			
		||||
    var expected = p[1];
 | 
			
		||||
    t.strictEqual(expected, path.win32.extname(input));
 | 
			
		||||
    t.strictEqual(expected, path.win32.extname("C:" + input));
 | 
			
		||||
  });
 | 
			
		||||
  t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
tape('path.win32.extname backslash', { skip: true }, function (t) {
 | 
			
		||||
  // On Windows, backslash is a path separator.
 | 
			
		||||
  t.strictEqual(path.win32.extname('.\\'), '');
 | 
			
		||||
  t.strictEqual(path.win32.extname('..\\'), '');
 | 
			
		||||
  t.strictEqual(path.win32.extname('file.ext\\'), '.ext');
 | 
			
		||||
  t.strictEqual(path.win32.extname('file.ext\\\\'), '.ext');
 | 
			
		||||
  t.strictEqual(path.win32.extname('file\\'), '');
 | 
			
		||||
  t.strictEqual(path.win32.extname('file\\\\'), '');
 | 
			
		||||
  t.strictEqual(path.win32.extname('file.\\'), '.');
 | 
			
		||||
  t.strictEqual(path.win32.extname('file.\\\\'), '.');
 | 
			
		||||
  t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
tape('path.posix.extname backslash', function (t) {
 | 
			
		||||
  // On *nix, backslash is a valid name component like any other character.
 | 
			
		||||
  t.strictEqual(path.posix.extname('.\\'), '');
 | 
			
		||||
  t.strictEqual(path.posix.extname('..\\'), '.\\');
 | 
			
		||||
  t.strictEqual(path.posix.extname('file.ext\\'), '.ext\\');
 | 
			
		||||
  t.strictEqual(path.posix.extname('file.ext\\\\'), '.ext\\\\');
 | 
			
		||||
  t.strictEqual(path.posix.extname('file\\'), '');
 | 
			
		||||
  t.strictEqual(path.posix.extname('file\\\\'), '');
 | 
			
		||||
  t.strictEqual(path.posix.extname('file.\\'), '.\\');
 | 
			
		||||
  t.strictEqual(path.posix.extname('file.\\\\'), '.\\\\');
 | 
			
		||||
  t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										33
									
								
								node_modules/path-browserify/test/test-path-isabsolute.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								node_modules/path-browserify/test/test-path-isabsolute.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,33 @@
 | 
			
		||||
'use strict';
 | 
			
		||||
var tape = require('tape');
 | 
			
		||||
var path = require('../');
 | 
			
		||||
 | 
			
		||||
tape('path.win32.isAbsolute', { skip: true }, function (t) {
 | 
			
		||||
  t.strictEqual(path.win32.isAbsolute('/'), true);
 | 
			
		||||
  t.strictEqual(path.win32.isAbsolute('//'), true);
 | 
			
		||||
  t.strictEqual(path.win32.isAbsolute('//server'), true);
 | 
			
		||||
  t.strictEqual(path.win32.isAbsolute('//server/file'), true);
 | 
			
		||||
  t.strictEqual(path.win32.isAbsolute('\\\\server\\file'), true);
 | 
			
		||||
  t.strictEqual(path.win32.isAbsolute('\\\\server'), true);
 | 
			
		||||
  t.strictEqual(path.win32.isAbsolute('\\\\'), true);
 | 
			
		||||
  t.strictEqual(path.win32.isAbsolute('c'), false);
 | 
			
		||||
  t.strictEqual(path.win32.isAbsolute('c:'), false);
 | 
			
		||||
  t.strictEqual(path.win32.isAbsolute('c:\\'), true);
 | 
			
		||||
  t.strictEqual(path.win32.isAbsolute('c:/'), true);
 | 
			
		||||
  t.strictEqual(path.win32.isAbsolute('c://'), true);
 | 
			
		||||
  t.strictEqual(path.win32.isAbsolute('C:/Users/'), true);
 | 
			
		||||
  t.strictEqual(path.win32.isAbsolute('C:\\Users\\'), true);
 | 
			
		||||
  t.strictEqual(path.win32.isAbsolute('C:cwd/another'), false);
 | 
			
		||||
  t.strictEqual(path.win32.isAbsolute('C:cwd\\another'), false);
 | 
			
		||||
  t.strictEqual(path.win32.isAbsolute('directory/directory'), false);
 | 
			
		||||
  t.strictEqual(path.win32.isAbsolute('directory\\directory'), false);
 | 
			
		||||
  t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
tape('path.posix.isAbsolute', function (t) {
 | 
			
		||||
  t.strictEqual(path.posix.isAbsolute('/home/foo'), true);
 | 
			
		||||
  t.strictEqual(path.posix.isAbsolute('/home/foo/..'), true);
 | 
			
		||||
  t.strictEqual(path.posix.isAbsolute('bar/'), false);
 | 
			
		||||
  t.strictEqual(path.posix.isAbsolute('./baz'), false);
 | 
			
		||||
  t.end();
 | 
			
		||||
});
 | 
			
		||||
							
								
								
									
										126
									
								
								node_modules/path-browserify/test/test-path-join.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										126
									
								
								node_modules/path-browserify/test/test-path-join.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,126 @@
 | 
			
		||||
'use strict';
 | 
			
		||||
var tape = require('tape');
 | 
			
		||||
var path = require('../');
 | 
			
		||||
 | 
			
		||||
var backslashRE = /\\/g;
 | 
			
		||||
 | 
			
		||||
var joinTests =
 | 
			
		||||
    // arguments                     result
 | 
			
		||||
    [[['.', 'x/b', '..', '/b/c.js'], 'x/b/c.js'],
 | 
			
		||||
     [[], '.'],
 | 
			
		||||
     [['/.', 'x/b', '..', '/b/c.js'], '/x/b/c.js'],
 | 
			
		||||
     [['/foo', '../../../bar'], '/bar'],
 | 
			
		||||
     [['foo', '../../../bar'], '../../bar'],
 | 
			
		||||
     [['foo/', '../../../bar'], '../../bar'],
 | 
			
		||||
     [['foo/x', '../../../bar'], '../bar'],
 | 
			
		||||
     [['foo/x', './bar'], 'foo/x/bar'],
 | 
			
		||||
     [['foo/x/', './bar'], 'foo/x/bar'],
 | 
			
		||||
     [['foo/x/', '.', 'bar'], 'foo/x/bar'],
 | 
			
		||||
     [['./'], './'],
 | 
			
		||||
     [['.', './'], './'],
 | 
			
		||||
     [['.', '.', '.'], '.'],
 | 
			
		||||
     [['.', './', '.'], '.'],
 | 
			
		||||
     [['.', '/./', '.'], '.'],
 | 
			
		||||
     [['.', '/////./', '.'], '.'],
 | 
			
		||||
     [['.'], '.'],
 | 
			
		||||
     [['', '.'], '.'],
 | 
			
		||||
     [['', 'foo'], 'foo'],
 | 
			
		||||
     [['foo', '/bar'], 'foo/bar'],
 | 
			
		||||
     [['', '/foo'], '/foo'],
 | 
			
		||||
     [['', '', '/foo'], '/foo'],
 | 
			
		||||
     [['', '', 'foo'], 'foo'],
 | 
			
		||||
     [['foo', ''], 'foo'],
 | 
			
		||||
     [['foo/', ''], 'foo/'],
 | 
			
		||||
     [['foo', '', '/bar'], 'foo/bar'],
 | 
			
		||||
     [['./', '..', '/foo'], '../foo'],
 | 
			
		||||
     [['./', '..', '..', '/foo'], '../../foo'],
 | 
			
		||||
     [['.', '..', '..', '/foo'], '../../foo'],
 | 
			
		||||
     [['', '..', '..', '/foo'], '../../foo'],
 | 
			
		||||
     [['/'], '/'],
 | 
			
		||||
     [['/', '.'], '/'],
 | 
			
		||||
     [['/', '..'], '/'],
 | 
			
		||||
     [['/', '..', '..'], '/'],
 | 
			
		||||
     [[''], '.'],
 | 
			
		||||
     [['', ''], '.'],
 | 
			
		||||
     [[' /foo'], ' /foo'],
 | 
			
		||||
     [[' ', 'foo'], ' /foo'],
 | 
			
		||||
     [[' ', '.'], ' '],
 | 
			
		||||
     [[' ', '/'], ' /'],
 | 
			
		||||
     [[' ', ''], ' '],
 | 
			
		||||
     [['/', 'foo'], '/foo'],
 | 
			
		||||
     [['/', '/foo'], '/foo'],
 | 
			
		||||
     [['/', '//foo'], '/foo'],
 | 
			
		||||
     [['/', '', '/foo'], '/foo'],
 | 
			
		||||
     [['', '/', 'foo'], '/foo'],
 | 
			
		||||
     [['', '/', '/foo'], '/foo']
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
// Windows-specific join tests
 | 
			
		||||
var windowsJoinTests =
 | 
			
		||||
    [// arguments                     result
 | 
			
		||||
      // UNC path expected
 | 
			
		||||
      [['//foo/bar'], '\\\\foo\\bar\\'],
 | 
			
		||||
      [['\\/foo/bar'], '\\\\foo\\bar\\'],
 | 
			
		||||
      [['\\\\foo/bar'], '\\\\foo\\bar\\'],
 | 
			
		||||
      // UNC path expected - server and share separate
 | 
			
		||||
      [['//foo', 'bar'], '\\\\foo\\bar\\'],
 | 
			
		||||
      [['//foo/', 'bar'], '\\\\foo\\bar\\'],
 | 
			
		||||
      [['//foo', '/bar'], '\\\\foo\\bar\\'],
 | 
			
		||||
      // UNC path expected - questionable
 | 
			
		||||
      [['//foo', '', 'bar'], '\\\\foo\\bar\\'],
 | 
			
		||||
      [['//foo/', '', 'bar'], '\\\\foo\\bar\\'],
 | 
			
		||||
      [['//foo/', '', '/bar'], '\\\\foo\\bar\\'],
 | 
			
		||||
      // UNC path expected - even more questionable
 | 
			
		||||
      [['', '//foo', 'bar'], '\\\\foo\\bar\\'],
 | 
			
		||||
      [['', '//foo/', 'bar'], '\\\\foo\\bar\\'],
 | 
			
		||||
      [['', '//foo/', '/bar'], '\\\\foo\\bar\\'],
 | 
			
		||||
      // No UNC path expected (no double slash in first component)
 | 
			
		||||
      [['\\', 'foo/bar'], '\\foo\\bar'],
 | 
			
		||||
      [['\\', '/foo/bar'], '\\foo\\bar'],
 | 
			
		||||
      [['', '/', '/foo/bar'], '\\foo\\bar'],
 | 
			
		||||
      // No UNC path expected (no non-slashes in first component -
 | 
			
		||||
      // questionable)
 | 
			
		||||
      [['//', 'foo/bar'], '\\foo\\bar'],
 | 
			
		||||
      [['//', '/foo/bar'], '\\foo\\bar'],
 | 
			
		||||
      [['\\\\', '/', '/foo/bar'], '\\foo\\bar'],
 | 
			
		||||
      [['//'], '/'],
 | 
			
		||||
      // No UNC path expected (share name missing - questionable).
 | 
			
		||||
      [['//foo'], '\\foo'],
 | 
			
		||||
      [['//foo/'], '\\foo\\'],
 | 
			
		||||
      [['//foo', '/'], '\\foo\\'],
 | 
			
		||||
      [['//foo', '', '/'], '\\foo\\'],
 | 
			
		||||
      // No UNC path expected (too many leading slashes - questionable)
 | 
			
		||||
      [['///foo/bar'], '\\foo\\bar'],
 | 
			
		||||
      [['////foo', 'bar'], '\\foo\\bar'],
 | 
			
		||||
      [['\\\\\\/foo/bar'], '\\foo\\bar'],
 | 
			
		||||
      // Drive-relative vs drive-absolute paths. This merely describes the
 | 
			
		||||
      // status quo, rather than being obviously right
 | 
			
		||||
      [['c:'], 'c:.'],
 | 
			
		||||
      [['c:.'], 'c:.'],
 | 
			
		||||
      [['c:', ''], 'c:.'],
 | 
			
		||||
      [['', 'c:'], 'c:.'],
 | 
			
		||||
      [['c:.', '/'], 'c:.\\'],
 | 
			
		||||
      [['c:.', 'file'], 'c:file'],
 | 
			
		||||
      [['c:', '/'], 'c:\\'],
 | 
			
		||||
      [['c:', 'file'], 'c:\\file']
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
tape('path.posix.join', function (t) {
 | 
			
		||||
  joinTests.forEach(function (p) {
 | 
			
		||||
    var actual = path.posix.join.apply(null, p[0]);
 | 
			
		||||
    t.strictEqual(actual, p[1]);
 | 
			
		||||
  });
 | 
			
		||||
  t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
tape('path.win32.join', { skip: true }, function (t) {
 | 
			
		||||
  joinTests.forEach(function (p) {
 | 
			
		||||
    var actual = path.win32.join.apply(null, p[0]).replace(backslashRE, '/');
 | 
			
		||||
    t.strictEqual(actual, p[1]);
 | 
			
		||||
  });
 | 
			
		||||
  windowsJoinTests.forEach(function (p) {
 | 
			
		||||
    var actual = path.win32.join.apply(null, p[0]);
 | 
			
		||||
    t.strictEqual(actual, p[1]);
 | 
			
		||||
  });
 | 
			
		||||
  t.end();
 | 
			
		||||
});
 | 
			
		||||
							
								
								
									
										235
									
								
								node_modules/path-browserify/test/test-path-parse-format.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										235
									
								
								node_modules/path-browserify/test/test-path-parse-format.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,235 @@
 | 
			
		||||
// Copyright Joyent, Inc. and other Node contributors.
 | 
			
		||||
//
 | 
			
		||||
// Permission is hereby granted, free of charge, to any person obtaining a
 | 
			
		||||
// copy of this software and associated documentation files (the
 | 
			
		||||
// "Software"), to deal in the Software without restriction, including
 | 
			
		||||
// without limitation the rights to use, copy, modify, merge, publish,
 | 
			
		||||
// distribute, sublicense, and/or sell copies of the Software, and to permit
 | 
			
		||||
// persons to whom the Software is furnished to do so, subject to the
 | 
			
		||||
// following conditions:
 | 
			
		||||
//
 | 
			
		||||
// The above copyright notice and this permission notice shall be included
 | 
			
		||||
// in all copies or substantial portions of the Software.
 | 
			
		||||
//
 | 
			
		||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 | 
			
		||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 | 
			
		||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
 | 
			
		||||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
 | 
			
		||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
 | 
			
		||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
 | 
			
		||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
 | 
			
		||||
 | 
			
		||||
'use strict';
 | 
			
		||||
var tape = require('tape');
 | 
			
		||||
var path = require('../');
 | 
			
		||||
 | 
			
		||||
var winPaths = [
 | 
			
		||||
  // [path, root]
 | 
			
		||||
  ['C:\\path\\dir\\index.html', 'C:\\'],
 | 
			
		||||
  ['C:\\another_path\\DIR\\1\\2\\33\\\\index', 'C:\\'],
 | 
			
		||||
  ['another_path\\DIR with spaces\\1\\2\\33\\index', ''],
 | 
			
		||||
  ['\\', '\\'],
 | 
			
		||||
  ['\\foo\\C:', '\\'],
 | 
			
		||||
  ['file', ''],
 | 
			
		||||
  ['file:stream', ''],
 | 
			
		||||
  ['.\\file', ''],
 | 
			
		||||
  ['C:', 'C:'],
 | 
			
		||||
  ['C:.', 'C:'],
 | 
			
		||||
  ['C:..', 'C:'],
 | 
			
		||||
  ['C:abc', 'C:'],
 | 
			
		||||
  ['C:\\', 'C:\\'],
 | 
			
		||||
  ['C:\\abc', 'C:\\' ],
 | 
			
		||||
  ['', ''],
 | 
			
		||||
 | 
			
		||||
  // unc
 | 
			
		||||
  ['\\\\server\\share\\file_path', '\\\\server\\share\\'],
 | 
			
		||||
  ['\\\\server two\\shared folder\\file path.zip',
 | 
			
		||||
   '\\\\server two\\shared folder\\'],
 | 
			
		||||
  ['\\\\teela\\admin$\\system32', '\\\\teela\\admin$\\'],
 | 
			
		||||
  ['\\\\?\\UNC\\server\\share', '\\\\?\\UNC\\']
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
var winSpecialCaseParseTests = [
 | 
			
		||||
  ['/foo/bar', { root: '/' }],
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
var winSpecialCaseFormatTests = [
 | 
			
		||||
  [{ dir: 'some\\dir' }, 'some\\dir\\'],
 | 
			
		||||
  [{ base: 'index.html' }, 'index.html'],
 | 
			
		||||
  [{ root: 'C:\\' }, 'C:\\'],
 | 
			
		||||
  [{ name: 'index', ext: '.html' }, 'index.html'],
 | 
			
		||||
  [{ dir: 'some\\dir', name: 'index', ext: '.html' }, 'some\\dir\\index.html'],
 | 
			
		||||
  [{ root: 'C:\\', name: 'index', ext: '.html' }, 'C:\\index.html'],
 | 
			
		||||
  [{}, '']
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
var unixPaths = [
 | 
			
		||||
  // [path, root]
 | 
			
		||||
  ['/home/user/dir/file.txt', '/'],
 | 
			
		||||
  ['/home/user/a dir/another File.zip', '/'],
 | 
			
		||||
  ['/home/user/a dir//another&File.', '/'],
 | 
			
		||||
  ['/home/user/a$$$dir//another File.zip', '/'],
 | 
			
		||||
  ['user/dir/another File.zip', ''],
 | 
			
		||||
  ['file', ''],
 | 
			
		||||
  ['.\\file', ''],
 | 
			
		||||
  ['./file', ''],
 | 
			
		||||
  ['C:\\foo', ''],
 | 
			
		||||
  ['/', '/'],
 | 
			
		||||
  ['', ''],
 | 
			
		||||
  ['.', ''],
 | 
			
		||||
  ['..', ''],
 | 
			
		||||
  ['/foo', '/'],
 | 
			
		||||
  ['/foo.', '/'],
 | 
			
		||||
  ['/foo.bar', '/'],
 | 
			
		||||
  ['/.', '/'],
 | 
			
		||||
  ['/.foo', '/'],
 | 
			
		||||
  ['/.foo.bar', '/'],
 | 
			
		||||
  ['/foo/bar.baz', '/']
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
var unixSpecialCaseFormatTests = [
 | 
			
		||||
  [{ dir: 'some/dir' }, 'some/dir/'],
 | 
			
		||||
  [{ base: 'index.html' }, 'index.html'],
 | 
			
		||||
  [{ root: '/' }, '/'],
 | 
			
		||||
  [{ name: 'index', ext: '.html' }, 'index.html'],
 | 
			
		||||
  [{ dir: 'some/dir', name: 'index', ext: '.html' }, 'some/dir/index.html'],
 | 
			
		||||
  [{ root: '/', name: 'index', ext: '.html' }, '/index.html'],
 | 
			
		||||
  [{}, '']
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
var errors = [
 | 
			
		||||
  { method: 'parse', input: [null], message: TypeError },
 | 
			
		||||
  { method: 'parse', input: [{}], message: TypeError },
 | 
			
		||||
  { method: 'parse', input: [true], message: TypeError },
 | 
			
		||||
  { method: 'parse', input: [1], message: TypeError },
 | 
			
		||||
  { method: 'parse', input: [], message: TypeError },
 | 
			
		||||
  { method: 'format', input: [null], message: TypeError },
 | 
			
		||||
  { method: 'format', input: [''], message: TypeError },
 | 
			
		||||
  { method: 'format', input: [true], message: TypeError },
 | 
			
		||||
  { method: 'format', input: [1], message: TypeError },
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
tape('path.win32.parse', { skip: true }, function (t) {
 | 
			
		||||
  checkParseFormat(t, path.win32, winPaths);
 | 
			
		||||
  checkSpecialCaseParseFormat(t, path.win32, winSpecialCaseParseTests);
 | 
			
		||||
  t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
tape('path.posix.parse', function (t) {
 | 
			
		||||
  checkParseFormat(t, path.posix, unixPaths);
 | 
			
		||||
  t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
tape('path.win32.parse errors', { skip: true }, function (t) {
 | 
			
		||||
  checkErrors(t, path.win32);
 | 
			
		||||
  t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
tape('path.posix.parse errors', function (t) {
 | 
			
		||||
  checkErrors(t, path.posix);
 | 
			
		||||
  t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
tape('path.win32.format', { skip: true }, function (t) {
 | 
			
		||||
  checkFormat(t, path.win32, winSpecialCaseFormatTests);
 | 
			
		||||
  t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
tape('path.posix.format', function (t) {
 | 
			
		||||
  checkFormat(t, path.posix, unixSpecialCaseFormatTests);
 | 
			
		||||
  t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
// Test removal of trailing path separators
 | 
			
		||||
var windowsTrailingTests =
 | 
			
		||||
    [['.\\', { root: '', dir: '', base: '.', ext: '', name: '.' }],
 | 
			
		||||
     ['\\\\', { root: '\\', dir: '\\', base: '', ext: '', name: '' }],
 | 
			
		||||
     ['\\\\', { root: '\\', dir: '\\', base: '', ext: '', name: '' }],
 | 
			
		||||
     ['c:\\foo\\\\\\',
 | 
			
		||||
      { root: 'c:\\', dir: 'c:\\', base: 'foo', ext: '', name: 'foo' }],
 | 
			
		||||
     ['D:\\foo\\\\\\bar.baz',
 | 
			
		||||
      { root: 'D:\\',
 | 
			
		||||
        dir: 'D:\\foo\\\\',
 | 
			
		||||
        base: 'bar.baz',
 | 
			
		||||
        ext: '.baz',
 | 
			
		||||
        name: 'bar'
 | 
			
		||||
      }
 | 
			
		||||
     ]
 | 
			
		||||
    ];
 | 
			
		||||
var posixTrailingTests =
 | 
			
		||||
    [['./', { root: '', dir: '', base: '.', ext: '', name: '.' }],
 | 
			
		||||
     ['//', { root: '/', dir: '/', base: '', ext: '', name: '' }],
 | 
			
		||||
     ['///', { root: '/', dir: '/', base: '', ext: '', name: '' }],
 | 
			
		||||
     ['/foo///', { root: '/', dir: '/', base: 'foo', ext: '', name: 'foo' }],
 | 
			
		||||
     ['/foo///bar.baz',
 | 
			
		||||
      { root: '/', dir: '/foo//', base: 'bar.baz', ext: '.baz', name: 'bar' }
 | 
			
		||||
     ]
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
tape('path.win32.parse trailing', { skip: true }, function (t) {
 | 
			
		||||
  windowsTrailingTests.forEach(function (p) {
 | 
			
		||||
    var actual = path.win32.parse(p[0]);
 | 
			
		||||
    var expected = p[1];
 | 
			
		||||
    t.deepEqual(actual, expected)
 | 
			
		||||
  });
 | 
			
		||||
  t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
tape('path.posix.parse trailing', function (t) {
 | 
			
		||||
  posixTrailingTests.forEach(function (p) {
 | 
			
		||||
    var actual = path.posix.parse(p[0]);
 | 
			
		||||
    var expected = p[1];
 | 
			
		||||
    t.deepEqual(actual, expected)
 | 
			
		||||
  });
 | 
			
		||||
  t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
function checkErrors(t, path) {
 | 
			
		||||
  errors.forEach(function(errorCase) {
 | 
			
		||||
    t.throws(function () {
 | 
			
		||||
      path[errorCase.method].apply(path, errorCase.input);
 | 
			
		||||
    }, errorCase.message);
 | 
			
		||||
  });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function checkParseFormat(t, path, paths) {
 | 
			
		||||
  paths.forEach(function(p) {
 | 
			
		||||
    var element = p[0];
 | 
			
		||||
    var root = p[1];
 | 
			
		||||
    var output = path.parse(element);
 | 
			
		||||
    t.strictEqual(typeof output.root, 'string');
 | 
			
		||||
    t.strictEqual(typeof output.dir, 'string');
 | 
			
		||||
    t.strictEqual(typeof output.base, 'string');
 | 
			
		||||
    t.strictEqual(typeof output.ext, 'string');
 | 
			
		||||
    t.strictEqual(typeof output.name, 'string');
 | 
			
		||||
    t.strictEqual(path.format(output), element);
 | 
			
		||||
    t.strictEqual(output.root, root);
 | 
			
		||||
    t.ok(output.dir.startsWith(output.root));
 | 
			
		||||
    t.strictEqual(output.dir, output.dir ? path.dirname(element) : '');
 | 
			
		||||
    t.strictEqual(output.base, path.basename(element));
 | 
			
		||||
    t.strictEqual(output.ext, path.extname(element));
 | 
			
		||||
  });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function checkSpecialCaseParseFormat(t, path, testCases) {
 | 
			
		||||
  testCases.forEach(function(testCase) {
 | 
			
		||||
    var element = testCase[0];
 | 
			
		||||
    var expect = testCase[1];
 | 
			
		||||
    var output = path.parse(element);
 | 
			
		||||
    Object.keys(expect).forEach(function(key) {
 | 
			
		||||
      t.strictEqual(output[key], expect[key]);
 | 
			
		||||
    });
 | 
			
		||||
  });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function checkFormat(t, path, testCases) {
 | 
			
		||||
  testCases.forEach(function(testCase) {
 | 
			
		||||
    t.strictEqual(path.format(testCase[0]), testCase[1]);
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  [null, undefined, 1, true, false, 'string'].forEach(function (pathObject) {
 | 
			
		||||
    t.throws(function() {
 | 
			
		||||
      path.format(pathObject);
 | 
			
		||||
    }, /The "pathObject" argument must be of type Object. Received type (\w+)/);
 | 
			
		||||
  });
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										66
									
								
								node_modules/path-browserify/test/test-path-relative.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										66
									
								
								node_modules/path-browserify/test/test-path-relative.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,66 @@
 | 
			
		||||
'use strict';
 | 
			
		||||
var tape = require('tape');
 | 
			
		||||
var path = require('../');
 | 
			
		||||
 | 
			
		||||
var relativeTests = {
 | 
			
		||||
  win32:
 | 
			
		||||
    // arguments                     result
 | 
			
		||||
    [['c:/blah\\blah', 'd:/games', 'd:\\games'],
 | 
			
		||||
     ['c:/aaaa/bbbb', 'c:/aaaa', '..'],
 | 
			
		||||
     ['c:/aaaa/bbbb', 'c:/cccc', '..\\..\\cccc'],
 | 
			
		||||
     ['c:/aaaa/bbbb', 'c:/aaaa/bbbb', ''],
 | 
			
		||||
     ['c:/aaaa/bbbb', 'c:/aaaa/cccc', '..\\cccc'],
 | 
			
		||||
     ['c:/aaaa/', 'c:/aaaa/cccc', 'cccc'],
 | 
			
		||||
     ['c:/', 'c:\\aaaa\\bbbb', 'aaaa\\bbbb'],
 | 
			
		||||
     ['c:/aaaa/bbbb', 'd:\\', 'd:\\'],
 | 
			
		||||
     ['c:/AaAa/bbbb', 'c:/aaaa/bbbb', ''],
 | 
			
		||||
     ['c:/aaaaa/', 'c:/aaaa/cccc', '..\\aaaa\\cccc'],
 | 
			
		||||
     ['C:\\foo\\bar\\baz\\quux', 'C:\\', '..\\..\\..\\..'],
 | 
			
		||||
     ['C:\\foo\\test', 'C:\\foo\\test\\bar\\package.json', 'bar\\package.json'],
 | 
			
		||||
     ['C:\\foo\\bar\\baz-quux', 'C:\\foo\\bar\\baz', '..\\baz'],
 | 
			
		||||
     ['C:\\foo\\bar\\baz', 'C:\\foo\\bar\\baz-quux', '..\\baz-quux'],
 | 
			
		||||
     ['\\\\foo\\bar', '\\\\foo\\bar\\baz', 'baz'],
 | 
			
		||||
     ['\\\\foo\\bar\\baz', '\\\\foo\\bar', '..'],
 | 
			
		||||
     ['\\\\foo\\bar\\baz-quux', '\\\\foo\\bar\\baz', '..\\baz'],
 | 
			
		||||
     ['\\\\foo\\bar\\baz', '\\\\foo\\bar\\baz-quux', '..\\baz-quux'],
 | 
			
		||||
     ['C:\\baz-quux', 'C:\\baz', '..\\baz'],
 | 
			
		||||
     ['C:\\baz', 'C:\\baz-quux', '..\\baz-quux'],
 | 
			
		||||
     ['\\\\foo\\baz-quux', '\\\\foo\\baz', '..\\baz'],
 | 
			
		||||
     ['\\\\foo\\baz', '\\\\foo\\baz-quux', '..\\baz-quux'],
 | 
			
		||||
     ['C:\\baz', '\\\\foo\\bar\\baz', '\\\\foo\\bar\\baz'],
 | 
			
		||||
     ['\\\\foo\\bar\\baz', 'C:\\baz', 'C:\\baz']
 | 
			
		||||
    ],
 | 
			
		||||
  posix:
 | 
			
		||||
    // arguments          result
 | 
			
		||||
    [['/var/lib', '/var', '..'],
 | 
			
		||||
     ['/var/lib', '/bin', '../../bin'],
 | 
			
		||||
     ['/var/lib', '/var/lib', ''],
 | 
			
		||||
     ['/var/lib', '/var/apache', '../apache'],
 | 
			
		||||
     ['/var/', '/var/lib', 'lib'],
 | 
			
		||||
     ['/', '/var/lib', 'var/lib'],
 | 
			
		||||
     ['/foo/test', '/foo/test/bar/package.json', 'bar/package.json'],
 | 
			
		||||
     ['/Users/a/web/b/test/mails', '/Users/a/web/b', '../..'],
 | 
			
		||||
     ['/foo/bar/baz-quux', '/foo/bar/baz', '../baz'],
 | 
			
		||||
     ['/foo/bar/baz', '/foo/bar/baz-quux', '../baz-quux'],
 | 
			
		||||
     ['/baz-quux', '/baz', '../baz'],
 | 
			
		||||
     ['/baz', '/baz-quux', '../baz-quux']
 | 
			
		||||
    ]
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
tape('path.posix.relative', function (t) {
 | 
			
		||||
  relativeTests.posix.forEach(function (p) {
 | 
			
		||||
    var expected = p[2];
 | 
			
		||||
    var actual = path.posix.relative(p[0], p[1]);
 | 
			
		||||
    t.strictEqual(actual, expected);
 | 
			
		||||
  });
 | 
			
		||||
  t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
tape('path.win32.relative', { skip: true }, function (t) {
 | 
			
		||||
  relativeTests.win32.forEach(function (p) {
 | 
			
		||||
    var expected = p[2];
 | 
			
		||||
    var actual = path.win32.relative(p[0], p[1]);
 | 
			
		||||
    t.strictEqual(actual, expected);
 | 
			
		||||
  });
 | 
			
		||||
  t.end();
 | 
			
		||||
});
 | 
			
		||||
							
								
								
									
										45
									
								
								node_modules/path-browserify/test/test-path-resolve.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								node_modules/path-browserify/test/test-path-resolve.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,45 @@
 | 
			
		||||
'use strict';
 | 
			
		||||
var tape = require('tape');
 | 
			
		||||
var path = require('../');
 | 
			
		||||
 | 
			
		||||
var windowsTests =
 | 
			
		||||
    // arguments                               result
 | 
			
		||||
    [[['c:/blah\\blah', 'd:/games', 'c:../a'], 'c:\\blah\\a'],
 | 
			
		||||
     [['c:/ignore', 'd:\\a/b\\c/d', '\\e.exe'], 'd:\\e.exe'],
 | 
			
		||||
     [['c:/ignore', 'c:/some/file'], 'c:\\some\\file'],
 | 
			
		||||
     [['d:/ignore', 'd:some/dir//'], 'd:\\ignore\\some\\dir'],
 | 
			
		||||
     [['.'], process.cwd()],
 | 
			
		||||
     [['//server/share', '..', 'relative\\'], '\\\\server\\share\\relative'],
 | 
			
		||||
     [['c:/', '//'], 'c:\\'],
 | 
			
		||||
     [['c:/', '//dir'], 'c:\\dir'],
 | 
			
		||||
     [['c:/', '//server/share'], '\\\\server\\share\\'],
 | 
			
		||||
     [['c:/', '//server//share'], '\\\\server\\share\\'],
 | 
			
		||||
     [['c:/', '///some//dir'], 'c:\\some\\dir'],
 | 
			
		||||
     [['C:\\foo\\tmp.3\\', '..\\tmp.3\\cycles\\root.js'],
 | 
			
		||||
      'C:\\foo\\tmp.3\\cycles\\root.js']
 | 
			
		||||
    ];
 | 
			
		||||
var posixTests =
 | 
			
		||||
    // arguments                    result
 | 
			
		||||
    [[['/var/lib', '../', 'file/'], '/var/file'],
 | 
			
		||||
     [['/var/lib', '/../', 'file/'], '/file'],
 | 
			
		||||
     [['a/b/c/', '../../..'], process.cwd()],
 | 
			
		||||
     [['.'], process.cwd()],
 | 
			
		||||
     [['/some/dir', '.', '/absolute/'], '/absolute'],
 | 
			
		||||
     [['/foo/tmp.3/', '../tmp.3/cycles/root.js'], '/foo/tmp.3/cycles/root.js']
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
tape('path.posix.resolve', function (t) {
 | 
			
		||||
  posixTests.forEach(function (p) {
 | 
			
		||||
    var actual = path.posix.resolve.apply(null, p[0]);
 | 
			
		||||
    t.strictEqual(actual, p[1]);
 | 
			
		||||
  });
 | 
			
		||||
  t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
tape('path.win32.resolve', { skip: true }, function (t) {
 | 
			
		||||
  windowsTests.forEach(function (p) {
 | 
			
		||||
    var actual = path.win32.resolve.apply(null, p[0]);
 | 
			
		||||
    t.strictEqual(actual, p[1]);
 | 
			
		||||
  });
 | 
			
		||||
  t.end();
 | 
			
		||||
});
 | 
			
		||||
							
								
								
									
										53
									
								
								node_modules/path-browserify/test/test-path-zero-length-strings.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								node_modules/path-browserify/test/test-path-zero-length-strings.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,53 @@
 | 
			
		||||
'use strict';
 | 
			
		||||
 | 
			
		||||
// These testcases are specific to one uncommon behavior in path module. Few
 | 
			
		||||
// of the functions in path module, treat '' strings as current working
 | 
			
		||||
// directory. This test makes sure that the behavior is intact between commits.
 | 
			
		||||
// See: https://github.com/nodejs/node/pull/2106
 | 
			
		||||
 | 
			
		||||
var tape = require('tape');
 | 
			
		||||
var path = require('../');
 | 
			
		||||
var pwd = process.cwd();
 | 
			
		||||
 | 
			
		||||
tape('path.join zero-length', function (t) {
 | 
			
		||||
  // join will internally ignore all the zero-length strings and it will return
 | 
			
		||||
  // '.' if the joined string is a zero-length string.
 | 
			
		||||
  t.strictEqual(path.posix.join(''), '.');
 | 
			
		||||
  t.strictEqual(path.posix.join('', ''), '.');
 | 
			
		||||
  if (path.win32) t.strictEqual(path.win32.join(''), '.');
 | 
			
		||||
  if (path.win32) t.strictEqual(path.win32.join('', ''), '.');
 | 
			
		||||
  t.strictEqual(path.join(pwd), pwd);
 | 
			
		||||
  t.strictEqual(path.join(pwd, ''), pwd);
 | 
			
		||||
  t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
tape('path.normalize zero-length', function (t) {
 | 
			
		||||
  // normalize will return '.' if the input is a zero-length string
 | 
			
		||||
  t.strictEqual(path.posix.normalize(''), '.');
 | 
			
		||||
  if (path.win32) t.strictEqual(path.win32.normalize(''), '.');
 | 
			
		||||
  t.strictEqual(path.normalize(pwd), pwd);
 | 
			
		||||
  t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
tape('path.isAbsolute zero-length', function (t) {
 | 
			
		||||
  // Since '' is not a valid path in any of the common environments, return false
 | 
			
		||||
  t.strictEqual(path.posix.isAbsolute(''), false);
 | 
			
		||||
  if (path.win32) t.strictEqual(path.win32.isAbsolute(''), false);
 | 
			
		||||
  t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
tape('path.resolve zero-length', function (t) {
 | 
			
		||||
  // resolve, internally ignores all the zero-length strings and returns the
 | 
			
		||||
  // current working directory
 | 
			
		||||
  t.strictEqual(path.resolve(''), pwd);
 | 
			
		||||
  t.strictEqual(path.resolve('', ''), pwd);
 | 
			
		||||
  t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
tape('path.relative zero-length', function (t) {
 | 
			
		||||
  // relative, internally calls resolve. So, '' is actually the current directory
 | 
			
		||||
  t.strictEqual(path.relative('', pwd), '');
 | 
			
		||||
  t.strictEqual(path.relative(pwd, ''), '');
 | 
			
		||||
  t.strictEqual(path.relative(pwd, pwd), '');
 | 
			
		||||
  t.end();
 | 
			
		||||
});
 | 
			
		||||
							
								
								
									
										107
									
								
								node_modules/path-browserify/test/test-path.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										107
									
								
								node_modules/path-browserify/test/test-path.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,107 @@
 | 
			
		||||
// Copyright Joyent, Inc. and other Node contributors.
 | 
			
		||||
//
 | 
			
		||||
// Permission is hereby granted, free of charge, to any person obtaining a
 | 
			
		||||
// copy of this software and associated documentation files (the
 | 
			
		||||
// "Software"), to deal in the Software without restriction, including
 | 
			
		||||
// without limitation the rights to use, copy, modify, merge, publish,
 | 
			
		||||
// distribute, sublicense, and/or sell copies of the Software, and to permit
 | 
			
		||||
// persons to whom the Software is furnished to do so, subject to the
 | 
			
		||||
// following conditions:
 | 
			
		||||
//
 | 
			
		||||
// The above copyright notice and this permission notice shall be included
 | 
			
		||||
// in all copies or substantial portions of the Software.
 | 
			
		||||
//
 | 
			
		||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 | 
			
		||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 | 
			
		||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
 | 
			
		||||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
 | 
			
		||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
 | 
			
		||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
 | 
			
		||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
 | 
			
		||||
 | 
			
		||||
'use strict';
 | 
			
		||||
var tape = require('tape');
 | 
			
		||||
var path = require('../');
 | 
			
		||||
 | 
			
		||||
// Test thrown TypeErrors
 | 
			
		||||
var typeErrorTests = [true, false, 7, null, {}, undefined, [], NaN];
 | 
			
		||||
 | 
			
		||||
function fail(t, fn) {
 | 
			
		||||
  var args = [].slice.call(arguments, 1);
 | 
			
		||||
 | 
			
		||||
  t.throws(function () {
 | 
			
		||||
    fn.apply(null, args);
 | 
			
		||||
  }, TypeError);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
tape('path.posix TypeErrors', function (t) {
 | 
			
		||||
  typeErrorTests.forEach(function (test) {
 | 
			
		||||
    fail(t, path.posix.join, test);
 | 
			
		||||
    fail(t, path.posix.resolve, test);
 | 
			
		||||
    fail(t, path.posix.normalize, test);
 | 
			
		||||
    fail(t, path.posix.isAbsolute, test);
 | 
			
		||||
    fail(t, path.posix.relative, test, 'foo');
 | 
			
		||||
    fail(t, path.posix.relative, 'foo', test);
 | 
			
		||||
    fail(t, path.posix.parse, test);
 | 
			
		||||
    fail(t, path.posix.dirname, test);
 | 
			
		||||
    fail(t, path.posix.basename, test);
 | 
			
		||||
    fail(t, path.posix.extname, test);
 | 
			
		||||
 | 
			
		||||
    // undefined is a valid value as the second argument to basename
 | 
			
		||||
    if (test !== undefined) {
 | 
			
		||||
      fail(t, path.posix.basename, 'foo', test);
 | 
			
		||||
    }
 | 
			
		||||
  });
 | 
			
		||||
  t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
tape('path.win32 TypeErrors', { skip: true }, function (t) {
 | 
			
		||||
  typeErrorTests.forEach(function (test) {
 | 
			
		||||
    fail(t, path.win32.join, test);
 | 
			
		||||
    fail(t, path.win32.resolve, test);
 | 
			
		||||
    fail(t, path.win32.normalize, test);
 | 
			
		||||
    fail(t, path.win32.isAbsolute, test);
 | 
			
		||||
    fail(t, path.win32.relative, test, 'foo');
 | 
			
		||||
    fail(t, path.win32.relative, 'foo', test);
 | 
			
		||||
    fail(t, path.win32.parse, test);
 | 
			
		||||
    fail(t, path.win32.dirname, test);
 | 
			
		||||
    fail(t, path.win32.basename, test);
 | 
			
		||||
    fail(t, path.win32.extname, test);
 | 
			
		||||
 | 
			
		||||
    // undefined is a valid value as the second argument to basename
 | 
			
		||||
    if (test !== undefined) {
 | 
			
		||||
      fail(t, path.win32.basename, 'foo', test);
 | 
			
		||||
    }
 | 
			
		||||
  });
 | 
			
		||||
  t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
// path.sep tests
 | 
			
		||||
tape('path.win32.sep', { skip: true }, function (t) {
 | 
			
		||||
  // windows
 | 
			
		||||
  t.strictEqual(path.win32.sep, '\\');
 | 
			
		||||
  t.end();
 | 
			
		||||
});
 | 
			
		||||
tape('path.posix.sep', function (t) {
 | 
			
		||||
  // posix
 | 
			
		||||
  t.strictEqual(path.posix.sep, '/');
 | 
			
		||||
  t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
// path.delimiter tests
 | 
			
		||||
tape('path.win32.delimiter', { skip: true }, function (t) {
 | 
			
		||||
  // windows
 | 
			
		||||
  t.strictEqual(path.win32.delimiter, ';');
 | 
			
		||||
  t.end();
 | 
			
		||||
});
 | 
			
		||||
tape('path.posix.delimiter', function (t) {
 | 
			
		||||
  // posix
 | 
			
		||||
  t.strictEqual(path.posix.delimiter, ':');
 | 
			
		||||
  t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
tape('path', function (t) {
 | 
			
		||||
  t.strictEqual(path, path.posix);
 | 
			
		||||
  t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user