diff options
| author | Hisham Muhammad <hisham@gobolinux.org> | 2019-06-03 15:59:02 -0300 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2019-06-03 18:48:42 -0300 |
| commit | f7eb8df5363430a2b5ac288da5710ff382c632fe (patch) | |
| tree | 845af133ab8488ebca14ba52c88abf54c0cc2610 /spec | |
| parent | 7b82ed24f4409ca4c2401eac479a66ad6020f547 (diff) | |
| download | luarocks-f7eb8df5363430a2b5ac288da5710ff382c632fe.tar.gz luarocks-f7eb8df5363430a2b5ac288da5710ff382c632fe.tar.bz2 luarocks-f7eb8df5363430a2b5ac288da5710ff382c632fe.zip | |
Tests: add a couple of tests for dir.normalize
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/dir_spec.lua | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/spec/dir_spec.lua b/spec/dir_spec.lua index 08fb6e23..249f8aba 100644 --- a/spec/dir_spec.lua +++ b/spec/dir_spec.lua | |||
| @@ -31,12 +31,23 @@ describe("Luarocks dir test #unit", function() | |||
| 31 | end) | 31 | end) |
| 32 | 32 | ||
| 33 | describe("dir.deduce_base_dir", function() | 33 | describe("dir.deduce_base_dir", function() |
| 34 | assert.are.same("v0.3", dir.deduce_base_dir("https://example.com/hishamhm/lua-compat-5.2/archive/v0.3.zip")) | 34 | it("deduces the base dir from archives", function() |
| 35 | assert.are.same("lua-compat-5.2", dir.deduce_base_dir("https://example.com/hishamhm/lua-compat-5.2.zip")) | 35 | assert.are.same("v0.3", dir.deduce_base_dir("https://example.com/hishamhm/lua-compat-5.2/archive/v0.3.zip")) |
| 36 | assert.are.same("lua-compat-5.2", dir.deduce_base_dir("https://example.com/hishamhm/lua-compat-5.2.tar.gz")) | 36 | assert.are.same("lua-compat-5.2", dir.deduce_base_dir("https://example.com/hishamhm/lua-compat-5.2.zip")) |
| 37 | assert.are.same("lua-compat-5.2", dir.deduce_base_dir("https://example.com/hishamhm/lua-compat-5.2.tar.bz2")) | 37 | assert.are.same("lua-compat-5.2", dir.deduce_base_dir("https://example.com/hishamhm/lua-compat-5.2.tar.gz")) |
| 38 | assert.are.same("parser.moon", dir.deduce_base_dir("git://example.com/Cirru/parser.moon")) | 38 | assert.are.same("lua-compat-5.2", dir.deduce_base_dir("https://example.com/hishamhm/lua-compat-5.2.tar.bz2")) |
| 39 | assert.are.same("v0.3", dir.deduce_base_dir("https://example.com/hishamhm/lua-compat-5.2/archive/v0.3")) | 39 | end) |
| 40 | it("returns the basename when not given an archive", function() | ||
| 41 | assert.are.same("parser.moon", dir.deduce_base_dir("git://example.com/Cirru/parser.moon")) | ||
| 42 | assert.are.same("v0.3", dir.deduce_base_dir("https://example.com/hishamhm/lua-compat-5.2/archive/v0.3")) | ||
| 43 | end) | ||
| 44 | end) | ||
| 45 | |||
| 46 | describe("dir.normalize", function() | ||
| 47 | it("converts backslashes and removes trailing slashes", function() | ||
| 48 | assert.are.same("/foo/ovo", dir.normalize("\\foo\\ovo\\")) | ||
| 49 | assert.are.same("http://example.com/foo/ovo", dir.normalize("http://example.com/foo\\ovo\\")) | ||
| 50 | end) | ||
| 40 | end) | 51 | end) |
| 41 | 52 | ||
| 42 | end) | 53 | end) |
