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 # Nitunit for doc commands
21 # Nitunit test suite specific to commands
24 # The path to the testunit being executed
26 # Used to retrieve the path to sources to compile.
27 var test_path
: String = "NIT_TESTING_PATH".environ
.dirname
is lazy
29 # Test program to compile
31 # Default is `$NIT_DIR/tests/test_prog`.
32 var test_src
: String = test_path
/ "../../../../tests/test_prog" is lazy
34 # ModelView used for tests
35 var test_view
: ModelView is noinit
37 # ModelBuilder used for tests
38 var test_builder
: ModelBuilder is noinit
40 # Initialize test variables
42 # Must be called before test execution.
43 # FIXME should be before_all
44 fun build_test_env
is before
do
45 var toolcontext
= new ToolContext
49 var modelbuilder
= new ModelBuilder(model
, toolcontext
)
50 var mmodules
= modelbuilder
.parse_full
([test_src
])
53 modelbuilder
.run_phases
54 toolcontext
.run_global_phases
(mmodules
)
55 var mainmodule
= toolcontext
.make_main_module
(mmodules
)
58 var filters
= new ModelFilter(
60 accept_fictive
= false,
63 test_builder
= modelbuilder
64 test_view
= new ModelView(model
, mainmodule
, filters
)