mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-16 01:43:35 +00:00
tests/invalid/*.m:
Rename modules as mentioned above.
In two cases where the main module name is a Mercury keyword (to the
extent that Mercury has keywords), add a "test_" prefix to the
module name.
Reorganize the ho_default_func_2 test case. The original code
of this test had three modules, a parent and two children,
with the module being tested being one of the *child* modules
(ho_default_func_2.sub). This does not work; the .log file
from the successful execution of this test case showed that
there was no actual compilation involved; the test stopped
after invoking "mmc --generate-dependencies" on that child module.
The new version of this test makes that child module the main module,
and moves the relevant parts of the other two original modules
into a single new child module.
Rename ii_parent to instance_pc (pc being short for parent-child).
This test case still has the child module listed as the target
in Mmakefile, so it still does not progress past generating its
dependencies.
Rename the imported_mode test case as bad_exported_mode,
because this is what it was testing.
exported_mode.m was used both as the main module of a test,
and as a helper module in the imported_mode test (now renamed
to bad_exported_mode). Make a copy of it as a helper module
for bad_exported_mode.
Update all references to the moved modules.
General updates to programming style, such as
- replacing DCG notation with state var notation
- adding lines around vim modelines
- fixing indentation
- fixing grammar errors in comments
tests/hard_coded/Mmakefile:
tests/hard_coded/Mercury.options:
Update all references to the moved modules and/or moved lines.
60 lines
1.3 KiB
Mathematica
60 lines
1.3 KiB
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- module multimode_missing_impure.
|
|
:- interface.
|
|
:- import_module io.
|
|
|
|
:- pred main(io::di, io::uo) is det.
|
|
|
|
:- implementation.
|
|
|
|
main(!IO) :-
|
|
In = 42,
|
|
test0,
|
|
test1(In),
|
|
test1(_Out0),
|
|
test2(In, In),
|
|
test2(In, _Out1),
|
|
test2(_Out2, In),
|
|
test2(_Out3, _Out4).
|
|
|
|
:- pred test0.
|
|
:- mode test0 is det.
|
|
test0 :-
|
|
puts("test0").
|
|
|
|
% This should be declared impure, or promised pure.
|
|
:- pred test1(int).
|
|
:- mode test1(in) is det.
|
|
:- mode test1(out) is det.
|
|
test1(_::in) :-
|
|
puts("test1(in)").
|
|
test1(0::out) :-
|
|
puts("test1(out)").
|
|
|
|
% This should be declared impure, or promised pure.
|
|
:- pred test2(int, int).
|
|
:- mode test2(in, in) is det.
|
|
:- mode test2(in, out) is det.
|
|
:- mode test2(out, in) is det.
|
|
:- mode test2(out, out) is det.
|
|
test2(_::in, _::in) :-
|
|
puts("test2(in, in)").
|
|
test2(_::in, 0::out) :-
|
|
puts("test2(in, out)").
|
|
test2(0::out, _::in) :-
|
|
puts("test2(out, in)").
|
|
test2(0::out, 0::out) :-
|
|
puts("test2(out, out)").
|
|
|
|
:- pred puts(string::in) is det.
|
|
puts(_).
|
|
:- pragma foreign_proc("C",
|
|
puts(S::in),
|
|
[promise_pure, will_not_call_mercury],
|
|
"
|
|
puts(S);
|
|
").
|