Now the tests are working another time (I had to modify some earlier tests, because...
[breadcrumbs.git] / src / t / TestCommandParser.pm
blobed86244ea89c4c5ad569aabbb86f851da8c60062
1 package t::TestCommandParser;
3 # This file is part of the breadcrumbs daemon (bcd).
4 # Copyright (C) 2007 Pasqualino Ferrentino
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 # 02110-1301, USA.
21 # Contact: lino.ferrentino@yahoo.it (in Italian, English or German).
24 use strict;
25 use warnings;
26 use DBI;
28 use Data::Dumper;
29 use t::TestCommonDb;
30 our @ISA = qw(t::TestCommonDb);
32 use Bcd::Commands::CommandParser;
34 sub new {
35 my $self = shift()->SUPER::new(@_);
37 return $self;
40 sub test_recordset{
41 my $self = shift;
42 my $stash = $self->{stash};
44 my $output = {
45 __recordsets => ['testrs'],
46 testrs => [
48 'field1',
49 'field2',
52 'r1f1',
53 'f1f2',
56 'r2f1',
57 'r2f2',
62 #ok, I try to parse this output
63 my $res = Bcd::Commands::CommandParser->parse_command_output($output);
65 $self->assert_equals('r1f1', $res->{testrs}->[0]->{field1});
66 $self->assert_equals('r2f1', $res->{testrs}->[1]->{field1});
67 $self->assert_null($res->{__recordsets});