1 # This file is part of NIT ( http://www.nitlanguage.org ).
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
7 # http://www.apache.org/licenses/LICENSE-2.0
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.
15 module test_commands_usage
is test
18 import doc
::commands
::commands_usage
20 class TestCommandsUsage
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
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
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
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
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
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