mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 17:33:38 +00:00
tests/declarative_debugger/catch.exp2:
tests/declarative_debugger/catch.exp3:
tests/declarative_debugger/find_origin.exp2:
tests/declarative_debugger/func_call.exp2:
tests/declarative_debugger/gcf.exp2:
tests/declarative_debugger/ho5.exp2:
tests/declarative_debugger/neg_conj.exp2:
tests/declarative_debugger/solns.exp2:
tests/declarative_debugger/throw.exp2:
Update .exp2 files for line number changes after recent updates
to source files.
For the catch test case, swap the .exp2 and .exp3 files first,
because it looks like the old .exp2, which is the new .exp3,
is so old that it is probably not an expected output for any
grade/options combination, and thus should be a candidate for deletion.
tests/declarative_debugger/find_origin.m:
Improve a comment,
tests/declarative_debugger/catch.m:
Delete blank last line.
35 lines
675 B
Mathematica
35 lines
675 B
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- module (catch).
|
|
:- interface.
|
|
:- import_module io.
|
|
|
|
:- pred main(io::di, io::uo) is cc_multi.
|
|
|
|
:- implementation.
|
|
|
|
:- import_module exception.
|
|
:- import_module int.
|
|
|
|
main(!IO) :-
|
|
p(1, R1),
|
|
io.write_line(R1, !IO),
|
|
p(2, R2),
|
|
io.write_line(R2, !IO).
|
|
|
|
:- pred p(int::in, exception_result(int)::out) is cc_multi.
|
|
|
|
p(N, R) :-
|
|
try(q(N), R).
|
|
|
|
:- pred q(int::in, int::out) is det.
|
|
|
|
q(N, M) :-
|
|
( if N > 1 then
|
|
M = N
|
|
else
|
|
throw("q: bad input")
|
|
).
|