Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F4435023
path.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
path.js
View Options
import
{
test
,
summary
}
from
'./helpers.js'
;
import
path
from
'ant:path'
;
import
nodePathPosix
from
'node:path/posix'
;
import
antPathPosix
from
'ant:path/posix'
;
import
barePathPosix
from
'path/posix'
;
console
.
log
(
'Path Tests\n'
);
test
(
'path.join'
,
path
.
join
(
'a'
,
'b'
,
'c'
),
'a/b/c'
);
test
(
'path.join with .'
,
path
.
join
(
'a'
,
'.'
,
'b'
),
'a/b'
);
test
(
'path.join with ..'
,
path
.
join
(
'a'
,
'b'
,
'..'
,
'c'
),
'a/c'
);
test
(
'path.resolve absolute'
,
path
.
resolve
(
'/a'
,
'b'
),
'/a/b'
);
test
(
'path.resolve relative'
,
typeof
path
.
resolve
(
'a'
,
'b'
),
'string'
);
test
(
'path.dirname'
,
path
.
dirname
(
'/a/b/c.txt'
),
'/a/b'
);
test
(
'path.basename'
,
path
.
basename
(
'/a/b/c.txt'
),
'c.txt'
);
test
(
'path.basename with ext'
,
path
.
basename
(
'/a/b/c.txt'
,
'.txt'
),
'c'
);
test
(
'path.extname'
,
path
.
extname
(
'/a/b/c.txt'
),
'.txt'
);
test
(
'path.extname no ext'
,
path
.
extname
(
'/a/b/c'
),
''
);
test
(
'path.isAbsolute true'
,
path
.
isAbsolute
(
'/a/b'
),
true
);
test
(
'path.isAbsolute false'
,
path
.
isAbsolute
(
'a/b'
),
false
);
test
(
'path.normalize'
,
path
.
normalize
(
'/a/b/../c/./d'
),
'/a/c/d'
);
const
parsed
=
path
.
parse
(
'/home/user/file.txt'
);
test
(
'path.parse root'
,
parsed
.
root
,
'/'
);
test
(
'path.parse dir'
,
parsed
.
dir
,
'/home/user'
);
test
(
'path.parse base'
,
parsed
.
base
,
'file.txt'
);
test
(
'path.parse name'
,
parsed
.
name
,
'file'
);
test
(
'path.parse ext'
,
parsed
.
ext
,
'.txt'
);
test
(
'path.format'
,
path
.
format
({
dir
:
'/home/user'
,
base
:
'file.txt'
}),
'/home/user/file.txt'
);
test
(
'path.sep'
,
path
.
sep
,
'/'
);
test
(
'path.delimiter'
,
path
.
delimiter
,
':'
);
test
(
'node:path/posix join'
,
nodePathPosix
.
join
(
'a'
,
'b'
),
'a/b'
);
test
(
'ant:path/posix sep'
,
antPathPosix
.
sep
,
'/'
);
test
(
'path/posix dirname'
,
barePathPosix
.
dirname
(
'/a/b/c.txt'
),
'/a/b'
);
summary
();
File Metadata
Details
Attached
Mime Type
application/javascript
Expires
Sat, May 2, 6:16 AM (1 d, 23 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
541904
Default Alt Text
path.js (1 KB)
Attached To
Mode
rANT Ant
Attached
Detach File
Event Timeline
Log In to Comment