Merge: gamnit: new services and a lot of bug fixes and performance improvements
[nit.git] / src / doc / commands / tests / test_commands_usage.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_usage is test
16
17 import test_commands
18 import doc::commands::commands_usage
19
20 class TestCommandsUsage
21 super TestCommands
22 test
23
24 fun test_cmd_new is test do
25 var cmd = new CmdNew(test_view, test_builder, mentity_name = "test_prog::Character")
26 var res = cmd.init_command
27 assert res isa CmdSuccess
28 assert cmd.results != null
29 end
30
31 fun test_cmd_new_not_class is test do
32 var cmd = new CmdNew(test_view, test_builder, mentity_name = "strength_bonus")
33 var res = cmd.init_command
34 assert res isa ErrorNotClass
35 end
36
37 fun test_cmd_call is test do
38 var cmd = new CmdCall(test_view, test_builder, mentity_name = "strength_bonus")
39 var res = cmd.init_command
40 assert res isa CmdSuccess
41 assert cmd.results != null
42 end
43
44 fun test_cmd_call_not_prop is test do
45 var cmd = new CmdCall(test_view, test_builder, mentity_name = "test_prog::Character")
46 var res = cmd.init_command
47 assert res isa ErrorNotProperty
48 end
49
50 fun test_cmd_return is test do
51 var cmd = new CmdReturn(test_view, mentity_name = "test_prog::Character")
52 var res = cmd.init_command
53 assert res isa CmdSuccess
54 assert cmd.results != null
55 end
56
57 fun test_cmd_param is test do
58 var cmd = new CmdParam(test_view, mentity_name = "test_prog::Character")
59 var res = cmd.init_command
60 assert res isa CmdSuccess
61 assert cmd.results != null
62 end
63 end