Files
mercury/tests/general/commit_bug.m
Fergus Henderson 4554293812 Various fixes to the test cases so that they work with `__'
Estimated hours taken: 4

Various fixes to the test cases so that they work with `__'
as a module qualifier.

tests/general/commit_bug.m:
tests/general/mode_info_bug.m:
tests/general/partition.m:
tests/hard_coded/string_alignment.m:
	Delete `nl' predicate (and replace calls with calls to `io__nl')
	to avoid ambiguities with `io__nl'.

tests/general/partition.m:
	Rename `write' as `write_s'
	to avoid ambiguities with `io__write'.

tests/warnings/singleton_test.m:
tests/warnings/singleton_test.exp:
tests/warnings/pragma_source_code.m:
tests/warnings/pragma_source_code.exp:
	s/append/my_append/g
	to avoid ambiguities with `list__append'.

tests/general/parse_list.m:
tests/general/semidet_map.m:
	s/meta__/meta_/g
	to avoid errors about defining `meta__blah' in a module
	other than `meta'.

tests/hard_coded/qual_strang.m:
tests/hard_coded/qual_strung.m:
	s/string__//g
	to avoid errors about defining `string__blah' in a module
	other than `string'.

tests/valid/middle_rec_bug.m:
	s/garbage_out__/garbage_out_/g
	to avoid errors about defining `garbage_out__blah' in a module
	other than `garbage_out'.

tests/hard_coded/qual_basic_test.m:
tests/hard_coded/qual_adv_test.m:
	Eliminate double quantifiers, e.g. delete the `io__' in
	`io:io__write_string'.
	Also test calling `write_string' without `io:' or `io__'.
1997-02-23 06:11:35 +00:00

51 lines
840 B
Mathematica

% This tests the case of committing across a nondet goal in a nondet
% context. There was a bug in this, which this test case exercised.
:- module commit_bug.
:- interface.
:- import_module io.
:- pred main(io__state::di, io__state::uo) is det.
:- implementation.
:- import_module int, list, std_util.
main -->
{ solutions(test, List) },
print_intlist(List).
:- pred test(int::out) is multi.
test(Val) :-
(if some [X]
list__member(X, [1,2,3,4,5])
then
(if some [Z] (
some [Y] foo(X, Y),
foo(X,Z)
)
then
Val = Z
else
Val = -1
)
else
Val = -2
).
:- pred foo(int, int).
:- mode foo(in, out) is nondet.
foo(X, X).
foo(_, 7).
:- pred print_intlist(list(int)::in,io__state::di, io__state::uo) is det.
print_intlist([]) --> [].
print_intlist([X|L]) -->
io__write_int(X),
io__nl,
print_intlist(L).