You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by mc...@apache.org on 2014/08/20 19:46:29 UTC
svn commit: r1619181 - in /qpid/trunk/qpid/cpp/bindings/qpid/perl/t:
Address.t Duration.t Message.t
Author: mcpierce
Date: Wed Aug 20 17:46:29 2014
New Revision: 1619181
URL: http://svn.apache.org/r1619181
Log:
QPID-5893: Perl unit tests now find the utils module.
The module's not on the @INC path, and really shouldn't be since it's
only used by the tests. So now the tests programmatically update @INC to
include their directory as a part of the path, and find utils.pm.
Fixed the failing Message.t file as well, which includes tests for
methods that are deprecated.
Modified:
qpid/trunk/qpid/cpp/bindings/qpid/perl/t/Address.t
qpid/trunk/qpid/cpp/bindings/qpid/perl/t/Duration.t
qpid/trunk/qpid/cpp/bindings/qpid/perl/t/Message.t
Modified: qpid/trunk/qpid/cpp/bindings/qpid/perl/t/Address.t
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/perl/t/Address.t?rev=1619181&r1=1619180&r2=1619181&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/perl/t/Address.t (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/perl/t/Address.t Wed Aug 20 17:46:29 2014
@@ -21,7 +21,10 @@
use Test::More qw(no_plan);
use Test::Exception;
-require 'utils.pm';
+# append the location of the test to the PERL5LIB path
+use File::Basename;
+BEGIN {push @INC, dirname (__FILE__)};
+use utils;
# verify that qpid is available
BEGIN { use_ok( 'qpid' ); }
Modified: qpid/trunk/qpid/cpp/bindings/qpid/perl/t/Duration.t
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/perl/t/Duration.t?rev=1619181&r1=1619180&r2=1619181&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/perl/t/Duration.t (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/perl/t/Duration.t Wed Aug 20 17:46:29 2014
@@ -21,7 +21,10 @@
use Test::More qw(no_plan);
use Test::Exception;
-require 'utils.pm';
+# append the location of the test to the PERL5LIB path
+use File::Basename;
+BEGIN {push @INC, dirname (__FILE__)};
+use utils;
# verify that qpid is available
BEGIN { use_ok( 'qpid' ); }
Modified: qpid/trunk/qpid/cpp/bindings/qpid/perl/t/Message.t
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/perl/t/Message.t?rev=1619181&r1=1619180&r2=1619181&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/perl/t/Message.t (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/perl/t/Message.t Wed Aug 20 17:46:29 2014
@@ -21,7 +21,10 @@
use Test::More qw(no_plan);
use Test::Exception;
-require 'utils.pm';
+# append the location of the test to the PERL5LIB path
+use File::Basename;
+BEGIN {push @INC, dirname (__FILE__)};
+use utils;
# verify that qpid is available
BEGIN { use_ok( 'qpid' ); }
@@ -241,53 +244,33 @@ dies_ok (sub {$message->set_content(unde
"Content cannot be null");
# can be an empty string
-$message->set_content("");
-ok ($message->get_content() eq "",
+$message->set_content_object("");
+ok ($message->get_content_object() eq "",
"Content can be an empty string");
# can be an arbitrary string
my $content = random_string(255);
-$message->set_content($content);
-ok ($message->get_content() eq $content,
+$message->set_content_object($content);
+ok ($message->get_content_object() eq $content,
"Content can be an arbitrary string");
# Embedded nulls should be handled properly
$content = { id => 1234, name => "With\x00null" };
qpid::messaging::encode($content, $message);
-my $map = qpid::messaging::decode_map($message);
+my $map = qpid::messaging::decode($message);
ok ($map->{name} eq "With\x00null",
"Nulls embedded in map values work.");
# Unicode strings shouldn't be broken
$content = { id => 1234, name => "Euro=\x{20AC}" };
qpid::messaging::encode($content, $message);
-$map = qpid::messaging::decode_map($message);
+$map = qpid::messaging::decode($message);
ok ($map->{name} eq "Euro=\x{20AC}",
"Unicode strings encoded correctly.");
# Maps inside maps should work
$content = { id => 1234, name => { first => "tom" } };
qpid::messaging::encode($content, $message);
-$map = qpid::messaging::decode_map($message);
+$map = qpid::messaging::decode($message);
ok ($map->{name}{first} eq "tom",
"Map inside map encoded correctly.");
-
-# Setting the content as a hash automatically encodes it
-($content) = {"id" => "1234", "name" => "qpid"};
-$message->set_content($content);
-ok ($message->get_content_type() eq "amqp/map",
- "Hashes are automatically encoded correctly");
-
-# Setting the content as a list automatically encodes it
-my @acontent = (1, 2, 3, 4);
-$message->set_content(\@acontent);
-ok ($message->get_content_type() eq "amqp/list",
- "Lists are automatically encoded correctly");
-
-# content size
-# content size is correct
-my $content_size = int(rand(256));
-$content = random_string($content_size);
-$message->set_content($content);
-ok ($message->get_content_size() == $content_size,
- "Content size is correct");
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org