mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-17 02:13:54 +00:00
tests/accumulator/*.m:
tests/analysis_*/*.m:
tests/benchmarks*/*.m:
tests/debugger*/*.{m,exp,inp}:
tests/declarative_debugger*/*.{m,exp,inp}:
tests/dppd*/*.m:
tests/exceptions*/*.m:
tests/general*/*.m:
tests/grade_subdirs*/*.m:
tests/hard_coded*/*.m:
Make these tests use four-space indentation, and ensure that
each module is imported on its own line. (I intend to use the latter
to figure out which subdirectories' tests can be executed in parallel.)
These changes usually move code to different lines. For the debugger tests,
specify the new line numbers in .inp files and expect them in .exp files.
44 lines
824 B
Mathematica
44 lines
824 B
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
%
|
|
:- module exception_value.
|
|
|
|
:- interface.
|
|
:- import_module io.
|
|
|
|
:- pred main(io__state::di, io__state::uo) is cc_multi.
|
|
|
|
:- implementation.
|
|
|
|
:- import_module exception.
|
|
:- import_module list.
|
|
:- import_module pair.
|
|
|
|
main -->
|
|
{ test1(Res1) },
|
|
print(Res1),
|
|
io__nl,
|
|
{ test2(Res2) },
|
|
print(Res2),
|
|
io__nl.
|
|
|
|
:- pred test1(exception_result(int)::out) is cc_multi.
|
|
test1(Res) :-
|
|
try(p, Res).
|
|
|
|
:- pred test2(exception_result(int)::out) is cc_multi.
|
|
test2(Res) :-
|
|
try(q, Res).
|
|
|
|
:- pred p(int::out) is det.
|
|
|
|
p(_) :-
|
|
throw("p exception").
|
|
|
|
:- pred q(int::out) is det.
|
|
|
|
q(_) :-
|
|
throw("q oops" - [1, 2, 3]).
|
|
|