From a5fd1ba0661c78526bcb90acd92c2b268d17acdd Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Sun, 14 Jul 2019 14:42:00 -0400 Subject: [PATCH] indexing: Use `test_frontend` Signed-off-by: Alexandre Terrasa --- src/indexing/tests/test_code_index.nit | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/src/indexing/tests/test_code_index.nit b/src/indexing/tests/test_code_index.nit index b2a8f2e..fda1b50 100644 --- a/src/indexing/tests/test_code_index.nit +++ b/src/indexing/tests/test_code_index.nit @@ -15,37 +15,21 @@ module test_code_index is test import code_index -import frontend +import test_frontend class TestCodeIndex + super TestModel test # CodeIndex used in tests - var test_index: CodeIndex is noinit + var test_index = new CodeIndex(test_context) - # Initialize test variables - # - # Must be called before test execution. - # FIXME should be before_all - fun build_test_env is before do - var test_path = "NIT_TESTING_PATH".environ.dirname - var test_src = test_path / "../../../tests/test_prog" - - # build model - var toolcontext = new ToolContext - var model = new Model - var modelbuilder = new ModelBuilder(model, toolcontext) - var mmodules = modelbuilder.parse_full([test_src]) - modelbuilder.run_phases - toolcontext.run_global_phases(mmodules) - - # create index - var index = new CodeIndex(toolcontext) - for mmodule in mmodules do - index.index_mentity(mmodule) + redef fun build_test_env do + super + for mmodule in test_model.mmodules do + test_index.index_mentity(mmodule) end - test_index = index - modelbuilder.paths.add test_src + test_builder.paths.add test_src end fun test_find1 is test do -- 1.7.9.5