diff --git a/common/including.fs b/common/including.fs index dc0abf6..beaebe8 100644 --- a/common/including.fs +++ b/common/including.fs @@ -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# diff --git a/common/including_tests/including_tests.fs b/common/including_tests/including_tests.fs index d9c74da..eab7385 100644 --- a/common/including_tests/including_tests.fs +++ b/common/including_tests/including_tests.fs @@ -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