From b337f5b029c8b387942f1b7211ab10182f574c29 Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Mon, 28 Nov 2016 16:11:59 -0500 Subject: [PATCH 1/1] man: document `NIT_TESTING_PATH` Signed-off-by: Alexandre Terrasa --- share/man/nitunit.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/share/man/nitunit.md b/share/man/nitunit.md index 73c5b3e..0ab13a5 100644 --- a/share/man/nitunit.md +++ b/share/man/nitunit.md @@ -274,6 +274,23 @@ fun after_module do end ~~~~ +## Accessing the test suite environment + +The `NIT_TESTING_PATH` environment variable contains the current test suite +file path. +Nitunit define this variable before the execution of each test suite. +It can be used to access files based on the current test_suite location: + +~~~ +class TestWithPath + super TestSuite + + fun test_suite_path do + assert "NIT_TESTING_PATH".environ != "" + end +end +~~~ + ## Generating test suites Write test suites for big modules can be a repetitive and boring task... @@ -383,6 +400,10 @@ To solve this issue, `NIT_TESTING_ID` is initialized with a distinct integer ide Note: `rand` is not a recommended way to get a distinct identifier because its randomness is disabled by default. See `SRAND`. +### `NIT_TESTING_PATH` + +Only available for test suites. +Contains the module test suite path. # SEE ALSO -- 1.7.9.5