From 6ec7c9516ca58de0abf351123bbe7c814c092c46 Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Fri, 17 Dec 2004 15:31:16 +0000 Subject: [PATCH] Rename 1.t to 1-node.t --- t/1-node.t | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ t/1.t | 65 ------------------------------------------------------------ 2 files changed, 65 insertions(+), 65 deletions(-) create mode 100644 t/1-node.t delete mode 100644 t/1.t diff --git a/t/1-node.t b/t/1-node.t new file mode 100644 index 0000000..c1be182 --- /dev/null +++ b/t/1-node.t @@ -0,0 +1,65 @@ +# $Id: 1-node.t,v 1.1 2004-12-17 15:31:16 mike Exp $ + +# Before `make install' is performed this script should be runnable with +# `make test'. After `make install' it should work as `perl 1.t' + +######################### + +# change 'tests => 1' to 'tests => last_test_to_print'; + +use strict; +use warnings; +use Test::More tests => 11; +BEGIN { use_ok('Net::Z3950::PQF') }; + +my $term1 = new Net::Z3950::PQF::TermNode('unix'); +ok(defined $term1, "created simple term node"); +my $text = $term1->render(0); +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"); +$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"); + +my $or = new Net::Z3950::PQF::OrNode($term1, $term2); +ok(defined $or, "created or node"); +$text = $or->render(0); +my $wanted = <<'__EOT__'; +or + term: unix + term: elements + attr: bib-1 1=21 + attr: bib-1 2=3 +__EOT__ +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"); +$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"); + +my $and = new Net::Z3950::PQF::AndNode($or, $term3); +ok(defined $and, "created and node"); +$text = $and->render(0); +$wanted = <<'__EOT__'; +and + or + term: unix + term: elements + attr: bib-1 1=21 + attr: bib-1 2=3 + term: kerni + attr: bib-1 1=1003 + attr: bib-1 2=3 + attr: bib-1 5=1 +__EOT__ +ok($text eq $wanted, "rendered and node"); diff --git a/t/1.t b/t/1.t deleted file mode 100644 index 7b842d7..0000000 --- a/t/1.t +++ /dev/null @@ -1,65 +0,0 @@ -# $Id: 1.t,v 1.3 2004-12-17 15:30:39 mike Exp $ - -# Before `make install' is performed this script should be runnable with -# `make test'. After `make install' it should work as `perl 1.t' - -######################### - -# change 'tests => 1' to 'tests => last_test_to_print'; - -use strict; -use warnings; -use Test::More tests => 11; -BEGIN { use_ok('Net::Z3950::PQF') }; - -my $term1 = new Net::Z3950::PQF::TermNode('unix'); -ok(defined $term1, "created simple term node"); -my $text = $term1->render(0); -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"); -$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"); - -my $or = new Net::Z3950::PQF::OrNode($term1, $term2); -ok(defined $or, "created or node"); -$text = $or->render(0); -my $wanted = <<'__EOT__'; -or - term: unix - term: elements - attr: bib-1 1=21 - attr: bib-1 2=3 -__EOT__ -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"); -$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"); - -my $and = new Net::Z3950::PQF::AndNode($or, $term3); -ok(defined $and, "created and node"); -$text = $and->render(0); -$wanted = <<'__EOT__'; -and - or - term: unix - term: elements - attr: bib-1 1=21 - attr: bib-1 2=3 - term: kerni - attr: bib-1 1=1003 - attr: bib-1 2=3 - attr: bib-1 5=1 -__EOT__ -ok($text eq $wanted, "rendered and node"); -- 1.7.10.4