Files
mercury/tests/invalid/bad_foreign_code.m
Julien Fischer 6f2f17359e Improve test coverage for foreign_{decl,code} pragmas.
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.
2016-05-26 13:02:27 +10:00

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
).