Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > CVS update: /svnutils/trunk/src/tests/, /svnutils/trunk/src/tests/sident-files/

svnutils
Discussion topic

Back to topic list

CVS update: /svnutils/trunk/src/tests/, /svnutils/trunk/src/tests/sident-files/

Reply

Author sunny256
Full name Øyvind A. Holm
Date 2008-09-24 18:11:04 PDT
Message User: sunny256 Date: 2008-09-24 18:11:04-0700 Added: svnutils/trunk/src/tests/sident.t svnutils/trunk/src/tests/sident-files/filenames svnutils/trunk/src/tests/sident-files/nothing_here svnutils/trunk/src/tests/sident-files/random svnutils/trunk/src/tests/sident-files/textfile svnutils/trunk/src/tests/sident-files/unexpanded Log: r217 | sunny256 | 2008-09-25 00:52:12 +0000 (Thu, 25 Sep 2008) | 18 lines Adding test system, starting with sident(1). * /trunk/src/tests/ New. All tests go here. * /trunk/src/tests/sident.t New test script for sident. * /trunk/src/tests/sident-files/ * /trunk/src/tests/sident-files/random * /trunk/src/tests/sident-files/filenames * /trunk/src/tests/sident-files/textfile * /trunk/src/tests/sident-files/nothing_here * /trunk/src/tests/sident-files/unexpanded Files used by the script. 2a386fa0-8a9c-11dd-95cd-000475e441b9 (svn) b7c3ce26-8a9e-11dd-8d30-000475e441b9 (cvs) File Changes: Directory: /svnutils/trunk/src/tests/ ===================================== File [added]: sident.t Url: http://svnutils.tigris.org/source/browse/svnutils/trunk/src/tests/sident.t?rev=1.1&content-type=text/vnd.viewcvs-markup Added lines: 646 ---------------- #!/usr/bin/perl -w #======================================================================= # Test suite for sident(1). # # Character set: UTF-8 # ©opyleft 2008– Øyvind A. Holm # License: GNU General Public License version 2 or later, see end of # file for legal stuff. #======================================================================= BEGIN { # push(@INC, "$ENV{'HOME'}/bin/STDlibdirDTS"); our @version_array; use Test::More qw{no_plan}; # use_ok() goes here } use strict; use Getopt::Long; $| = 1; our $Debug = 0; our $CMD = "../sident"; our %Opt = ( 'all' => 0, 'debug' => 0, 'help' => 0, 'todo' => 0, 'verbose' => 0, 'version' => 0, ); our $progname = $0; $progname =~ s/^.*\/(.*?)$/$1/; my $rcs_id = '$Id: svn:keywords disabled for this file $'; my $id_date = $rcs_id; $id_date =~ s/^.*?\d+ (\d\d\d\d-.*?\d\d:\d\d:\d\d\S+).*/$1/; push(@main::version_array, $rcs_id); my @cmdline_array = @ARGV; Getopt::Long::Configure("bundling"); GetOptions( "all|a" => \$Opt{'all'}, "debug" => \$Opt{'debug'}, "help|h" => \$Opt{'help'}, "todo|t" => \$Opt{'todo'}, "verbose|v+" => \$Opt{'verbose'}, "version" => \$Opt{'version'}, ) || die("$progname: Option error. Use -h for help.\n"); $Opt{'debug'} && ($Debug = 1); $Opt{'help'} && usage(0); if ($Opt{'version'}) { print_version(); exit(0); } diag(sprintf("========== Executing \"%s%s%s\" ==========", $progname, scalar(@cmdline_array) ? " " : "", join(" ", @cmdline_array))); if ($Opt{'todo'} && !$Opt{'all'}) { goto todo_section; } =pod testcmd("$CMD command", # {{{ < sident-files/filenames sident-files/nothing_here sident-files/random $Id: randomstuff 314159 1969-01-21 17:12:16Z sunny $ sident-files/textfile $Id: plain_old_textfile 93653 2008-09-22 14:15:10Z sunny $ $Id: yeh 1234 2008-09-22 12:25:05Z sunny $ $Id: plain_old_textfile 93653 2008-09-22 14:15:10Z sunny $ $Id: yeh 1234 2008-09-22 12:25:05Z sunny $ $Id: yeh 1234 2008-09-22 12:25:05Z sunny $ $Date: 1999/12/23 21:59:22 $ $Header: /cvsweb/cvs-guide/keyword.html,v 1.3 1999/12/23 21:59:22 markd Exp $ $Id: keyword.html,v 1.3 1999/12/23 21:59:22 markd Exp $ $Weirdo: blah blah $ sident-files/unexpanded $URL$ $HeadURL$ $LastChangedBy$ $Date$ $LastChangedDate$ $Rev$ $Revision$ $LastChangedRevision$ $Id$ $RealLyuNKoWN$ END "", "Output XML, including files without keywords", ); # }}} diag("Testing --version option..."); likecmd("$CMD --version", # {{{ '/\$Id: .*? \$/', '/^$/', "Option --version returns Id string", ); # }}} diag("Testing -x (--xml) option..."); testcmd("$CMD -x sident-files/textfile", # {{{ <<'END', sident-files/textfile $Id: plain_old_textfile 93653 2008-09-22 14:15:10Z sunny $ $Id: yeh 1234 2008-09-22 12:25:05Z sunny $ $Id: plain_old_textfile 93653 2008-09-22 14:15:10Z sunny $ $Id: yeh 1234 2008-09-22 12:25:05Z sunny $ $Id: yeh 1234 2008-09-22 12:25:05Z sunny $ $Date: 1999/12/23 21:59:22 $ $Header: /cvsweb/cvs-guide/keyword.html,v 1.3 1999/12/23 21:59:22 markd Exp $ $Id: keyword.html,v 1.3 1999/12/23 21:59:22 markd Exp $ $Weirdo: blah blah $ END "", "Output XML from textfile", ); # }}} testcmd("$CMD -ux sident-files/textfile", # {{{ <<'END', sident-files/textfile $Id: plain_old_textfile 93653 2008-09-22 14:15:10Z sunny $ $Id: yeh 1234 2008-09-22 12:25:05Z sunny $ $Date: 1999/12/23 21:59:22 $ $Header: /cvsweb/cvs-guide/keyword.html,v 1.3 1999/12/23 21:59:22 markd Exp $ $Id: keyword.html,v 1.3 1999/12/23 21:59:22 markd Exp $ $Weirdo: blah blah $ END "", "Output XML, remove duplicates", ); # }}} diag("Error conditions..."); testcmd("$CMD sident-files", # {{{ "", "", "Ignore directories", ); # }}} likecmd("$CMD sident-files/shbvkdsvsdfv", # {{{ '/^$/', '/^sident: sident-files/shbvkdsvsdfv: .*$/', "File not found", ); # }}} diag("Validate POD (Plain Old Documentation)"); testcmd("podchecker $CMD", # {{{ "", "$CMD pod syntax OK.\n", "$CMD contains valid POD", ); # }}} todo_section: ; if ($Opt{'all'} || $Opt{'todo'}) { diag("Running TODO tests..."); # {{{ TODO: { local $TODO = ""; # Insert TODO tests here. } # TODO tests }}} } diag("Testing finished."); sub testcmd { # {{{ my ($Cmd, $Exp_stdout, $Exp_stderr, $Desc) = @_; my $stderr_cmd = ""; my $deb_str = $Opt{'debug'} ? " --debug" : ""; my $Txt = join("", "\"$Cmd\"", defined($Desc) ? " - $Desc" : "" ); my $TMP_STDERR = "sident-stderr.tmp"; if (defined($Exp_stderr) && !length($deb_str)) { $stderr_cmd = " 2>$TMP_STDERR"; } is(`$Cmd$deb_str$stderr_cmd`, $Exp_stdout, $Txt); if (defined($Exp_stderr)) { if (!length($deb_str)) { is(file_data($TMP_STDERR), $Exp_stderr, "$Txt (stderr)"); unlink($TMP_STDERR); } } else { diag("Warning: stderr not defined for '$Txt'"); } # }}} } sub likecmd { # {{{ my ($Cmd, $Exp_stdout, $Exp_stderr, $Desc) = @_; my $stderr_cmd = ""; my $deb_str = $Opt{'debug'} ? " --debug" : ""; my $Txt = join("", "\"$Cmd\"", defined($Desc) ? " - $Desc" : "" ); my $TMP_STDERR = "sident-stderr.tmp"; if (defined($Exp_stderr) && !length($deb_str)) { $stderr_cmd = " 2>$TMP_STDERR"; } like(`$Cmd$deb_str$stderr_cmd`, "$Exp_stdout", $Txt); if (defined($Exp_stderr)) { if (!length($deb_str)) { like(file_data($TMP_STDERR), "$Exp_stderr", "$Txt (stderr)"); unlink($TMP_STDERR); } } else { diag("Warning: stderr not defined for '$Txt'"); } # }}} } sub file_data { # Return file content as a string {{{ my $File = shift; my $Txt; if (open(FP, "<", $File)) { $Txt = join("", ); close(FP); return($Txt); } else { return undef; } # }}} } sub print_version { # Print program version {{{ for (@main::version_array) { print("$_\n"); } # }}} } # print_version() sub usage { # Send the help message to stdout {{{ my $Retval = shift; if ($Opt{'verbose'}) { print("\n"); print_version(); } print(<= $verbose_level) { print(STDERR "$progname: $Txt\n"); } # }}} } # msg() __END__ # Plain Old Documentation (POD) {{{ =pod =head1 NAME run-tests.pl =head1 REVISION svn:keywords disabled for this file, so I reckon you have to guess. =head1 SYNOPSIS sident.t [options] [file [files [...]]] =head1 DESCRIPTION Contains tests for the sident(1) program. =head1 OPTIONS =over 4 =item B<-a>, B<--all> Run all tests, also TODOs. =item B<-h>, B<--help> Print a brief help summary. =item B<-t>, B<--todo> Run only the TODO tests. =item B<-v>, B<--verbose> Increase level of verbosity. Can be repeated. =item B<--version> Print version information. =item B<--debug> Print debugging messages. =back =head1 AUTHOR Made by Øyvind A. Holm Ssunny@sunbase.orgE>. =head1 COPYRIGHT Copyleft © Øyvind A. Holm Esunny@sunbase.orgE This is free software; see the file F for legalese stuff. =head1 LICENCE 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; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA =head1 SEE ALSO =cut # }}} # vim: set fenc=UTF-8 ft=perl fdm=marker ts=4 sw=4 sts=4 et fo+=w : # End of file Directory: /svnutils/trunk/src/tests/sident-files/ ================================================== File [added]: filenames Url: http://svnutils.tigris.org/source/browse/svnutils/trunk/src/tests/sident-files/filenames?rev=1.1&content-type=text/vnd.viewcvs-markup Added lines: 4 -------------- sident-files/nothing_here sident-files/random sident-files/textfile sident-files/unexpanded File [added]: nothing_here Url: http://svnutils.tigris.org/source/browse/svnutils/trunk/src/tests/sident-files/nothing_here?rev=1.1&content-type=text/vnd.viewcvs-markup Added lines: 83 --------------- Nothing to see here, move on. I mean it. File [added]: random Url: http://svnutils.tigris.org/source/browse/svnutils/trunk/src/tests/sident-files/random?rev=1.1&content-type=text/vnd.viewcvs-markup File [added]: textfile Url: http://svnutils.tigris.org/source/browse/svnutils/trunk/src/tests/sident-files/textfile?rev=1.1&content-type=text/vnd.viewcvs-markup Added lines: 9 -------------- Just a plain old text file $Id: plain_old_textfile 93653 2008-09-22 14:15:10Z sunny $ $Id: yeh 1234 2008-09-22 12:25:05Z sunny $ $Id: plain_old_textfile 93653 2008-09-22 14:15:10Z sunny $ $Id: yeh 1234 2008-09-22 12:25:05Z sunny $$Id: yeh 1234 2008-09-22 12:25:05Z sunny $ $Date: 1999/12/23 21:59:22 $ $Header: /cvsweb/cvs-guide/keyword.html,v 1.3 1999/12/23 21:59:22 markd Exp $ $Id: keyword.html,v 1.3 1999/12/23 21:59:22 markd Exp $ $Weirdo: blah blah $ File [added]: unexpanded Url: http://svnutils.tigris.org/source/browse/svnutils/trunk/src/tests/sident-files/unexpanded?rev=1.1&content-type=text/vnd.viewcvs-markup Added lines: 6 -------------- $URL$ $HeadURL$ Author $LastChangedBy$ $Date$ $$$$LastChangedDate$ -$Rev$- $Revision$, $LastChangedRevision$ $Id$ $RealLyuNKoWN$

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

CVS update: /svnutils/trunk/src/tests/, /svnutils/trunk/src/tests/sident-files/ sunny256 Øyvind A. Holm 2008-09-24 18:11:04 PDT
Messages per page: