Author: spadkins
Date: Tue Jun 26 08:30:50 2007
New Revision: 9684
Modified:
p5ee/trunk/App-Context/t/Reference.t
Log:
added tests for the overlay() method
Modified: p5ee/trunk/App-Context/t/Reference.t
==============================================================================
--- p5ee/trunk/App-Context/t/Reference.t (original)
+++ p5ee/trunk/App-Context/t/Reference.t Tue Jun 26 08:30:50 2007
@@ -29,5 +29,36 @@
$branch = $ref->get_branch("zeta.alpha", 1);
ok(defined $branch, "newly existent branch");
+my $ref1 = {
+ SessionObject => {
+ foo => {
+ class => "App::Widget::Label",
+ },
+ },
+};
+
+my $ref2 = {
+ SessionObject => {
+ foo => {
+ class => "App::Widget::TextField",
+ label => "hello",
+ },
+ bar => {
+ class => "App::Widget::Label",
+ label => "world",
+ columns => ["global","destruction"],
+ },
+ },
+};
+
+$ref->overlay($ref1, $ref2);
+is($ref1->{SessionObject}{foo}{class}, "App::Widget::Label", "overlay():
foo.class not overwritten");
+is($ref1->{SessionObject}{foo}{label}, "hello", "overlay(): foo.label set");
+is($ref1->{SessionObject}{bar}{class}, "App::Widget::Label", "overlay():
bar.class set");
+is($ref1->{SessionObject}{bar}{label}, "world", "overlay(): bar.label set");
+ok($ref1->{SessionObject}{foo} ne $ref2->{SessionObject}{foo}, "overlay(): foo
was not a deep link from ref1 to ref2");
+ok($ref1->{SessionObject}{bar} eq $ref2->{SessionObject}{bar}, "overlay(): bar
was a deep link from ref1 to ref2");
+ok($ref1->{SessionObject}{bar}{columns} eq
$ref2->{SessionObject}{bar}{columns}, "overlay(): bar.columns was a deep link
from ref1 to ref2");
+
exit 0;