From b57ce08dce1efa471bc1ae5fad2f154bae426f75 Mon Sep 17 00:00:00 2001 From: Peter Melnichenko Date: Fri, 8 Jul 2016 16:00:57 +0300 Subject: Tests: move clean() into separate function, fix a pattern --- test/test_environment.lua | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/test/test_environment.lua b/test/test_environment.lua index 8cc8e295..94acf1c8 100644 --- a/test/test_environment.lua +++ b/test/test_environment.lua @@ -531,19 +531,23 @@ local function create_configs() write_file(test_env.testing_paths.testing_dir .. "/luacov.config", config_content) end +--- Remove testing directories. +local function clean() + print("Cleaning testing directory...") + test_env.remove_dir(test_env.testing_paths.luarocks_tmp) + test_env.remove_dir_pattern(test_env.testing_paths.testing_dir, "testing[_%-]") + test_env.remove_files(test_env.testing_paths.testing_dir, "testing_") + test_env.remove_files(test_env.testing_paths.testing_dir, "luacov") + print("Cleaning done!") +end + --- -- Main function to create config files and testing environment function test_env.main() local testing_paths = test_env.testing_paths if test_env.TEST_ENV_CLEAN then - print("Cleaning testing directory...") - test_env.remove_dir(testing_paths.luarocks_tmp) - test_env.remove_dir_pattern(testing_paths.testing_dir, "testing_") - test_env.remove_dir_pattern(testing_paths.testing_dir, "testing-") - test_env.remove_files(testing_paths.testing_dir, "testing_") - test_env.remove_files(testing_paths.testing_dir, "luacov") - print("Cleaning done!") + clean() end lfs.mkdir(testing_paths.testing_cache) -- cgit v1.2.3-55-g6feb