Skip to content

Commit 63077e8

Browse files
author
rwh
committed
add more tricky slash tests
1 parent 64a8061 commit 63077e8

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/unix_path.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,18 @@ def assert_filenames(cases)
161161
expect(muimmu.to_s).must_equal '/etc/systemd/var/lib'
162162
end
163163

164+
it "handles complex slash chains with strings" do
165+
# start with an abspath dir
166+
path1 = UnixPath.parse('/home/user/')
167+
result1 = path1 / 'docs/project' / 'file.txt'
168+
expect(result1.to_s).must_equal '/home/user/docs/project/file.txt'
169+
170+
# start with a relpath file
171+
path2 = UnixPath.parse('./relative/path')
172+
result2 = path2 / 'more/dirs/' / '/etc/passwd'
173+
expect(result2.to_s).must_equal './relative/path/more/dirs/etc/passwd'
174+
end
175+
164176
describe 'empty filename' do
165177
it "indicates a directory when empty" do
166178
path = UnixPath.parse("/home/user/docs/")

0 commit comments

Comments
 (0)