From a9ea4395bca05516e8297588ec943c648f726345 Mon Sep 17 00:00:00 2001 From: Deepak Singh Rathore Date: Wed, 23 Jun 2021 01:56:56 +0530 Subject: luarocks test: add --prepare flag (#1314) * Added prepare flag in test command * Added test for prepare flag in spec/test_spec.lua Fixes #1303 --- spec/test_spec.lua | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'spec') diff --git a/spec/test_spec.lua b/spec/test_spec.lua index 220ae632..943d0e48 100644 --- a/spec/test_spec.lua +++ b/spec/test_spec.lua @@ -70,6 +70,32 @@ describe("luarocks test #integration", function() -- Assert that busted ran, whether successfully or not assert.match("%d+ success.* / %d+ failure.* / %d+ error.* / %d+ pending", output) end) + + it("prepare", function() + finally(function() + -- delete downloaded and unpacked files + lfs.chdir(testing_paths.testrun_dir) + test_env.remove_dir("busted_project-0.1-1") + os.remove("busted_project-0.1-1.src.rock") + end) + + -- make luassert + assert.is_true(run.luarocks_bool("download --server="..testing_paths.fixtures_repo_dir.." busted_project 0.1-1")) + assert.is_true(run.luarocks_bool("unpack busted_project-0.1-1.src.rock")) + lfs.chdir("busted_project-0.1-1/busted_project") + assert.is_true(run.luarocks_bool("make")) + + run.luarocks_bool("remove busted") + local prepareOutput = run.luarocks_bool("test --prepare") + assert.is_true(run.luarocks_bool("show busted")) + + -- Assert that "test --prepare" run successfully + assert.is_true(prepareOutput) + + local output = run.luarocks("test") + assert.not_match(tostring(prepareOutput), output) + + end) end) end) -- cgit v1.2.3-55-g6feb