# Copyright (c) 1997-2004, Perforce Software, Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL PERFORCE SOFTWARE, INC. BE LIABLE FOR ANY # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl test.pl' ######################### We start with some black magic to print on failure. # Change 1..1 below to 1..last_test_to_print . # (It may become useful if the test is moved to ./t subdirectory.) BEGIN { $| = 1; print "1..6\n"; } END {print "not ok 1\n" unless $loaded;} use P4::Client; use P4::UI; use strict; use vars qw( $loaded $p4port ); $loaded = 1; $p4port = "__P4PORT__"; print "ok 1\n"; ######################### End of black magic. # Insert your test code below (better if it prints "ok 13" # (correspondingly "not ok 13") depending on the success of chunk 13 # of the test code): package TestUI; # This class is a derived P4::UI which we use in the tests to stop output # from Perforce appearing all over the screen. We just pick up on errors. use strict; use vars qw( @ISA ); @ISA = qw( P4::UI ); sub new { my $class = shift; my $self = new P4::UI; $self->{OK} = 1; bless( $self, $class ); return $self; } sub OutputInfo { return; } sub OutputError { my $self = shift; $self->{OK} = 0; print( @_, "\n" ); } sub OutputStat { my $self = shift; my $href = shift; $self->{OK} = 0 unless ( defined $href->{User} ); return; } sub Reset { my $self = shift; $self->{OK} = 1; } sub OK { my $self = shift; return $self->{OK}; } package main; my $client = new P4::Client(); my $ui = new TestUI; print( defined( $client ) ? "ok 2\n" : "not ok 2\n" ); $client->SetClient( "someclientname" ); $client->SetProtocol( "tag", "" ); $client->SetProtocol( "specstring", "" ); $client->SetPort( $p4port ); print( $client->Init() ? "ok 3\n" : "not ok 3\n" ); print( $client->GetClient() eq "someclientname" ? "ok 4\n" : "not ok 4\n" ); $client->Users( $ui ); # Using Autoloading syntax print( $ui->OK() ? "ok 5\n" : "not ok 5\n" ); $client->User( $ui, "-o" ); print( $ui->OK() ? "ok 6\n" : "not ok 6\n" ); $client->Final();
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#3 | 4158 | Tony Smith |
Copyright notice updates. No functional change. |
||
#2 | 2084 | Tony Smith |
Removed ugly hack preserving the specdef in perl hashes. There's no need for it as the server kindly provides it when you run the "p4 XXX -i". A little tidying of the test harness. It's not great, but there's at least something in there to check the form parsing now. |
||
#1 | 1011 | Tony Smith |
Moved Perl API stuff one level down to make way for upcoming Ruby interface. |
||
//guest/tony_smith/perforce/API/P4-Client/test.pl.skel | |||||
#1 | 549 | Tony Smith |
Renamed the working directory to P4-Client as I've discovered that MakeMaker is quite happy with that and doesn't require a version number in the directory name. |
||
//guest/tony_smith/perforce/API/P4-Client-0.51/test.pl.skel | |||||
#1 | 527 | Tony Smith | Release P4::Client version 0.51 with Win32 support | ||
//guest/tony_smith/perforce/API/P4-Client-0.50/test.pl.skel | |||||
#2 | 511 | Tony Smith | Completed the process of renaming P4::ClientApi to P4::Client | ||
#1 | 509 | Tony Smith |
Renamed P4::ClientApi to P4::Client as it's more friendly and that's what it's called on CPAN. Subsequent changes include the actual renaming inside the code, this just creates the branch |
||
//guest/tony_smith/perforce/API/P4-ClientApi-0.05/test.pl.skel | |||||
#1 | 501 | Tony Smith |
First publicly released version of the Perl interface to the Perforce API. |