diff options
Diffstat (limited to 'spec/quick/purge.q')
-rw-r--r-- | spec/quick/purge.q | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/spec/quick/purge.q b/spec/quick/purge.q new file mode 100644 index 00000000..a3f24b99 --- /dev/null +++ b/spec/quick/purge.q | |||
@@ -0,0 +1,103 @@ | |||
1 | SUITE: luarocks purge | ||
2 | |||
3 | ================================================================================ | ||
4 | TEST: needs a --tree argument | ||
5 | RUN: luarocks purge | ||
6 | EXIT: 1 | ||
7 | |||
8 | ================================================================================ | ||
9 | TEST: missing tree | ||
10 | RUN: luarocks purge --tree=missing-tree | ||
11 | EXIT: 1 | ||
12 | |||
13 | ================================================================================ | ||
14 | TEST: missing --tree argument | ||
15 | RUN: luarocks purge --tree= | ||
16 | EXIT: 1 | ||
17 | |||
18 | |||
19 | ================================================================================ | ||
20 | TEST: runs | ||
21 | |||
22 | FILE: testrock-1.0-1.rockspec | ||
23 | -------------------------------------------------------------------------------- | ||
24 | package = "testrock" | ||
25 | version = "1.0-1" | ||
26 | source = { | ||
27 | url = "file://%{url(tmpdir)}/testrock.lua" | ||
28 | } | ||
29 | dependencies = { | ||
30 | "a_rock >= 0.8" | ||
31 | } | ||
32 | build = { | ||
33 | type = "builtin", | ||
34 | modules = { | ||
35 | testrock = "testrock.lua" | ||
36 | } | ||
37 | } | ||
38 | -------------------------------------------------------------------------------- | ||
39 | |||
40 | FILE: testrock.lua | ||
41 | -------------------------------------------------------------------------------- | ||
42 | return {} | ||
43 | -------------------------------------------------------------------------------- | ||
44 | |||
45 | RUN: luarocks build --only-server=%{fixtures_dir}/a_repo testrock-1.0-1.rockspec | ||
46 | |||
47 | EXISTS: %{testing_sys_rocks}/testrock | ||
48 | EXISTS: %{testing_sys_rocks}/a_rock | ||
49 | |||
50 | RUN: luarocks purge --tree=%{testing_sys_tree} | ||
51 | |||
52 | NOT_EXISTS: %{testing_sys_rocks}/testrock | ||
53 | NOT_EXISTS: %{testing_sys_rocks}/a_rock | ||
54 | |||
55 | |||
56 | |||
57 | ================================================================================ | ||
58 | TEST: works with missing files | ||
59 | |||
60 | FILE: testrock-1.0-1.rockspec | ||
61 | -------------------------------------------------------------------------------- | ||
62 | package = "testrock" | ||
63 | version = "1.0-1" | ||
64 | source = { | ||
65 | url = "file://%{url(tmpdir)}/testrock.lua" | ||
66 | } | ||
67 | dependencies = { | ||
68 | "a_rock >= 0.8" | ||
69 | } | ||
70 | build = { | ||
71 | type = "builtin", | ||
72 | modules = { | ||
73 | testrock = "testrock.lua" | ||
74 | } | ||
75 | } | ||
76 | -------------------------------------------------------------------------------- | ||
77 | |||
78 | FILE: testrock.lua | ||
79 | -------------------------------------------------------------------------------- | ||
80 | return {} | ||
81 | -------------------------------------------------------------------------------- | ||
82 | |||
83 | RUN: luarocks build --only-server=%{fixtures_dir}/a_repo testrock-1.0-1.rockspec | ||
84 | |||
85 | RMDIR: %{testing_sys_tree}/share/lua/%{lua_version}/testrock | ||
86 | |||
87 | RUN: luarocks purge --tree=%{testing_sys_tree} | ||
88 | |||
89 | NOT_EXISTS: %{testing_sys_rocks}/testrock | ||
90 | NOT_EXISTS: %{testing_sys_rocks}/a_rock | ||
91 | |||
92 | |||
93 | |||
94 | ================================================================================ | ||
95 | TEST: --old-versions | ||
96 | |||
97 | RUN: luarocks install --only-server=%{fixtures_dir}/a_repo a_rock 2.0 | ||
98 | RUN: luarocks install --only-server=%{fixtures_dir}/a_repo a_rock 1.0 --keep | ||
99 | |||
100 | RUN: luarocks purge --old-versions --tree=%{testing_sys_tree} | ||
101 | |||
102 | EXISTS: %{testing_sys_rocks}/a_rock/2.0-1 | ||
103 | NOT_EXISTS: %{testing_sys_rocks}/a_rock/1.0-1 | ||