diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2019-12-02 17:21:20 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2019-12-12 15:38:28 -0300 |
commit | 129ebf34efa945b2b56a29c80b161414a98757a8 (patch) | |
tree | 3465103deec491798430fc85308ecf22244452ec /spec | |
parent | c9292f6b699fa1edba46a1cbeaa582e7dac2f8c6 (diff) | |
download | luarocks-129ebf34efa945b2b56a29c80b161414a98757a8.tar.gz luarocks-129ebf34efa945b2b56a29c80b161414a98757a8.tar.bz2 luarocks-129ebf34efa945b2b56a29c80b161414a98757a8.zip |
win32: fix split root for quoted absolute path handling
Diffstat (limited to 'spec')
-rw-r--r-- | spec/fs_spec.lua | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/fs_spec.lua b/spec/fs_spec.lua index e3643f78..5d8926c4 100644 --- a/spec/fs_spec.lua +++ b/spec/fs_spec.lua | |||
@@ -88,6 +88,40 @@ describe("Luarocks fs test #unit", function() | |||
88 | assert.are.same(is_win and [["\\"%" \\\\" \\\\\\"]] or [['\% \\" \\\']], fs.Q([[\% \\" \\\]])) | 88 | assert.are.same(is_win and [["\\"%" \\\\" \\\\\\"]] or [['\% \\" \\\']], fs.Q([[\% \\" \\\]])) |
89 | end) | 89 | end) |
90 | end) | 90 | end) |
91 | |||
92 | describe("fs.absolute_name", function() | ||
93 | it("unchanged if already absolute", function() | ||
94 | if is_win then | ||
95 | assert.are.same("c:\\foo\\bar", fs.absolute_name("\"c:\\foo\\bar\"")) | ||
96 | assert.are.same("c:\\foo\\bar", fs.absolute_name("c:\\foo\\bar")) | ||
97 | assert.are.same("d:\\foo\\bar", fs.absolute_name("d:\\foo\\bar")) | ||
98 | assert.are.same("\\foo\\bar", fs.absolute_name("\\foo\\bar")) | ||
99 | else | ||
100 | assert.are.same("/foo/bar", fs.absolute_name("/foo/bar")) | ||
101 | end | ||
102 | end) | ||
103 | |||
104 | it("converts to absolute if relative", function() | ||
105 | local cur = fs.current_dir() | ||
106 | if is_win then | ||
107 | assert.are.same(cur .. "/foo\\bar", fs.absolute_name("\"foo\\bar\"")) | ||
108 | assert.are.same(cur .. "/foo\\bar", fs.absolute_name("foo\\bar")) | ||
109 | else | ||
110 | assert.are.same(cur .. "/foo/bar", fs.absolute_name("foo/bar")) | ||
111 | end | ||
112 | end) | ||
113 | |||
114 | it("converts a relative to specified base if given", function() | ||
115 | if is_win then | ||
116 | assert.are.same("c:\\bla/foo\\bar", fs.absolute_name("\"foo\\bar\"", "c:\\bla")) | ||
117 | assert.are.same("c:\\bla/foo\\bar", fs.absolute_name("foo\\bar", "c:\\bla")) | ||
118 | assert.are.same("c:\\bla/foo\\bar", fs.absolute_name("foo\\bar", "c:\\bla\\")) | ||
119 | else | ||
120 | assert.are.same("/bla/foo/bar", fs.absolute_name("foo/bar", "/bla")) | ||
121 | assert.are.same("/bla/foo/bar", fs.absolute_name("foo/bar", "/bla/")) | ||
122 | end | ||
123 | end) | ||
124 | end) | ||
91 | 125 | ||
92 | describe("fs.execute_string", function() | 126 | describe("fs.execute_string", function() |
93 | local tmpdir | 127 | local tmpdir |