loader: print error if bad files given to `scan_full` or `parse_full`
authorJean Privat <jean@pryen.org>
Tue, 20 Oct 2015 00:44:25 +0000 (20:44 -0400)
committerJean Privat <jean@pryen.org>
Tue, 20 Oct 2015 00:44:25 +0000 (20:44 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

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