aboutsummaryrefslogtreecommitdiff
path: root/spec/quick/purge.q
blob: 1fb61293415cddae19c3d0add682d714b452b760 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
SUITE: luarocks purge

================================================================================
TEST: needs a --tree argument
RUN: luarocks purge
EXIT: 1

================================================================================
TEST: missing tree
RUN: luarocks purge --tree=missing-tree
EXIT: 1

================================================================================
TEST: missing --tree argument
RUN: luarocks purge --tree=
EXIT: 1


================================================================================
TEST: runs

FILE: testrock-1.0-1.rockspec
--------------------------------------------------------------------------------
package = "testrock"
version = "1.0-1"
source = {
   url = "file://%{url(%{tmpdir})}/testrock.lua"
}
dependencies = {
   "a_rock >= 0.8"
}
build = {
   type = "builtin",
   modules = {
      testrock = "testrock.lua"
   }
}
--------------------------------------------------------------------------------

FILE: testrock.lua
--------------------------------------------------------------------------------
return {}
--------------------------------------------------------------------------------

RUN: luarocks build --only-server=%{fixtures_dir}/a_repo testrock-1.0-1.rockspec

EXISTS: %{testing_sys_rocks}/testrock
EXISTS: %{testing_sys_rocks}/a_rock

RUN: luarocks purge --tree=%{testing_sys_tree}

NOT_EXISTS: %{testing_sys_rocks}/testrock
NOT_EXISTS: %{testing_sys_rocks}/a_rock



================================================================================
TEST: works with missing files

FILE: testrock-1.0-1.rockspec
--------------------------------------------------------------------------------
package = "testrock"
version = "1.0-1"
source = {
   url = "file://%{url(%{tmpdir})}/testrock.lua"
}
dependencies = {
   "a_rock >= 0.8"
}
build = {
   type = "builtin",
   modules = {
      testrock = "testrock.lua"
   }
}
--------------------------------------------------------------------------------

FILE: testrock.lua
--------------------------------------------------------------------------------
return {}
--------------------------------------------------------------------------------

RUN: luarocks build --only-server=%{fixtures_dir}/a_repo testrock-1.0-1.rockspec

RMDIR: %{testing_sys_tree}/share/lua/%{lua_version}/testrock

RUN: luarocks purge --tree=%{testing_sys_tree}

NOT_EXISTS: %{testing_sys_rocks}/testrock
NOT_EXISTS: %{testing_sys_rocks}/a_rock



================================================================================
TEST: --old-versions

RUN: luarocks install --only-server=%{fixtures_dir}/a_repo a_rock 2.0
RUN: luarocks install --only-server=%{fixtures_dir}/a_repo a_rock 1.0 --keep

RUN: luarocks purge --old-versions --tree=%{testing_sys_tree}

EXISTS: %{testing_sys_rocks}/a_rock/2.0-1
NOT_EXISTS: %{testing_sys_rocks}/a_rock/1.0-1