Files
mercury/tests/hard_coded/recursive_main.m
James Goddard 1b36dc1317 Added a test case to ensure that main can be called recursively without any
Estimated hours taken: 1
Branches: main

Added a test case to ensure that main can be called recursively without any
problems.  It is also an additional IO test.

tests/hard-coded/recursive_main.m:
	Test program that just echoes stdin.

tests/hard-coded/recursive_main.inp:
	Some text input.

tests/hard-coded/recursive_main.exp:
	The exact same text as recursive_main.inp.

tests/hard-coded/Mmakefile:
	Added recursive_main to the enabled lists.
2003-12-22 22:59:42 +00:00

31 lines
529 B
Mathematica

% All this program does is echo the input by recursively calling main to read
% and then write one char.
%
% It is useful both for ensuring that this recursion works ok, and as an IO
% test.
:- module recursive_main.
:- interface.
:- import_module io.
:- pred main(io__state::di, io__state::uo) is det.
:- implementation.
:- import_module io.
main -->
read_char(Result),
(
{ Result = ok(Char) },
write_char(Char),
main
;
{ Result = eof }
;
{ Result = error(Error) },
write_string(error_message(Error))
).