Improving path-join.
This commit is contained in:
@ -55,9 +55,11 @@ internals definitions
|
||||
0 value included-files
|
||||
|
||||
: path-join { a a# b b# -- a n }
|
||||
b if
|
||||
b c@ [char] / = if 0 to a# then
|
||||
then
|
||||
a# b# + { r# } r# cell+ cell+ allocate throw { r }
|
||||
2 cells +to r
|
||||
b c@ [char] / = if 0 to a# then
|
||||
begin b b# starts./ while
|
||||
2 +to b -2 +to b#
|
||||
a# b# + to r#
|
||||
|
||||
@ -53,3 +53,15 @@ e: test-needs
|
||||
out: x.fs 2
|
||||
out: x.fs 3
|
||||
;e
|
||||
|
||||
e: test-path-join
|
||||
also internals
|
||||
s" /foo/bar/" s" /" path-join s" /" str= assert
|
||||
s" /foo/bar/" s" baz" path-join s" /foo/bar/baz" str= assert
|
||||
s" /foo/bar/" s" ./baz" path-join s" /foo/bar/baz" str= assert
|
||||
s" /foo/bar/" s" ../baz" path-join s" /foo/baz" str= assert
|
||||
s" /foo/bar/" s" baz/qux" path-join s" /foo/bar/baz/qux" str= assert
|
||||
s" /foo/bar/" s" ./baz/qux" path-join s" /foo/bar/baz/qux" str= assert
|
||||
s" /foo/bar/" s" " path-join s" /foo/bar/" str= assert
|
||||
s" ./foo/" s" ../bar" path-join s" ./bar" str= assert
|
||||
;e
|
||||
|
||||
Reference in New Issue
Block a user