#! /usr/bin/env perl # # DESCRIBE HOW THE FUNCTIONALITY IS TESTED. # INDENT THE TEXT AS IT IS HERE (ONE TAB STOP). # IT WILL GET INCLUDED AUTOMATICALLY IN THE # SHIPPED Tests.txt FILE. # # $Id: template,v 1.1 2000/06/01 21:59:59 knight Exp $ # Copyright (c) 1996-2000 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. use Test::Cmd::Cons; # Canonical creation of the Cons test environment. # 'string' describes the functionality under test # for display on test result messages. $test = Test::Cmd::Cons->new(string => 'FUNCTIONALITY BEING TESTED'); # Canonical creation of a Construct file. $test->write('Construct', <<_EOF_); \$env = new cons ( ${\$test->cons_env} ); Program \$env 'foo', 'foo.c'; _EOF_ # Canonical creation of another file. $test->write('foo.c', <<'_EOF_'); main() { printf("foo.c\n"); exit (0); } _EOF_ # Canonical execution of Cons to build something. # The method raises an exception and dies on failure. # If it succeeds, we go on to execute the generated # program and check its output. $test->run(targets => "."); # Canonical execution of something just built by Cons, # checking the contents of standard output. $test->execute(prog => 'foo', stdout => <<_EOF_); foo.c _EOF_ # Canonical execution of Cons, checking to make sure it did not # build anything (i.e., everything was already up to date). $test->up_to_date(targets => "."); # Canonical execution of Cons when checking output of Cons itself, # checking standard and error output separately on success. $test->run(targets => ".", stdout => <<_EOF_, stderr => <<_EOF_); \Q${\$test->basename}\E: "." is up-to-date. _EOF_ _EOF_ # Canonical end of the test. # Since the methods exit on failure (or no result), # getting to this point means we passed. $test->pass; __END__