diff options
Diffstat (limited to 'spec/util_spec.lua')
| -rw-r--r-- | spec/util_spec.lua | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/util_spec.lua b/spec/util_spec.lua index cbdde095..930a5aea 100644 --- a/spec/util_spec.lua +++ b/spec/util_spec.lua | |||
| @@ -155,4 +155,18 @@ describe("Luarocks util test #unit", function() | |||
| 155 | assert.truthy(result:find("[\"e\"] = \"4\"", 1, true)) | 155 | assert.truthy(result:find("[\"e\"] = \"4\"", 1, true)) |
| 156 | end) | 156 | end) |
| 157 | end) | 157 | end) |
| 158 | |||
| 159 | describe("core.util.cleanup_path", function() | ||
| 160 | it("rewrites versions that do not match the provided version", function() | ||
| 161 | local expected = 'a/b/lua/5.3/?.lua;a/b/c/lua/5.3/?.lua' | ||
| 162 | local result = core_util.cleanup_path('a/b/lua/5.2/?.lua;a/b/c/lua/5.3/?.lua', ';', '5.3') | ||
| 163 | assert.are.equal(expected, result) | ||
| 164 | end) | ||
| 165 | |||
| 166 | it("does not rewrite versions for which the provided version is a substring", function() | ||
| 167 | local expected = 'a/b/lua/5.3/?.lua;a/b/c/lua/5.3.4/?.lua' | ||
| 168 | local result = core_util.cleanup_path('a/b/lua/5.2/?.lua;a/b/c/lua/5.3.4/?.lua', ';', '5.3') | ||
| 169 | assert.are.equal(expected, result) | ||
| 170 | end) | ||
| 171 | end) | ||
| 158 | end) | 172 | end) |
