mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 09:23:44 +00:00
tests/declarative_debugger/*.m:
tests/exceptions/*.m:
tests/general/*.m:
tests/grade_subdirs/*.m:
tests/purity/*.m:
tests/submodules/*.m:
tests/typeclasses/*.m:
Update programming style.
tests/declarative_debugger/*.inp:
Update line numbers in breakpoint commands.
tests/declarative_debugger/*.exp:
Update expected line numbers.
tests/exceptions/Mercury.options:
tests/general/Mercury.options:
Disable some warnings that are irrelevant to the test.
55 lines
1.5 KiB
Mathematica
55 lines
1.5 KiB
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- module string_test_2.
|
|
:- interface.
|
|
:- import_module io.
|
|
|
|
:- pred main(io::di, io::uo) is det.
|
|
|
|
:- implementation.
|
|
:- import_module string.
|
|
|
|
main(!IO) :-
|
|
string.append("abc", "def", S1),
|
|
io.write_string(S1, !IO),
|
|
io.write_string("\n", !IO),
|
|
string.append("", "abcdef", S2),
|
|
io.write_string(S2, !IO),
|
|
io.write_string("\n", !IO),
|
|
string.append("abcdef", "", S3),
|
|
io.write_string(S3, !IO),
|
|
io.write_string("\n", !IO),
|
|
( if string.append("", S4, "abcdef") then
|
|
io.write_string(S4, !IO),
|
|
io.write_string("\n", !IO)
|
|
else
|
|
io.write_string("failed\n", !IO)
|
|
),
|
|
( if string.append("abc", S5, "abcdef") then
|
|
io.write_string(S5, !IO),
|
|
io.write_string("\n", !IO)
|
|
else
|
|
io.write_string("failed\n", !IO)
|
|
),
|
|
( if string.remove_prefix("abc", "abcdef", S6) then
|
|
io.write_string(S6, !IO),
|
|
io.nl(!IO)
|
|
else
|
|
io.write_string("failed\n", !IO)
|
|
).
|
|
|
|
% ( if string.append(S6, "", "abcdef") then
|
|
% io.write_string(S6, !IO),
|
|
% io.write_string("\n", !IO)
|
|
% else
|
|
% io.write_string("failed\n", !IO)
|
|
% ),
|
|
% ( if string.append(S7, "def", "abcdef") then
|
|
% io.write_string(S7, !IO),
|
|
% io.write_string("\n", !IO)
|
|
% else
|
|
% io.write_string("failed\n", !IO)
|
|
% ).
|