From: Alexandre Terrasa Date: Wed, 27 Aug 2014 06:06:46 +0000 (-0400) Subject: nitunit: factorize test_dir processing into test_base. X-Git-Tag: v0.6.9~61^2~4 X-Git-Url: http://nitlanguage.org nitunit: factorize test_dir processing into test_base. Signed-off-by: Alexandre Terrasa --- diff --git a/src/testing/testing_base.nit b/src/testing/testing_base.nit index 7e0c616..243a51e 100644 --- a/src/testing/testing_base.nit +++ b/src/testing/testing_base.nit @@ -27,4 +27,11 @@ redef class ToolContext var opt_dir = new OptionString("Working directory (default is '.nitunit')", "--dir") # opt --no-act var opt_noact = new OptionBool("Does not compile and run tests", "--no-act") + + # Working directory for testing. + fun test_dir: String do + var dir = opt_dir.value + if dir == null then return ".nitunit" + return dir + end end diff --git a/src/testing/testing_doc.nit b/src/testing/testing_doc.nit index 9d93dc6..e370b8a 100644 --- a/src/testing/testing_doc.nit +++ b/src/testing/testing_doc.nit @@ -213,8 +213,7 @@ redef class ModelBuilder ts.attr("package", mmodule.full_name) - var prefix = toolcontext.opt_dir.value - if prefix == null then prefix = ".nitunit" + var prefix = toolcontext.test_dir prefix = prefix.join_path(mmodule.to_s) var d2m = new NitUnitExecutor(toolcontext, prefix, o, ts)