From cd7b681b3bb1ff3c96b410643a1c18a61aaf3f67 Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Mon, 20 Dec 2004 09:23:58 +0000 Subject: [PATCH] Test for appropriate subclass relationships. --- t/1-node.t | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/t/1-node.t b/t/1-node.t index 7f4129f..2a53374 100644 --- a/t/1-node.t +++ b/t/1-node.t @@ -1,25 +1,28 @@ -# $Id: 1-node.t,v 1.2 2004-12-17 15:32:20 mike Exp $ +# $Id: 1-node.t,v 1.3 2004-12-20 09:23:58 mike Exp $ use strict; use warnings; -use Test::More tests => 11; +use Test::More tests => 14; BEGIN { use_ok('Net::Z3950::PQF') }; my $term1 = new Net::Z3950::PQF::TermNode('unix'); -ok(defined $term1, "created simple term node"); +ok(defined $term1, "created simple 'term' node"); +ok($term1->isa("Net::Z3950::PQF::Node"), "'term' is a node"); my $text = $term1->render(0); -ok($text eq "term: unix\n", "rendered simple term node"); +ok($text eq "term: unix\n", "rendered simple 'term' node"); my $term2 = new Net::Z3950::PQF::TermNode('elements', [ "bib-1", 1, 21 ], [ "bib-1", 2, 3 ]); -ok(defined $term2, "created term node with attrs"); +ok(defined $term2, "created 'term' node with attrs"); $text = $term2->render(0); ok($text eq "term: elements\n\tattr: bib-1 1=21\n\tattr: bib-1 2=3\n", - "rendered term node with attrs"); + "rendered 'term' node with attrs"); my $or = new Net::Z3950::PQF::OrNode($term1, $term2); -ok(defined $or, "created or node"); +ok(defined $or, "created 'or' node"); +ok($or->isa("Net::Z3950::PQF::BooleanNode"), "'or' is a boolean node"); +ok($or->isa("Net::Z3950::PQF::Node"), "'or' is a node"); $text = $or->render(0); my $wanted = <<'__EOT__'; or @@ -28,20 +31,20 @@ or attr: bib-1 1=21 attr: bib-1 2=3 __EOT__ -ok($text eq $wanted, "rendered or node"); +ok($text eq $wanted, "rendered 'or' node"); my $term3 = new Net::Z3950::PQF::TermNode('kerni', [ "bib-1", 1, 1003 ], [ "bib-1", 2, 3 ], [ "bib-1", 5, 1 ]); -ok(defined $term3, "created third term node"); +ok(defined $term3, "created third 'term' node"); $text = $term3->render(0); ok($text eq ("term: kerni\n\tattr: bib-1 1=1003\n" . "\tattr: bib-1 2=3\n\tattr: bib-1 5=1\n"), - "rendered third term node"); + "rendered third 'term' node"); my $and = new Net::Z3950::PQF::AndNode($or, $term3); -ok(defined $and, "created and node"); +ok(defined $and, "created 'and' node"); $text = $and->render(0); $wanted = <<'__EOT__'; and @@ -55,4 +58,4 @@ and attr: bib-1 2=3 attr: bib-1 5=1 __EOT__ -ok($text eq $wanted, "rendered and node"); +ok($text eq $wanted, "rendered 'and' node"); -- 1.7.10.4