Merge: introduce nit_env.sh to setup the shell environement
[nit.git] / src / testing / testing_suite.nit
index 37f5c74..faf4b79 100644 (file)
@@ -21,9 +21,9 @@ private import annotation
 
 redef class ToolContext
        # -- target-file
-       var opt_file = new OptionString("Specify test suite location.", "-t", "--target-file")
+       var opt_file = new OptionString("Specify test suite location", "-t", "--target-file")
        # --pattern
-       var opt_pattern = new OptionString("Only run test case with name that match pattern. Examples: 'TestFoo', 'TestFoo*', 'TestFoo::test_foo', 'TestFoo::test_foo*', 'test_foo', 'test_foo*'", "-p", "--pattern")
+       var opt_pattern = new OptionString("Only run test case with name that match pattern", "-p", "--pattern")
 end
 
 # Used to test nitunit test files.
@@ -185,19 +185,19 @@ class TestSuite
 
        # Compile all `test_cases` cases in one file.
        fun compile do
-               # find nitg
+               # find nitc
                var nit_dir = toolcontext.nit_dir
-               var nitg = nit_dir/"bin/nitg"
-               if not nitg.file_exists then
-                       toolcontext.error(null, "Cannot find nitg. Set envvar NIT_DIR.")
+               var nitc = nit_dir/"bin/nitc"
+               if not nitc.file_exists then
+                       toolcontext.error(null, "Error: cannot find nitc. Set envvar NIT_DIR.")
                        toolcontext.check_errors
                end
                # compile test suite
                var file = test_file
                var include_dir = mmodule.location.file.filename.dirname
-               var cmd = "{nitg} --no-color '{file}.nit' -I {include_dir} -o '{file}.bin' > '{file}.out' 2>&1 </dev/null"
+               var cmd = "{nitc} --no-color '{file}.nit' -I {include_dir} -o '{file}.bin' > '{file}.out' 2>&1 </dev/null"
                var res = sys.system(cmd)
-               var f = new IFStream.open("{file}.out")
+               var f = new FileReader.open("{file}.out")
                var msg = f.read_all
                f.close
                # set test case result
@@ -223,7 +223,7 @@ class TestCase
        # Test method to be compiled and tested.
        var test_method: MMethodDef
 
-       # `ToolContext` to use to display messages and find `nitg` bin.
+       # `ToolContext` to use to display messages and find `nitc` bin.
        var toolcontext: ToolContext
 
        # `MMethodDef` to call before the test case.
@@ -257,7 +257,7 @@ class TestCase
                var test_file = test_suite.test_file
                var res_name = "{test_file}_{method_name.escape_to_c}"
                var res = sys.system("{test_file}.bin {method_name} > '{res_name}.out1' 2>&1 </dev/null")
-               var f = new IFStream.open("{res_name}.out1")
+               var f = new FileReader.open("{res_name}.out1")
                var msg = f.read_all
                f.close
                # set test case result