[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[3021] trunk
- Subject: SF.net SVN: ledger-smb:[3021] trunk
- From: ..hidden..
- Date: Tue, 29 Jun 2010 23:43:51 +0000
Revision: 3021
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3021&view=rev
Author: einhverfr
Date: 2010-06-29 23:43:51 +0000 (Tue, 29 Jun 2010)
Log Message:
-----------
Correction for special characters in Perl in array parsing
Modified Paths:
--------------
trunk/LedgerSMB/DBObject.pm
trunk/t/42-dbobject.t
Modified: trunk/LedgerSMB/DBObject.pm
===================================================================
--- trunk/LedgerSMB/DBObject.pm 2010-06-28 22:50:15 UTC (rev 3020)
+++ trunk/LedgerSMB/DBObject.pm 2010-06-29 23:43:51 UTC (rev 3021)
@@ -278,11 +278,9 @@
$next = [];
my $close_braces = $open_braces;
$close_braces =~ s/{/}/g;
- $value =~ /^{($open_braces[^}]*$close_braces)/;
+ $value =~ s/^{($open_braces[^}]*$close_braces),?/{/;
my $parse_next = $1;
- $value =~ s/^{$parse_next,?/{/;
@$next = $self->_parse_array($parse_next);
-
} else {
$value =~ s/^\{([^,]*)(,|\})/\{/;
$next = $1;
Modified: trunk/t/42-dbobject.t
===================================================================
--- trunk/t/42-dbobject.t 2010-06-28 22:50:15 UTC (rev 3020)
+++ trunk/t/42-dbobject.t 2010-06-29 23:43:51 UTC (rev 3021)
@@ -1,8 +1,20 @@
use LedgerSMB::DBObject;
-use Test::More tests => 21;
+use Test::More tests => 25;
# Array parsing tests
-my $test = '{test,"test2\"\",",test3,"test4"}';
+my $test = '{test,"test2\"\",",test3,"test4"}';
+my @test_dbarrays = (
+ '{{1268133,9648645,2010-06-30,49753.500,0.000,0.00000000000000000000,49753.50000000000000000000,1,0},{1302678,9648659,2010-06-30,850.000,0.000,0.00000000000000000000,850.00000000000000000000,1,0},{1397340,9648659,2010-06-30,-850,0,0.00000000000000000000,-850.00000000000000000000,1,0},{1397341,9648645,2010-06-30,-49753.5,0.0,0.00000000000000000000,-49753.50000000000000000000,1,0}}',
+ '{{1410396,PD-060810,2010-06-08,150,0,0.00000000000000000000,150.00000000000000000000,1,0}}',
+ '{{1410389,ABCD*10K,2010-06-01,331.46,0.00,0.00000000000000000000,331.46000000000000000000,1,0}}',
+ '{{1415588,T/D#QA2GG9-0980,2010-06-16,61033.33,0.00,0.00000000000000000000,61033.33000000000000000000,1,0}}',
+);
+
+for my $t (@test_dbarrays){
+ my @r = LedgerSMB::DBObject->_parse_array($t);
+ is($r[0]->[8], '0', "$r[0]->[0] passed");
+}
+
my @vals = ('test', 'test2"",', 'test3', 'test4');
my @vals2 = ('test', 'test2"",', 'test3', 'test4');
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.