diff options
-rw-r--r-- | LedgerSMB/DBObject.pm | 2 | ||||
-rw-r--r-- | t/42-dbobject.t | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/LedgerSMB/DBObject.pm b/LedgerSMB/DBObject.pm index 6e7abfd4..5bd6741d 100644 --- a/LedgerSMB/DBObject.pm +++ b/LedgerSMB/DBObject.pm @@ -272,7 +272,7 @@ sub _parse_array { $close_braces =~ s/{/}/g; $value =~ /^{($open_braces[^}]*$close_braces)/; my $parse_next = $1; - $value =~ s/^{$parse_next/{/; + $value =~ s/^{$parse_next,?/{/; @$next = $self->_parse_array($parse_next); } else { diff --git a/t/42-dbobject.t b/t/42-dbobject.t index 6eb42f2f..65cbbb1c 100644 --- a/t/42-dbobject.t +++ b/t/42-dbobject.t @@ -1,5 +1,5 @@ use LedgerSMB::DBObject; -use Test::More tests => 4; +use Test::More tests => 5; # Array parsing tests my $test = '{test,"test2\"\",",test3,"test4"}'; @@ -9,4 +9,7 @@ for (LedgerSMB::DBObject->_parse_array($test)){ is($_, shift @vals, "pass $pass, array parse test"); } +my $test2 = '{{1,1,1,1},{1,2,2,2}}'; +my @test_arry2 = LedgerSMB::DBObject->_parse_array($test2); +is(scalar @test_arry2, 2, 'Compount array with proper element count'); |