model: add MModule::is_test_suite attribute.
authorAlexandre Terrasa <alexandre@moz-code.org>
Mon, 12 Jan 2015 21:18:55 +0000 (22:18 +0100)
committerAlexandre Terrasa <alexandre@moz-code.org>
Mon, 12 Jan 2015 21:18:55 +0000 (22:18 +0100)
Used to discriminate nitunit test modules.

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

src/loader.nit
src/model/mmodule.nit

index 6149ffa..72921c7 100644 (file)
@@ -515,6 +515,7 @@ redef class ModelBuilder
                self.mmodule2nmodule[mmodule] = nmodule
 
                if decl != null then
+                       # Extract documentation
                        var ndoc = decl.n_doc
                        if ndoc != null then
                                var mdoc = ndoc.to_mdoc
@@ -523,6 +524,8 @@ redef class ModelBuilder
                        else
                                advice(decl, "missing-doc", "Documentation warning: Undocumented module `{mmodule}`")
                        end
+                       # Is the module a test suite?
+                       mmodule.is_test_suite = not decl.get_annotations("test_suite").is_empty
                end
 
                return mmodule
index 3e3c497..8020cc3 100644 (file)
@@ -209,5 +209,8 @@ class MModule
        # exposed to the final user.
        var is_fictive: Bool = false is writable
 
+       # Is `self` a unit test module used by `nitunit`?
+       var is_test_suite: Bool = false is writable
+
        redef fun parent_concern do return mgroup
 end