Merge: loader: print error if bad files given to `scan_full` or `parse_full`
authorJean Privat <jean@pryen.org>
Wed, 21 Oct 2015 01:10:02 +0000 (21:10 -0400)
committerJean Privat <jean@pryen.org>
Wed, 21 Oct 2015 01:10:02 +0000 (21:10 -0400)
The last series (#1750 ) removed then silently.

A test is also added to avoid regression.

Pull-Request: #1773
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>

src/loader.nit
tests/sav/test_test_phase_args2.res [new file with mode: 0644]
tests/test_test_phase.args

index aa88cdc..9b79c62 100644 (file)
@@ -152,6 +152,11 @@ redef class ModelBuilder
 
                        var mmodule = identify_module(a)
                        if mmodule == null then
+                               if a.file_exists then
+                                       toolcontext.error(null, "Error: `{a}` is not a Nit source file.")
+                               else
+                                       toolcontext.error(null, "Error: cannot find module `{a}`.")
+                               end
                                continue
                        end
 
diff --git a/tests/sav/test_test_phase_args2.res b/tests/sav/test_test_phase_args2.res
new file mode 100644 (file)
index 0000000..729ac10
--- /dev/null
@@ -0,0 +1,3 @@
+Error: cannot find module `fail.nit`.
+Error: `README.md` is not a Nit source file.
+Errors: 2. Warnings: 0.
index 5f3aa2c..7409ad5 100644 (file)
@@ -1 +1,2 @@
 base_simple3.nit
+fail.nit base_simple3.nit README.md