aboutsummaryrefslogtreecommitdiffstats
path: root/conf.d/controller/lua.d/aft.lua
diff options
context:
space:
mode:
authorCorentin Le Gall <corentinlgs@gmail.com>2018-07-11 15:56:16 +0200
committerCorentin Le Gall <corentinlgs@gmail.com>2018-07-17 14:03:43 +0200
commitde3438a1e6522c6eb239b5642116a8652df3de23 (patch)
treec21ae29a356e1ce6e2fa03dc616523c5187d8272 /conf.d/controller/lua.d/aft.lua
parente0a71da9fe0242a50a2d940597c46bb488c5ca84 (diff)
README + helloworld: New test functions + doc
Fixed, tested and documented setBefore and setAfter functions. Improved doc for updated functions in aft.lua. Change-Id: Idc7ffc06e98ef7f6af1e06d9e6cda0dcbd4f97b8 Signed-off-by: Corentin Le Gall <corentinlgs@gmail.com>
Diffstat (limited to 'conf.d/controller/lua.d/aft.lua')
-rw-r--r--conf.d/controller/lua.d/aft.lua18
1 files changed, 10 insertions, 8 deletions
diff --git a/conf.d/controller/lua.d/aft.lua b/conf.d/controller/lua.d/aft.lua
index e1b3d20..73a9c78 100644
--- a/conf.d/controller/lua.d/aft.lua
+++ b/conf.d/controller/lua.d/aft.lua
@@ -284,11 +284,12 @@ end
function _AFT.setBefore(testName, beforeTestFunction)
if type(beforeTestFunction) == "function" then
- for _,item in pairs(_AFT.test_list) do
- if item[0] == testName then
- item[1].setUp = function()
+ for _,item in pairs(_AFT.tests_list) do
+ if item[1] == testName then
+ local setUp_old = item[2].setup
+ item[2].setUp = function()
beforeTestFunction()
- item[1].setUp()
+ if setUp_old then setUp_old() end
end
end
end
@@ -299,10 +300,11 @@ end
function _AFT.setAfter(testName, afterTestFunction)
if type(afterTestFunction) == "function" then
- for _,item in pairs(_AFT.test_list) do
- if item[0] == testName then
- item[1].setUp = function()
- item[1].tearDown()
+ for _,item in pairs(_AFT.tests_list) do
+ if item[1] == testName then
+ local tearDown_old = item[2].tearDown
+ item[2].tearDown = function()
+ if tearDown_old then tearDown_old() end
afterTestFunction()
end
end