Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2919743
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'
;
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
,
':'
);
summary
();
File Metadata
Details
Attached
Mime Type
application/javascript
Expires
Fri, Mar 27, 4:20 AM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
512309
Default Alt Text
path.js (1 KB)
Attached To
Mode
rANT Ant
Attached
Detach File
Event Timeline
Log In to Comment