From: Alexandre Terrasa Date: Fri, 3 Feb 2017 06:52:33 +0000 (-0500) Subject: testing: fix `before_module` and `after_module` method recognition X-Git-Url: http://nitlanguage.org testing: fix `before_module` and `after_module` method recognition Signed-off-by: Alexandre Terrasa --- diff --git a/src/testing/testing_suite.nit b/src/testing/testing_suite.nit index a350210..dc29ea5 100644 --- a/src/testing/testing_suite.nit +++ b/src/testing/testing_suite.nit @@ -344,10 +344,10 @@ redef class MMethodDef private fun is_test: Bool do return name.has_prefix("test_") # Is the method a "before_module"? - private fun is_before_module: Bool do return mproperty.is_toplevel and name == "before_module" + private fun is_before_module: Bool do return name == "before_module" # Is the method a "after_module"? - private fun is_after_module: Bool do return mproperty.is_toplevel and name == "after_module" + private fun is_after_module: Bool do return name == "after_module" end redef class MClassDef @@ -367,7 +367,7 @@ redef class MModule # "before_module" method for this module. private fun before_test: nullable MMethodDef do for mclassdef in mclassdefs do - if not mclassdef.name == "Object" then continue + if not mclassdef.name == "Sys" then continue for mpropdef in mclassdef.mpropdefs do if mpropdef isa MMethodDef and mpropdef.is_before_module then return mpropdef end @@ -378,7 +378,7 @@ redef class MModule # "after_module" method for this module. private fun after_test: nullable MMethodDef do for mclassdef in mclassdefs do - if not mclassdef.name == "Object" then continue + if not mclassdef.name == "Sys" then continue for mpropdef in mclassdef.mpropdefs do if mpropdef isa MMethodDef and mpropdef.is_after_module then return mpropdef end