#!/usr/local/bin/perl -w =head1 NAME 09config_file_utils.t - testing of VCP::ConfigFileUtils services =cut use strict ; use Test ; use File::Temp qw( tmpnam ); use VCP::ConfigFileUtils qw( config_file_quote parse_config_file write_config_file ); my $fn; my @cleanup; END { for ( @cleanup ) { unlink $_ or warn "$!: $_"; } } my @tests = ( sub { ok config_file_quote( qq{a} ), qq{a} }, sub { ok config_file_quote( qq{ } ), qq{" "} }, sub { ok config_file_quote( qq{\$} ), qq{\$} }, sub { ok config_file_quote( qq{\n} ), qq{"\n"} }, sub { $fn = tmpnam; push @cleanup, $fn; write_config_file $fn; ok -f $fn; }, sub { ## see if we can overwrite it. write_config_file $fn; ok -f $fn; }, sub { my $sections = parse_config_file( $fn ); ok ! @$sections; ## It's empty! }, ) ; plan tests => scalar( @tests ) ; $_->() for @tests ;
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 3467 | Barrie Slaymaker |
- Config file tokens are now quoted using (the new) VCP::ConfigFileUtils::config_file_quote(), which only quotes if whitespace is detected (for now). - t/61addlabels.t now tests config file section building a bit. |
||
#1 | 3464 | Barrie Slaymaker |
- Create VCP::ConfigFileUtils and move bin/vcp::parse_config_file in to it. - Add VCP::ConfigFileUtils::write_config_file() - Add --output-vcp-file to bin/vcp. - Add VCP::Driver::repo_spec_as_string() - Add VCP::Driver::config_file_section_as_string() - VCP::Driver::parse_repo_spec() now clears any settings that are not set by a given spec string (so old values don't remain after a call to it). |