#!/usr/bin/perl package bookfinder; use Test::More tests=>3; use strict; use warnings; require "index.cgi"; # empty string ok(! defined construct_search_word(''), 'empty string'); # only words my @words = qw(hello world); my @got = construct_search_word(join(' ', @words)); is_deeply(\@got, \@words, "word only"); # words and quoted string ## construct_search_word removes double quote characters from search string my @expected = @words; push @words, qq{"see you later"}; push @expected, qq{see you later}; # no double quote characters @expected = sort @expected; @got = construct_search_word(join(' ', @words)); my @sorted_got = sort @got; is_deeply(\@sorted_got, \@expected, "qouted string at the end");