Test case for term_io
Thomas Charles Conway
conway at cs.mu.OZ.AU
Fri Nov 13 13:24:09 AEDT 1998
Hi
Fergus, here's a test case for that term_io bugfix you posted.
The fix appears to work correctly.
Thomas
--
Thomas Conway <conway at cs.mu.oz.au> )O+
To a killer whale, otters are like hairy popcorn -- Paul Dayton
tests/hard_coded/Mmakefile:
mention the new test case.
tests/hard_coded/term_io_test.{m,inp,exp}:
A new test case that reads terms from term_io_test.inp and
writes them to stdout. At the moment this only tests a single
bug[fix]: that pred expressions get quoted correctly when
they contain commas in their RHS, but by adding cases to the
.inp and .exp files, can be used to test various quoting/
term_io features.
cvs diff: Diffing .
Index: Mmakefile
===================================================================
RCS file: /home/staff/zs/imp/tests/hard_coded/Mmakefile,v
retrieving revision 1.49
diff -u -r1.49 Mmakefile
--- Mmakefile 1998/11/10 07:37:29 1.49
+++ Mmakefile 1998/11/12 00:03:45
@@ -83,6 +83,7 @@
string_alignment \
string_loop \
test_imported_no_tag \
+ term_io_test \
tim_qual1 \
write \
write_reg1
cvs diff: Diffing sub-modules
cvs diff: Diffing typeclasses
------------------------------------------------------------------------------
New file: term_io_test.m
------------------------------------------------------------------------------
:- module term_io_test.
:- interface.
:- import_module io.
:- pred main(io__state::di, io__state::uo) is det.
:- implementation.
:- import_module list, string, term_io.
main -->
see("term_io_test.inp", Res0),
(
{ Res0 = ok },
doit,
seen
;
{ Res0 = error(Err) },
{ error_message(Err, Msg) },
stderr_stream(StdErr),
format(StdErr, "error opening term_io_test.inp: %s\n", [s(Msg)])
).
:- pred doit(io__state::di, io__state::uo) is det.
doit -->
read_term(Res0),
(
{ Res0 = term(VarSet, Term) },
write_term_nl(VarSet, Term),
doit
;
{ Res0 = eof }
;
{ Res0 = error(Msg, Line) },
stderr_stream(StdErr),
format(StdErr, "%d: %s\n", [i(Line), s(Msg)]),
doit
).
------------------------------------------------------------------------------
New file: term_io_test.inp
------------------------------------------------------------------------------
foo((pred(A::in, B::out) is det :- p(A, C), q(C, B)), D, E).
------------------------------------------------------------------------------
New file: term_io_test.exp
------------------------------------------------------------------------------
foo((pred((A :: in), (B :: out)) is det :- p(A, C), q(C, B)), D, E).
------------------------------------------------------------------------------
More information about the developers
mailing list