Debian Codegraph @

test/blackbox-tests/test-cases/describe/aliases.t/run.t

raw
1 Testing the "dune show aliases" command. This command shows the aliases in the
2 current directory. It acts similarly to ls. It will not show aliases that appear
3 in subdirectories although this could be changed in the future.
4
5 In an empty dune project, the following aliases are available.
6
7 $ dune show aliases
8 all
9 default
10 fmt
11 ocaml-index
12 pkg-install
13 revdep
14 revdep-check
15 revdep-install
16 revdep-runtest
17
18 User defined aliases can be added to a dune file. These should be picked up by
19 the command.
20
21 $ cat > dune << EOF
22 > (alias
23 > (name foo))
24 > EOF
25
26 $ dune show aliases
27 all
28 default
29 fmt
30 foo
31 ocaml-index
32 pkg-install
33 revdep
34 revdep-check
35 revdep-install
36 revdep-runtest
37
38 Aliases in subdirectories should not be picked up.
39
40 $ mkdir subdir
41 $ cat > subdir/dune << EOF
42 > (alias
43 > (name bar))
44 > EOF
45
46 $ dune show aliases
47 all
48 default
49 fmt
50 foo
51 ocaml-index
52 pkg-install
53 revdep
54 revdep-check
55 revdep-install
56 revdep-runtest
57
58 But checking the subdirectory it should be available.
59
60 $ dune show aliases subdir
61 all
62 bar
63 default
64 fmt
65 revdep
66 revdep-check
67 revdep-install
68 revdep-runtest
69
70 Adding an OCaml library will introduce OCaml specific aliases:
71
72 $ cat > dune << EOF
73 > (library
74 > (name foo))
75 > EOF
76
77 $ dune show aliases
78 all
79 check
80 default
81 doc-private
82 fmt
83 ocaml-index
84 pkg-install
85 revdep
86 revdep-check
87 revdep-install
88 revdep-runtest
89 unused-libs
90
91 Adding a cram test will introduce an alias with the name of the test and also
92 introduce the runtest alias:
93 bbb
94 $ rm dune
95 $ cat > mytest.t
96
97 $ dune show aliases
98 all
99 default
100 fmt
101 mytest
102 ocaml-index
103 pkg-install
104 revdep
105 revdep-check
106 revdep-install
107 revdep-runtest
108 runtest
109
110 We can also show aliases in multiple directories at once:
111
112 $ dune show aliases . subdir
113 .:
114 all
115 default
116 fmt
117 mytest
118 ocaml-index
119 pkg-install
120 revdep
121 revdep-check
122 revdep-install
123 revdep-runtest
124 runtest
125
126 subdir:
127 all
128 bar
129 default
130 fmt
131 revdep
132 revdep-check
133 revdep-install
134 revdep-runtest
135
136 Including those in the _build/ directory:
137
138 $ dune build
139 $ dune show aliases . _build/default
140 .:
141 all
142 default
143 fmt
144 mytest
145 ocaml-index
146 pkg-install
147 revdep
148 revdep-check
149 revdep-install
150 revdep-runtest
151 runtest
152
153 _build/default:
154 all
155 default
156 fmt
157 mytest
158 ocaml-index
159 pkg-install
160 revdep
161 revdep-check
162 revdep-install
163 revdep-runtest
164 runtest
165
166 These are context sensitive:
167
168 $ cat > dune-workspace << EOF
169 > (lang dune 3.9)
170 > (context
171 > (default
172 > (name other_context)))
173 > EOF
174
175 $ dune show aliases --context other_context _build/default
176 Error: Directory _build/default is not in context "other_context".
177
178 $ dune show aliases --context other_context _build/other_context
179 all
180 default
181 fmt
182 mytest
183 pkg-install
184 revdep
185 revdep-check
186 revdep-install
187 revdep-runtest
188 runtest