src/doc/commands/templates: move `commands_json` to `json_commands`
[nit.git] / src / doc / commands / tests / test_commands_md.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 module test_commands_md is test
16
17 import test_commands
18 intrude import doc::commands::commands_main
19 import doc::commands::commands_md
20
21 class TestCommandsMd
22 super TestCommands
23 test
24
25 fun print_md(md: nullable Writable) do
26 if md == null then return
27 printn md
28 end
29
30 # CmdEntity
31
32 fun test_cmd_entity is test do
33 var cmd = new CmdEntity(test_model, mentity_name = "test_prog::Character")
34 cmd.init_command
35 print_md cmd.to_md
36 end
37
38 fun test_cmd_comment is test do
39 var cmd = new CmdComment(test_model, mentity_name = "test_prog::Character")
40 cmd.init_command
41 print_md cmd.to_md
42 end
43
44 fun test_cmd_link is test do
45 var cmd = new CmdEntityLink(test_model, mentity_name = "test_prog::Character")
46 cmd.init_command
47 print_md cmd.to_md
48 end
49
50 # CmdInheritance
51
52 fun test_cmd_parents is test do
53 var cmd = new CmdParents(test_model, test_main, mentity_name = "test_prog::Warrior")
54 cmd.init_command
55 print_md cmd.to_md
56 end
57
58 fun test_cmd_ancestors is test do
59 var cmd = new CmdAncestors(test_model, test_main, mentity_name = "test_prog::Warrior", parents = false)
60 cmd.init_command
61 print_md cmd.to_md
62 end
63
64 fun test_cmd_children is test do
65 var cmd = new CmdChildren(test_model, test_main, mentity_name = "test_prog::Career")
66 cmd.init_command
67 print_md cmd.to_md
68 end
69
70 fun test_cmd_descendants is test do
71 var cmd = new CmdDescendants(test_model, test_main, mentity_name = "test_prog::Career")
72 cmd.init_command
73 print_md cmd.to_md
74 end
75
76 # CmdSearch
77
78 fun test_cmd_search is test do
79 var cmd = new CmdSearch(test_model, query = "Carer", limit = 10)
80 cmd.init_command
81 print_md cmd.to_md
82 end
83
84 # CmdFeatures
85
86 fun test_cmd_features is test do
87 var cmd = new CmdFeatures(test_model, mentity_name = "test_prog::Career")
88 cmd.init_command
89 print_md cmd.to_md
90 end
91
92 # CmdLinearization
93
94 fun test_cmd_lin is test do
95 var cmd = new CmdLinearization(test_model, test_main, mentity_name = "init")
96 cmd.init_command
97 print_md cmd.to_md
98 end
99
100 # CmdModel
101
102 fun test_cmd_mentities is test do
103 var cmd = new CmdModelEntities(test_model, kind = "modules")
104 cmd.init_command
105 print_md cmd.to_md
106 end
107
108 # CmdUsage
109
110 fun test_cmd_new is test do
111 var cmd = new CmdNew(test_model, test_builder, mentity_name = "test_prog::Character")
112 cmd.init_command
113 print_md cmd.to_md
114 end
115
116 fun test_cmd_call is test do
117 var cmd = new CmdCall(test_model, test_builder, mentity_name = "strength_bonus")
118 cmd.init_command
119 print_md cmd.to_md
120 end
121
122 fun test_cmd_return is test do
123 var cmd = new CmdReturn(test_model, mentity_name = "test_prog::Character")
124 cmd.init_command
125 print_md cmd.to_md
126 end
127
128 fun test_cmd_param is test do
129 var cmd = new CmdParam(test_model, mentity_name = "test_prog::Character")
130 cmd.init_command
131 print_md cmd.to_md
132 end
133
134 # CmdIni
135
136 fun test_cmd_ini_desc is test do
137 var cmd = new CmdIniDescription(test_model, mentity_name = "test_prog")
138 cmd.init_command
139 print_md cmd.to_md
140 end
141
142 fun test_cmd_ini_git is test do
143 var cmd = new CmdIniGitUrl(test_model, mentity_name = "test_prog")
144 cmd.init_command
145 print_md cmd.to_md
146 end
147
148 fun test_cmd_ini_clone is test do
149 var cmd = new CmdIniCloneCommand(test_model, mentity_name = "test_prog")
150 cmd.init_command
151 print_md cmd.to_md
152 end
153
154 fun test_cmd_ini_issues is test do
155 var cmd = new CmdIniIssuesUrl(test_model, mentity_name = "test_prog")
156 cmd.init_command
157 print_md cmd.to_md
158 end
159
160 fun test_cmd_ini_maintainer is test do
161 var cmd = new CmdIniMaintainer(test_model, mentity_name = "test_prog")
162 cmd.init_command
163 print_md cmd.to_md
164 end
165
166 fun test_cmd_ini_contributors is test do
167 var cmd = new CmdIniContributors(test_model, mentity_name = "test_prog")
168 cmd.init_command
169 print_md cmd.to_md
170 end
171
172 fun test_cmd_ini_license is test do
173 var cmd = new CmdIniLicense(test_model, mentity_name = "test_prog")
174 cmd.init_command
175 print_md cmd.to_md
176 end
177
178 fun test_cmd_ini_license_file is test do
179 var cmd = new CmdLicenseFile(test_model, mentity_name = "test_prog")
180 cmd.init_command
181 cmd.file = cmd.file.as(not null).basename # for testing path
182 print_md cmd.to_md
183 end
184
185 fun test_cmd_ini_license_file_content is test do
186 var cmd = new CmdLicenseFileContent(test_model, mentity_name = "test_prog")
187 cmd.init_command
188 cmd.file = cmd.file.as(not null).basename # for testing path
189 print_md cmd.to_md
190 end
191
192 fun test_cmd_ini_contrib_file is test do
193 var cmd = new CmdContribFile(test_model, mentity_name = "test_prog")
194 cmd.init_command
195 cmd.file = cmd.file.as(not null).basename # for testing path
196 print_md cmd.to_md
197 end
198
199 fun test_cmd_ini_contrib_file_content is test do
200 var cmd = new CmdContribFileContent(test_model, mentity_name = "test_prog")
201 cmd.init_command
202 cmd.file = cmd.file.as(not null).basename # for testing path
203 print_md cmd.to_md
204 end
205
206 # CmdMain
207
208 fun test_cmd_mains is test do
209 var cmd = new CmdMains(test_model, mentity_name = "test_prog")
210 cmd.init_command
211 print_md cmd.to_md
212 end
213
214 fun test_cmd_main_compile is test do
215 var cmd = new CmdMainCompile(test_model, mentity_name = "test_prog::test_prog")
216 cmd.init_command
217 print_md cmd.to_md
218 end
219
220 fun test_cmd_testing is test do
221 var cmd = new CmdTesting(test_model, mentity_name = "test_prog")
222 cmd.init_command
223 print_md cmd.to_md
224 end
225
226 fun test_cmd_man_synopsis is test do
227 var cmd = new CmdManSynopsis(test_model, mentity_name = "test_prog")
228 cmd.init_command
229 print_md cmd.to_md
230 end
231
232 fun test_cmd_man_options is test do
233 var cmd = new CmdManOptions(test_model, mentity_name = "test_prog")
234 cmd.init_command
235 print_md cmd.to_md
236 end
237 end
238
239 # Avoid path diff
240 redef class CmdMainCompile
241 redef fun test_path(file) do
242 if file == null then return null
243 return file.filename.basename
244 end
245 end
246
247 # Avoid path diff
248 redef class CmdTesting
249 redef fun test_path(mentity) do
250 var file = mentity.location.file
251 if file == null then return null
252 return file.filename.basename
253 end
254 end