mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-22 04:43:53 +00:00
tests/invalid/bad_foreign_code.{m,err_exp}:
tests/invalid/bad_foreign_decl.{m,err_exp}:
Test for the error messages caused by syntax errors.
tests/invalid/Mmakefile:
Include the new tests.
46 lines
1.0 KiB
Mathematica
46 lines
1.0 KiB
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
|
|
%---------------------------------------------------------------------------%
|
|
%
|
|
% Test for error messages produced by syntax errors in 'foreign_code' pragmas.
|
|
%
|
|
|
|
:- module bad_foreign_code.
|
|
:- interface.
|
|
|
|
:- type foo ---> foo.
|
|
|
|
:- implementation.
|
|
|
|
% Too few arguments.
|
|
%
|
|
:- pragma foreign_code("C").
|
|
|
|
% Too many arguments.
|
|
%
|
|
:- pragma foreign_code("C", "", "").
|
|
|
|
% Invalid foreign language.
|
|
%
|
|
:- pragma foreign_code("InvalidLanguage", "").
|
|
|
|
% Code argument is not a string or include_file.
|
|
%
|
|
:- pragma foreign_code("C", 2222).
|
|
|
|
% Argument of include_file is not a string.
|
|
%
|
|
:- pragma foreign_code("C", include_file(3333)).
|
|
|
|
% Argument of include_file is the empty string.
|
|
%
|
|
:- pragma foreign_code("C", include_file("")).
|
|
|
|
% Check that the correct contexts are associated with errors
|
|
% for each argument.
|
|
%
|
|
:- pragma foreign_code(
|
|
"InvalidLanguage",
|
|
6666
|
|
).
|