testUsageEnvironment.perl
#!/usr/bin/perl

#***************************************************************************************************
#                                                                                                  *
# testUsageEnvironment.perl: Test the usage of a siliconBrain package after installing it.         *
#                                                                                                  *
#***************************************************************************************************

#***************************************************************************************************
#                                                                                                  *
#     Copyright (C) 2003, 2004 Joerg Kunze                                                         *
#                                                                                                  *
#     This file is part of siliconBrain.                                                           *
#                                                                                                  *
#     siliconBrain 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.                                                          *
#                                                                                                  *
#     siliconBrain 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                    *
#                                                                                                  *
#***************************************************************************************************
$siliconBrainRelease       = '$siliconBrainRelease: 0.2.3 $';
$siliconBrainRcsIdentifier = '$Id: testUsageEnvironment.perl,v 1.15 2004/12/14 23:31:26 joerg Exp $';
$siliconBrainSaveStamp     = '$siliconBrainSaveStamp: 2004/12/14 22:27:15, Joerg Kunze$';

$scriptName = "testUsageEnvironment.perl";

use SiliconBrain;

#***************************************************************************************************
#                                                                                                  *
# main:                                                                                            *
#                                                                                                  *
#***************************************************************************************************
testPrint( $siliconBrainRelease       );
testPrint( $siliconBrainRcsIdentifier );
testPrint( $siliconBrainSaveStamp     );

#--------------------------------------------------------------------------------------------------#
testPrint( "check info ..." );
#--------------------------------------------------------------------------------------------------#
testAssert( '$ENV{INFOPATH} =~ /myProject/' );

testCommand( "info",
   'grep /myProject/',
   'grep /It tests siliconBrains command specs/',
);

testCommand( "info myCommand",
   'grep /myCommand/'
);

#--------------------------------------------------------------------------------------------------#
testPrint( "check generic record command and its man ..." );
#--------------------------------------------------------------------------------------------------#
testCommand(
   "record",
   "grep /just a carier of the generic part of record commands/"
);

testCommand(
   "man record",
   "grep /record - The carrier of the generic part of all record/"
);

#--------------------------------------------------------------------------------------------------#
testPrint( "check man ..." );
#--------------------------------------------------------------------------------------------------#
open sourceAuthorsFile, "documentation/authors.snippet.texinfo";
open targetAuthorsFile, ">documentation/authors.snippet.texinfo.new";

select targetAuthorsFile;

while( <sourceAuthorsFile> ) {
   unless( /\@end itemize/ ) {
      print;
   } else {
      print "\@item\n";
      print "\@email{hacker\@\@siliconbrain.com, Joe Hacker} ";
      print "This virtual hacker just lives for testing purposes.\n";
      print;
  }
}
close sourceAuthorsFile;
close targetAuthorsFile;

select STDOUT;

unlink "documentation/authors.snippet.texinfo";
rename "documentation/authors.snippet.texinfo.new", "documentation/authors.snippet.texinfo";

testMake( "update authors Texinfo file" );

testAssert( '$ENV{MANPATH} =~ /myProject/' );

testCommand(
   "man -Tascii myCommand",
   "grep /myProject/",
   'grep /Joe Hacker/',
   '! grep /\@node/',
   '! grep /\@item /',
   '! grep /help-h/',
   '! grep /\(null\)/',
   '! grep /\@c/'
);

#--------------------------------------------------------------------------------------------------#
testPrint( "check usage of record ..." );
#--------------------------------------------------------------------------------------------------#
testCommand(
   "temporary/myRecord.record.specification",
   "grep /firstName/",
   "grep /myRecord is just for testing the different features/"
);

testCommand(
   "man myRecord.record",
   "grep /myRecord\.record/",
   "grep /firstName/",
   "grep /FIELDS/",
   "grep /--help/",
   "grep /--recordValue/"
);

testCommand(
   "info myRecord.record",
   "grep /firstName/",
   "grep /Fields/",
   "grep /myRecord is just for testing the different features/"
);

testCommand(
   "info",
   "grep /myRecord\.record/",
   "grep /It tests siliconBrains record specs/"
);

#--------------------------------------------------------------------------------------------------#
testPrint( "End (of this part off test)\n" );
#--------------------------------------------------------------------------------------------------#

exit 0;

# $Log: testUsageEnvironment.perl,v $
# Revision 1.15  2004/12/14 23:31:26  joerg
# published for new release 0.2.3
#
# Revision 1.14  2004/12/14 23:17:05  joerg
# published for new release 0.2.2
#
# Revision 1.13  2004/12/14 22:42:23  joerg
# allFiles: all sources have a Log CVS keyword at the end now.
#