This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/packages/plunit/examples/read.pl
2010-04-22 20:45:57 +01:00

28 lines
424 B
Prolog

:- use_module(library(plunit)).
:- begin_tests(read).
:- use_module(library(system)).
:- use_module(library(readutil)).
create_file(Tmp) :-
tmp_file(plunit, Tmp),
open(Tmp, write, Out),
write(Out, 'hello(World).\n'),
close(Out).
test(read, [ setup(create_file(Tmp)),
cleanup(delete_file(Tmp))
]) :-
read_file_to_terms(Tmp, Terms, []),
Terms =@= [hello(_)].
:- end_tests(read).
:- trace,run_tests.