Files
mercury/tests/hard_coded/qual_adv_test.m
Fergus Henderson 11b2d32381 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:12:24 +00:00

37 lines
1.0 KiB
Mathematica

:- module qual_adv_test.
% A test using module qualification to resolve ambiguous overloading. The
% three versions of `format' should all produce different output,
% despite having the same name, and strang and strung both importing string.m
%
% The implementation predicates are mostly have the same names too, and
% a couple have different clauses.
%
:- interface.
:- import_module io, list, string, qual_strang, qual_strung.
:- pred qual_adv_test:main(io__state::di, io__state::uo) is det.
:- implementation.
main -->
{ String = "asdfjkfhaslks" },
{ FString = "iii %s.\n"},
{ string:format(FString, [s(String)], Out1) },
io:write_string(Out1),
{ qual_strang:format(FString, [s(String)], Out2) },
io__write_string(Out2),
{ qual_strung:format(FString, [s(String)], Out3) },
io__write_string(Out3),
{ Out4 = qual_strang:format_func(FString, [s(String)]) },
{ Out5 = qual_strung:format_func(FString, [s(String)]) },
(
{ Out4 = Out2 },
{ Out5 = Out3 }
->
io__write_string("ok\n")
;
io__write_string("failed\n")
).