mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-20 20:03:44 +00:00
tests/general/float_test.exp3:
tests/general/float_test.m:
tests/general/read_dir_regression.exp4:
tests/general/read_dir_regression.m:
tests/hard_coded/remove_file.exp2:
tests/hard_coded/remove_file.m:
Delete Erlang backend specific expected outputs.
tests/hard_coded/Mmakefile:
tests/hard_coded/erlang_deconstruct.exp:
tests/hard_coded/erlang_deconstruct.m:
tests/hard_coded/existential_list.exp:
tests/hard_coded/existential_list.m:
tests/valid/Mmakefile:
tests/valid/erl_ite_vars.m:
tests/valid/zf_erlang_bug.m:
Delete erlang target specific tests.
tests/*:
Delete Erlang foreign procs and foreign types.
74 lines
2.4 KiB
Mathematica
74 lines
2.4 KiB
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
%
|
|
% If this test fails when run natively under Win32 (no cygwin) then make
|
|
% sure that either the TMPDIR environment variable points somewhere
|
|
% sensible or that a directory <drive letter>:\tmp exists.
|
|
%
|
|
% The .exp file is for the C backends.
|
|
% The .exp3 file is for the Java backend.
|
|
% The .exp4 file is for the C# backend.
|
|
%
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- module remove_file.
|
|
:- interface.
|
|
:- import_module io.
|
|
|
|
:- pred main(io::di, io::uo) is det.
|
|
|
|
:- implementation.
|
|
|
|
:- import_module exception.
|
|
|
|
main(!IO) :-
|
|
io.make_temp_file(NameResult, !IO),
|
|
(
|
|
NameResult = ok(Name)
|
|
;
|
|
NameResult = error(Error),
|
|
throw(Error)
|
|
),
|
|
%%%%%%% io.print("Temp file name = ", !IO), io.print_line(Name, !IO),
|
|
io.tell(Name, TellResult, !IO),
|
|
(
|
|
TellResult = io.ok,
|
|
io.print_line("Just testing", !IO),
|
|
io.told(!IO),
|
|
io.remove_file(Name, RemoveResult, !IO),
|
|
(
|
|
RemoveResult = io.ok,
|
|
io.see(Name, SeeResult, !IO),
|
|
( if SeeResult = io.ok then
|
|
io.print("Remove didn't remove file\n", !IO),
|
|
io.set_exit_status(1, !IO)
|
|
else
|
|
io.print("Test passed\n", !IO)
|
|
)
|
|
;
|
|
RemoveResult = io.error(RemoveError),
|
|
io.print("Remove failed: ", !IO),
|
|
io.error_message(RemoveError, RemoveErrorMsg),
|
|
io.print_line(RemoveErrorMsg, !IO),
|
|
io.set_exit_status(1, !IO)
|
|
),
|
|
io.remove_file(Name, RemoveAgainResult, !IO),
|
|
(
|
|
RemoveAgainResult = io.ok,
|
|
io.print("Second remove didn't report failure\n", !IO),
|
|
io.set_exit_status(1, !IO)
|
|
;
|
|
RemoveAgainResult = io.error(RemoveAgainError),
|
|
io.print("Second remove failed, as expected: ", !IO),
|
|
io.error_message(RemoveAgainError, RemoveAgainErrorMsg),
|
|
io.print_line(RemoveAgainErrorMsg, !IO)
|
|
)
|
|
;
|
|
TellResult = io.error(TellError),
|
|
io.print("Tell failed: ", !IO),
|
|
io.error_message(TellError, TellErrorMsg),
|
|
io.print_line(TellErrorMsg, !IO),
|
|
io.set_exit_status(1, !IO)
|
|
).
|