[Bast-commits] r4648 - DBIx-Class-Tree-NestedSet/t
rafl at dev.catalyst.perl.org
rafl at dev.catalyst.perl.org
Fri Jul 25 23:48:16 BST 2008
Author: rafl
Date: 2008-07-25 23:48:16 +0100 (Fri, 25 Jul 2008)
New Revision: 4648
Modified:
DBIx-Class-Tree-NestedSet/t/multi.t
Log:
Test is_{root,branch,leaf}.
Modified: DBIx-Class-Tree-NestedSet/t/multi.t
===================================================================
--- DBIx-Class-Tree-NestedSet/t/multi.t 2008-07-25 22:48:10 UTC (rev 4647)
+++ DBIx-Class-Tree-NestedSet/t/multi.t 2008-07-25 22:48:16 UTC (rev 4648)
@@ -1,6 +1,6 @@
use strict;
use warnings;
-use Test::More tests => 23;
+use Test::More tests => 32;
use DBICx::TestDatabase;
use FindBin;
@@ -22,6 +22,10 @@
is($root->children->count, 0, 'no children, initially');
is($root->nodes->count, 1, 'nodes include self');
+ok( $root->is_root, 'is_root()');
+ok( $root->is_leaf, 'is_leaf()');
+ok(!$root->is_branch, 'is_branch()');
+
my $child = $root->add_to_children({ content => 'bar' });
is($child->root->id, $root->id, 'root set for children');
is($child->parents->count, 1, 'child got one parent');
@@ -29,6 +33,13 @@
is($root->children->count, 1, 'now one child');
is($root->nodes->count, 2, '... and two related nodes');
+ok( $root->is_root, 'is_root()');
+ok(!$root->is_leaf, 'is_leaf()');
+ok( $root->is_branch, 'is_branch()');
+ok(!$child->is_root, 'is_root()');
+ok( $child->is_leaf, 'is_leaf()');
+ok(!$child->is_branch, 'is_branch()');
+
my $child2 = $root->add_to_children({ content => 'kooh' });
my $subchild = $child->add_to_children({ content => 'moo' });
More information about the Bast-commits
mailing list