summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2010-08-07 15:36:39 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2010-08-07 15:36:39 +0200
commita9fd781a502c606fd709038a0d3909c61c5a4eca (patch)
tree9bdd8701cbfabfdf63158cfaa32741fc16590a9a
parenta30be50b746055a1474b90b8bdf01a34776f535d (diff)
Initial module test (new/isa/can)
-rwxr-xr-xbin/efa2
-rw-r--r--t/50-www-efa.t33
2 files changed, 34 insertions, 1 deletions
diff --git a/bin/efa b/bin/efa
index d6f7cef..6117ec6 100755
--- a/bin/efa
+++ b/bin/efa
@@ -104,7 +104,7 @@ if ($efa->{'error'}) {
die $efa->{'error'}->as_string();
}
-if (ref($efa) eq 'WWW::Efa::Error') {
+if ($efa->isa('WWW::Efa::Error')) {
die($efa->as_string);
}
diff --git a/t/50-www-efa.t b/t/50-www-efa.t
new file mode 100644
index 0000000..f7a7410
--- /dev/null
+++ b/t/50-www-efa.t
@@ -0,0 +1,33 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use 5.010;
+
+use Test::More tests => 6;
+
+BEGIN {
+ use_ok('WWW::Efa');
+}
+require_ok('WWW::Efa');
+
+my $conf_default = {
+ from => ['Essen', 'HBf'],
+ to => ['Koeln', 'HBf'],
+};
+my $post_default = {
+ place_origin => 'Essen',
+ name_origin => 'HBf',
+ type_origin => 'stop',
+ place_destination => 'Koeln',
+ name_destination => 'HBf',
+ type_destination => 'stop',
+};
+
+my $efa = new_ok('WWW::Efa' => [%{$conf_default}]);
+
+can_ok($efa, qw{new submit parse connections});
+
+is_deeply($efa->{'config'}, $conf_default);
+is_deeply($efa->{'post'}, $post_default);
+
+$efa = WWW::Efa->new();