#!/usr/local/bin/perl -w =head1 NAME 00utils_p4.t - testing of VCP::Utils::p4 =cut use strict ; use Carp ; use Test ; use File::Temp qw( tmpnam ); use VCP::Utils::p4 qw( p4_get_settings ); use constant is_win32 => $^O =~ /Win32/; my @tests = ( sub { ok VCP::Utils::p4::underscorify_name( "a" ), "a" }, sub { ok VCP::Utils::p4::underscorify_name( "ab" ), "ab" }, sub { ok VCP::Utils::p4::underscorify_name( "a1" ), "a1" }, sub { ok VCP::Utils::p4::underscorify_name( "a(" ), "a(" }, sub { ok VCP::Utils::p4::underscorify_name( "a/" ), "a/" }, sub { ok VCP::Utils::p4::underscorify_name( "a b"), "a_20_b" }, sub { ok VCP::Utils::p4::underscorify_name( "a#b"), "a_23_b" }, sub { ok VCP::Utils::p4::underscorify_name( "a\@b"), "a_40_b" }, sub { ok VCP::Utils::p4::underscorify_name( " a" ), "_20_a" }, sub { $ENV{P4EDITOR} = 'vituperated_eczema'; my $h = p4_get_settings; ok $h->{P4EDITOR}, 'vituperated_eczema'; }, sub { return skip 1, "P4USER registry overrided P4CONFIG setting on Win32" if is_win32; my $tmpfile = tmpnam(); `echo 'P4USER=pigdog' > $tmpfile`; die "temporary file '$tmpfile' not written" unless -f $tmpfile; $ENV{P4CONFIG} = $tmpfile; my $h = p4_get_settings; ok $h->{P4USER}, "pigdog"; unlink $tmpfile or warn "Couldn't delete temporary file '$tmpfile'" if -e $tmpfile; }, ) ; plan tests => scalar( @tests ) ; $_->() for @tests ;
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#4 | 3635 | Barrie Slaymaker |
- Skip test on Win32 because P4USER in registry seems to override P4USER= in P4CONFIG |
||
#3 | 3570 | John Fetkovich |
change p4_get_settings (wrapper around 'p4 set' command) to remove parenthesized things at the end of a line which indicate where a value came from (such as a config file) |
||
#2 | 3508 | John Fetkovich |
added p4_get_settings sub to read P4... env vars/config settings |
||
#1 | 2692 | Barrie Slaymaker |
Centralize escaping of p4 label (etc) names. NOTE: I have not been able to find a description of the set of legal p4 names (namelength, character set, etc). This is purely a first attempt, if you have details on this, please let me know. |