Files
mercury/tests/hard_coded/user_defined_equality_1.m
Zoltan Somogyi ec97594862 Use test case numbers according to our conventions ...
... in some previously overlooked test cases.

tests/debugger/Mercury.options:
tests/debugger/Mmakefile:
tests/debugger/completion.completion_helper_1.m:
tests/debugger/completion.completion_helper_2.completion_helper_3.m:
tests/debugger/completion.completion_helper_2.m:
tests/debugger/completion.exp:
tests/debugger/completion.inp:
tests/debugger/completion.m:
    Rename completion.sub1.m to completion.completion_helper_1.m,
    rename completion.sub2.m to completion.completion_helper_2.m, and
    rename completion.sub2.sub3.m to
    completion.completion_helper_2.completion_helper_3.m.

tests/debugger/poly_io_retry_1.exp:
tests/debugger/poly_io_retry_1.inp:
tests/debugger/poly_io_retry_1.m:
tests/debugger/poly_io_retry_2.exp:
tests/debugger/poly_io_retry_2.inp:
tests/debugger/poly_io_retry_2.m:
    Rename poly_io_retry/poly_io_retry2 to poly_io_retry_[12].

tests/debugger/shallow.exp:
tests/debugger/shallow.m:
tests/debugger/shallow_helper_1.m:
    Rename shallow2.m to shallow_helper_1.m.

tests/debugger/user_event_1.exp:
tests/debugger/user_event_1.inp:
tests/debugger/user_event_1.m:
    Rename user_event to user_event_1, due to the existence of user_event_2.

tests/general/Mmakefile:
tests/general/det_complicated_unify_1.exp:
tests/general/det_complicated_unify_1.m:
tests/general/det_complicated_unify_2.exp:
tests/general/det_complicated_unify_2.m:
    Rename det_complicated_unify/det_complicated_unify2 to
    det_complicated_unify_[12]. Note: only det_complicated_unify_1
    is currently enabled.

tests/general/double_error_1.exp:
tests/general/double_error_1.m:
tests/general/double_error_2.exp:
tests/general/double_error_2.m:
    Rename double_error/double_error2 as double_error_[12].

tests/general/liveness_1.exp:
tests/general/liveness_1.m:
tests/general/liveness_2.exp:
tests/general/liveness_2.m:
    Rename liveness/liveness2 as liveness_[12].

tests/hard_coded/Mercury.options:
tests/hard_coded/Mmakefile:
tests/hard_coded/user_defined_equality_1.exp:
tests/hard_coded/user_defined_equality_1.m:
tests/hard_coded/user_defined_equality_2.exp:
tests/hard_coded/user_defined_equality_2.m:
    Rename user_defined_equality/user_defined_equality2 as
    user_defined_equality_[12].

tests/tabling/Mmakefile:
tests/tabling/expand_tuple_1.exp:
tests/tabling/expand_tuple_1.m:
tests/tabling/expand_tuple_2.exp:
tests/tabling/expand_tuple_2.m:
    Rename expand_tuple/expand_tuple2 as expand_tuple_[12].
2024-08-12 15:24:24 +02:00

71 lines
2.0 KiB
Mathematica

%---------------------------------------------------------------------------%
% vim: ts=4 sw=4 et ft=mercury
%---------------------------------------------------------------------------%
%
% This is a regression test.
%
% The Mercury compiler of 26/10/1999 failed the first part of this test
% (the part concerned with the implied mode of append).
%
% The Mercury compiler of 30/3/2000 failed the second part of this test
% (the part with comparison_test1), due to overeager specialization of
% comparisons involving ENUM_USEREQ types.
%
% The Mercury compiler still fails the third part of this test (the part
% with comparison_test2) with --no-special-preds, because the exception
% is not propagated across MR_call_engine properly. (It should work fine
% with the default --special-preds.)
:- module user_defined_equality_1.
:- interface.
:- import_module io.
:- pred main(io::di, io::uo) is cc_multi.
:- implementation.
:- import_module list.
:- import_module std_util.
:- import_module exception.
:- type foo
---> bar
; baz
where equality is foo_equal.
foo_equal(_, _) :-
semidet_succeed.
main(!IO) :-
( if append([bar], [baz], [baz, bar]) then
io.write_string("yes\n", !IO)
else
io.write_string("no\n", !IO)
),
perform_comparison_test(comparison_test1, !IO),
perform_comparison_test(comparison_test2, !IO).
:- pred perform_comparison_test(pred(T), io.state, io.state).
:- mode perform_comparison_test(pred(out) is det, di, uo) is cc_multi.
perform_comparison_test(Test, !IO) :-
try(Test, TryResult),
(
TryResult = succeeded(Result),
io.write_string("succeeded: ", !IO),
io.write_line(Result, !IO)
;
TryResult = exception(Exception),
io.write_string("threw exception: ", !IO),
io.write_line(Exception, !IO)
).
:- pred comparison_test1(comparison_result::out) is det.
comparison_test1(R) :-
compare(R, bar, baz).
:- pred comparison_test2(comparison_result::out) is det.
comparison_test2(R) :-
compare(R, [bar], [baz]).