Subject: | Test::More - ok() bug when using embedded quotes(\") in expected string |
Date: | Wed, 21 Sep 2011 14:33:05 -0400 |
To: | "bug-test-simple [...] rt.cpan.org" <bug-test-simple [...] rt.cpan.org> |
From: | Richard Hogaboom <rhogaboom [...] industrialdefender.com> |
[hogaboom@Vega ~]$ uname -a
Linux Vega 2.6.35.14-96.fc14.x86_64 #1 SMP Thu Sep 1 11:59:56 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
[hogaboom@Vega ~]$ perl -V
Summary of my perl5 (revision 5 version 14 subversion 1) configuration:
Platform:
osname=linux, osvers=2.6.35.13-92.fc14.x86_64, archname=x86_64-linux
uname='linux vega 2.6.35.13-92.fc14.x86_64 #1 smp sat may 21 17:26:25 utc 2011 x86_64 x86_64 x86_64 gnulinux '
config_args='-de -Dprefix=/home/hogaboom/perl5/perlbrew/perls/perl-5.14.1'
hint=recommended, useposix=true, d_sigaction=define
useithreads=undef, usemultiplicity=undef
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=define, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-O2',
cppflags='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
ccversion='', gccversion='4.5.1 20100924 (Red Hat 4.5.1-4)', gccosandvers=''
intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'
libpth=/usr/local/lib /lib/../lib64 /usr/lib/../lib64 /lib /usr/lib /lib64 /usr/lib64 /usr/local/lib64
libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
libc=/lib/libc-2.13.so, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version='2.13'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector'
Characteristics of this binary (from libperl):
Compile-time options: PERL_DONT_CREATE_GVSV PERL_MALLOC_WRAP
PERL_PRESERVE_IVUV USE_64_BIT_ALL USE_64_BIT_INT
USE_LARGE_FILES USE_PERLIO USE_PERL_ATOF
Built under linux
Compiled at Aug 5 2011 11:13:02
%ENV:
PERLBREW_HOME="/home/hogaboom/.perlbrew"
PERLBREW_PATH="/home/hogaboom/perl5/perlbrew/bin:/home/hogaboom/perl5/perlbrew/perls/perl-5.14.1/bin"
PERLBREW_PERL="perl-5.14.1"
PERLBREW_ROOT="/home/hogaboom/perl5/perlbrew"
PERLBREW_VERSION="0.28"
@INC:
/home/hogaboom/perl5/perlbrew/perls/perl-5.14.1/lib/site_perl/5.14.1/x86_64-linux
/home/hogaboom/perl5/perlbrew/perls/perl-5.14.1/lib/site_perl/5.14.1
/home/hogaboom/perl5/perlbrew/perls/perl-5.14.1/lib/5.14.1/x86_64-linux
/home/hogaboom/perl5/perlbrew/perls/perl-5.14.1/lib/5.14.1
.
[hogaboom@Vega ~]$
Michael G Schwern > Test-Simple-0.98 > Test::More
Code snipet(tests 12, 13 and 14):
ok( -f "/etc/sysconfig/idefender-configforwarder.conf", "Test if /etc/sysconfig/idefender-configforwarder.conf file exists" );
open FH, "</etc/sysconfig/idefender-configforwarder.conf";
is( <FH>, 'CONFIG_FORWARDER=\"192.168.1.1\"' );
is( <FH>, undef, "no more lines" );
close FH;
The file has:
[root@Vega sysconfig]# cat idefender-configforwarder.conf
CONFIG_FORWARDER="192.168.1.1"
[root@Vega sysconfig]#
The error return is:
ok 12 - Test if /etc/sysconfig/idefender-configforwarder.conf file exists
not ok 13
ok 14 - no more lines
# Failed test at t/IDSE/SH/Directive/ConfigForwarder.t line 58.
# got: 'CONFIG_FORWARDER="192.168.1.1"
# '
# expected: 'CONFIG_FORWARDER=\"192.168.1.1\"'
# Looks like you failed 1 test of 14.
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/14 subtests
The got: seems to have an extra newline between the " and the '. I tried using double quotes around the whole thing instead of single quotes
like so:
is( <FH>, "CONFIG_FORWARDER=\"192.168.1.1\"" );
but this gives the same error. It seems to only be a problem when using embedded quotes(\").
Richard A Hogaboom
16 Chestnut Street - Suite 300
Foxborough, MA 02035
rhogaboom@industrialdefender.com
richard.hogaboom@gmail.com
W508-718-6711
H508-435-4091
C508-330-3775