[m-rev.] for review: improve error reporting for more foreign language interface pragmas

Zoltan Somogyi zoltan.somogyi at runbox.com
Wed May 25 12:13:02 AEST 2016


> diff --git a/tests/invalid/bad_foreign_export.err_exp b/tests/invalid/bad_foreign_export.err_exp
> index e69de29..4e746ae 100644
> --- a/tests/invalid/bad_foreign_export.err_exp
> +++ b/tests/invalid/bad_foreign_export.err_exp
> @@ -0,0 +1,14 @@
> +bad_foreign_export.m:020: Error: wrong number of arguments in
> +bad_foreign_export.m:020:   `:- pragma foreign_export' declaration.
> +bad_foreign_export.m:024: In `:- pragma foreign_export' declaration: error:
> +bad_foreign_export.m:024:   atom expected at 12345.
> +bad_foreign_export.m:028: In `:- pragma foreign_export' declaration: error:
> +bad_foreign_export.m:028:   string expected at `12345'.
> +bad_foreign_export.m:032: Error: invalid foreign language `"InvalidLanguage"'
> +bad_foreign_export.m:032:   in `:- pragma foreign_export' declaration.
> +bad_foreign_export.m:037: Error: invalid foreign language `"InvalidLanguage"'
> +bad_foreign_export.m:037:   in `:- pragma foreign_export' declaration.
> +bad_foreign_export.m:038: In `:- pragma foreign_export' declaration: error:
> +bad_foreign_export.m:038:   atom expected at 1234.
> +bad_foreign_export.m:039: In `:- pragma foreign_export' declaration: error:
> +bad_foreign_export.m:039:   string expected at `5678'.
> diff --git a/tests/invalid/bad_foreign_export.m b/tests/invalid/bad_foreign_export.m
> index e69de29..a693b1a 100644
> 

Instead of saying just “wrong number of arguments”, we should say something
like “wrong number of arguments. There should be three: an xxx, a yyy and a zzz”,
or give the same info in the form of a template.

Also, instead of just saying e.g. “string expected”, we should say something
like “expected a string that is the foreign-language name of the exported function”.

And it would be nice if error terms such as 12345 were used just once in each
test case, since that would make it easier to check the error message against
the error without counting line numbers (when you are outside an editor) :-)

Otherwise, the diff is fine.

Zoltan.





More information about the reviews mailing list