[protobuf-perl commit] r157 - trunk/perl/t

0 views
Skip to first unread message

codesite...@google.com

unread,
Jul 31, 2008, 6:46:36 PM7/31/08
to protobuf-p...@googlegroups.com
Author: br...@danga.com
Date: Thu Jul 31 15:45:50 2008
New Revision: 157

Added:
trunk/perl/t/optional-fields.t

Log:
optional field test

Added: trunk/perl/t/optional-fields.t
==============================================================================
--- (empty file)
+++ trunk/perl/t/optional-fields.t Thu Jul 31 15:45:50 2008
@@ -0,0 +1,25 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use Test::More 'no_plan';
+use FindBin qw($Bin);
+
+use lib "$Bin/lib";
+use Test::Protobuf;
+
+use lib "$Bin/autogen";
+use_ok("ProtobufTestBasic"); # unittest_basic.proto
+
+my $p = ProtobufTestBasic::TestAllTypes->new;
+ok(!$p->has_optional_int32, "doesn't have optional int32");
+$p->set_optional_int32(42);
+is($p->optional_int32, 42, "does it's set.");
+ok($p->has_optional_int32, "and has field.");
+
+ok(!$p->has_optional_nested_message, "doesn't have optional NestedMessage");
+ok($p->optional_nested_message, "true. got a new default one constructed.");
+ok($p->has_optional_nested_message, "and that vivified it.");
+
+
+

Reply all
Reply to author
Forward
0 new messages