#!/usr/local/bin/perl -w =head1 NAME plugin.t - testing of VCP::Plugin services =cut use strict ; use Carp ; use Test ; use VCP::Plugin ; my $p ; sub flatten_spec { my ( $parsed_spec ) = @_ ; return join( ' ', map( defined $_ ? $_ : '-' , @$parsed_spec{qw( SCHEME USER PASSWORD SERVER FILES )} ) ) ; } my @repo_vectors = ( [ 'scheme:user:password@server:files', 'scheme user password server files' ], [ 'scheme:user:password@ser@:ver:files', 'scheme user password ser@:ver files' ], [ 'scheme:files', 'scheme - - - files' ], [ 'scheme:user@files', 'scheme - - - user@files' ], [ 'scheme:user@:files', 'scheme user - - files' ], ) ; my @tests = ( sub { $p = VCP::Plugin->new() ; ok( ref $p, 'VCP::Plugin' ) }, ## ## rev_root cleanup ## sub { $p->rev_root( '\\//foo\\//bar\\//' ) ; ok( $p->rev_root, 'foo/bar' )}, sub { $p->deduce_rev_root( '\\foo/bar' ) ; ok( $p->rev_root, 'foo' )}, sub { $p->deduce_rev_root( '\\foo/bar/' ) ; ok( $p->rev_root, 'foo/bar' )}, sub { $p->deduce_rev_root( '\\foo/bar/blah*blop/baz' ) ; ok( $p->rev_root, 'foo/bar' )}, sub { $p->deduce_rev_root( '\\foo/bar/blah?blop/baz' ) ; ok( $p->rev_root, 'foo/bar' )}, sub { $p->deduce_rev_root( '\\foo/bar/blah...blop/baz' ) ; ok( $p->rev_root, 'foo/bar' )}, ## ## Normalization & de-normalization ## sub { ok( $p->normalize_name( '/foo/bar/baz' ), 'baz' ) }, sub { eval {$p->normalize_name( '/foo/hmmm/baz' ) }, ok( $@ ) }, sub { ok( $p->denormalize_name( 'barf' ), 'foo/bar/barf' ) }, ( map { my ( $spec, $flattened ) = @$_ ; sub { ok( flatten_spec( $p->parse_repo_spec( $spec ) ), $flattened ) }, } @repo_vectors ), sub { $p->parse_repo_spec( 'scheme:user:password@server:files' ) ; ok( $p->repo_user, 'user' ) ; }, sub { ok( $p->repo_password, 'password' ) ; }, sub { ok( $p->repo_server, 'server' ) ; }, ## Subprocesses that behave as expected sub { $p->run_safely( [ $^X, qw( -e exit(0) ) ] ); ok $p->command_result_code, 0; }, sub { ok ! eval { $p->run_safely( [ $^X, qw( -e exit(1) ) ] ); 1 }; }, sub { ok $p->command_result_code, 1; }, sub { $p->run_safely( [ $^X, qw( -e exit(1) ) ], ok_result_codes => [ 1 ] ); ok $p->command_result_code, 1; }, sub { $p->run_safely( [ $^X, qw( -e exit(1) ) ], ok_result_codes => [ 0, 1 ] ); ok $p->command_result_code, 1; }, sub { ok ! eval { $p->run_safely( [ $^X, qw( -e exit(2) ) ] ); ok_result_codes => [ 0, 1 ] }; }, sub { ok $p->command_result_code, 2; }, sub { $p->run_safely( [ $^X, qw( -e warn("hi\n") ) ], stderr_filter => qr/^hi\n/ ); ok 1; }, ) ; plan tests => scalar( @tests ) ; $_->() for @tests ;
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#11 | 3970 | Barrie Slaymaker |
- VCP::Source handles rev queing, uses disk to reduce RAM - Lots of other fixes |
||
#10 | 3858 | Barrie Slaymaker | - Final tweaks for 0.5 release | ||
#9 | 3460 | Barrie Slaymaker |
- Revamp Plugin/Source/Dest hierarchy to allow for reguritating options in to .vcp files |
||
#8 | 3424 | Barrie Slaymaker | - Minor Win32 compatability issue | ||
#7 | 3284 | John Fetkovich |
'sub new' constructor in Source and Dest p4.pm fixed so parse_p4_repo_spec only called when a $spec is provided to the constructor. parse_p4_repo_spec now also sets the repo_id. parse_repo_spec (TODO item) no longer returns a hash value of the values parsed, it only sets fields in $self. Fixed a few places where that return hash was used. |
||
#6 | 3172 | Barrie Slaymaker | keep test sutie from blowing up | ||
#5 | 2664 | Barrie Slaymaker | Try IPC::Run3 to see if it speeds up p4 calls | ||
#4 | 2009 | Barrie Slaymaker |
lots of fixes, improve core support for branches and VCP::Source::cvs now supports branches. |
||
#3 | 2006 | Barrie Slaymaker |
more preparations for branching support, handling of cvs :foo:... CVSROOT specs, misc fixes, improvements |
||
#2 | 468 | Barrie Slaymaker |
- VCP::Dest::p4 now does change number aggregation based on the comment field changing or whenever a new revision of a file with unsubmitted changes shows up on the input stream. Since revisions of files are normally sorted in time order, this should work in a number of cases. I'm sure we'll need to generalize it, perhaps with a time thresholding function. - t/90cvs.t now tests cvs->p4 replication. - VCP::Dest::p4 now doesn't try to `p4 submit` when no changes are pending. - VCP::Rev now prevents the same label from being applied twice to a revision. This was occuring because the "r_1"-style label that gets added to a target revision by VCP::Dest::p4 could duplicate a label "r_1" that happened to already be on a revision. - Added t/00rev.t, the beginnings of a test suite for VCP::Rev. - Tweaked bin/gentrevml to comment revisions with their change number instead of using a unique comment for every revision for non-p4 t/test-*-in-0.revml files. This was necessary to test cvs->p4 functionality. |
||
#1 | 467 | Barrie Slaymaker | Version 0.01, initial checkin in perforce public depot. |