Files
mercury/tests/hard_coded/remove_file.m
Peter Ross f1784ab668 Adapt the tests in the hard_coded directory so that the version of the
Estimated hours taken: 8

Adapt the tests in the hard_coded directory so that the version of the
Mercury compiler built with MSVC passes them in the hlc.gc grade.

tests/hard_coded/deep_copy.exp2:
tests/hard_coded/expand.exp2:
tests/hard_coded/float_reg.exp2:
tests/hard_coded/string_loop.exp2:
tests/hard_coded/write.exp2:
tests/hard_coded/write_reg1.exp2:
    The MSVC runtime prints out floating points using three digits for
    the exponent instead of two for most other runtimes.

tests/hard_coded/remove_file.m:
    s/io__tmp_name/io__make_tmp/ as tmp_name is obsolete.

tests/hard_coded/Mmakefile:
    Remove test_bitset and add bitset.

tests/hard_coded/bitset.exp:
tests/hard_coded/bitset.m:
tests/hard_coded/bitset_tester.m:
tests/hard_coded/test_bitset.exp:
tests/hard_coded/test_bitset.m:
    Move this test into one test case because mmake falls over with
    unable to make `std_util.m^M', plus there is no reason to have this
    case spread over two files.

tests/hard_coded/exceptions/test_exceptions_func.m:
    Remove the uneeded import of std_util, this avoids the
    `std_util.m^M' problem mentioned in the previous test case.
2001-02-13 15:57:27 +00:00

55 lines
1.5 KiB
Mathematica

% 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.
:- module remove_file.
:- interface.
:- use_module io.
:- pred main(io__state::di, io__state::uo) is det.
:- implementation.
main -->
io__make_temp(Name),
%%%%%%% io__print("Temp file name = "), io__print(Name), io__nl,
io__tell(Name, TellResult),
( { TellResult = io__ok },
io__print("Just testing"), io__nl,
io__told,
io__remove_file(Name, RemoveResult),
( { RemoveResult = io__ok },
io__see(Name, SeeResult),
( { SeeResult = io__ok } ->
io__print("Remove didn't remove file\n"),
io__set_exit_status(1)
;
io__print("Test passed\n")
)
; { RemoveResult = io__error(RemoveError) },
io__print("Remove failed: "),
{ io__error_message(RemoveError, RemoveErrorMsg) },
io__print(RemoveErrorMsg),
io__nl,
io__set_exit_status(1)
),
io__remove_file(Name, RemoveAgainResult),
( { RemoveAgainResult = io__ok },
io__print("Second remove didn't report failure\n"),
io__set_exit_status(1)
; { RemoveAgainResult = io__error(RemoveAgainError) },
io__print("Second remove failed, as expected: "),
{ io__error_message(RemoveAgainError,
RemoveAgainErrorMsg) },
io__print(RemoveAgainErrorMsg),
io__nl
)
; { TellResult = io__error(TellError) },
io__print("Tell failed: "),
{ io__error_message(TellError, TellErrorMsg) },
io__print(TellErrorMsg),
io__nl,
io__set_exit_status(1)
).