Files
mercury/tests/invalid_nodepend/bad_foreign_decl.m
Zoltan Somogyi 6413b4fb08 Create invalid_nodepend and invalid_onlydepend.
tests/invalid_onlydepend:
    Move the one test case in tests/invalid for which we want to check
    the error messages generated during the generation of dependencies
    to this new test directory.

tests/invalid_nodepend:
    Move all test cases in tests/invalid which get errors during the
    generation of dependencies but for which we want to check the error
    messages generated during normal compilation to this new test directory.

tests/invalid_nodepend/Mmakefile:
tests/invalid_nodepend/Mercury.options:
tests/invalid_onlydepend/Mmakefile:
tests/invalid_onlydepend/Mercury.options:
    Versions of the same files in tests/invalid, but containing only
    the entries relevant to the moved test cases.

tests/invalid/Mmakefile:
tests/invalid/Mercury.options:
    Delete the entries that refer to the moved test cases.

tests/README:
    Document the two new test directories.

tools/bootcheck:
    Add invalid_onlydepend and invalid_nodepend to the list of
    test directories.
2021-07-28 00:59:04 +10:00

57 lines
1.3 KiB
Mathematica

%---------------------------------------------------------------------------%
% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
%---------------------------------------------------------------------------%
%
% Test for error messages produced by syntax errors in 'foreign_decl' pragmas.
%
:- module bad_foreign_decl.
:- interface.
:- type foo ---> foo.
:- implementation.
% Too few arguments.
%
:- pragma foreign_decl("C").
% Too many arguments.
%
:- pragma foreign_decl("C", local, "", "").
% Invalid foreign language.
%
:- pragma foreign_decl("InvalidLanguage", "").
% DeclCode argument is not a string or include_file.
%
:- pragma foreign_decl("C", 1234).
% 'local' is misspelled.
%
:- pragma foreign_decl("C", lcoal, "").
% 'local' is an integer.
%
:- pragma foreign_decl("C", 4444, "").
% Argument of include file is not a string.
%
:- pragma foreign_decl("C", include_file(5555)).
% Argument of include_file is an empty string.
% XXX The compiler currently accepts this.
:- pragma foreign_decl("C", include_file("")).
% Check that the correct contexts are associated with errors
% for each argument. (XXX they're currently not!)
%
:- pragma foreign_decl(
"InvalidLanguage",
lcoal,
7777
).
:- pragma foreign_decl("Erlang", include_file("")).