From 35cd80d10dfe041dba33e35f643699408c92c4dc Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Mon, 19 Oct 2015 20:44:25 -0400 Subject: [PATCH] loader: print error if bad files given to `scan_full` or `parse_full` Signed-off-by: Jean Privat --- src/loader.nit | 5 +++++ tests/sav/test_test_phase_args2.res | 3 +++ tests/test_test_phase.args | 1 + 3 files changed, 9 insertions(+) create mode 100644 tests/sav/test_test_phase_args2.res diff --git a/src/loader.nit b/src/loader.nit index aa88cdc..9b79c62 100644 --- a/src/loader.nit +++ b/src/loader.nit @@ -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 index 0000000..729ac10 --- /dev/null +++ b/tests/sav/test_test_phase_args2.res @@ -0,0 +1,3 @@ +Error: cannot find module `fail.nit`. +Error: `README.md` is not a Nit source file. +Errors: 2. Warnings: 0. diff --git a/tests/test_test_phase.args b/tests/test_test_phase.args index 5f3aa2c..7409ad5 100644 --- a/tests/test_test_phase.args +++ b/tests/test_test_phase.args @@ -1 +1,2 @@ base_simple3.nit +fail.nit base_simple3.nit README.md -- 1.7.9.5