* Add enclair_db option to UserDB.pm. Allows logging of enclair password
[interchange.git] / code / SystemTag / harness.coretag
1 # Copyright 2002-2007 Interchange Development Group and others
2
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.  See the LICENSE file for details.
7
8 # $Id: harness.coretag,v 1.4 2007-03-30 23:40:49 pajamian Exp $
9
10 UserTag harness             addAttr
11 UserTag harness             hasEndTag
12 UserTag harness             PosNumber    0
13 UserTag harness             Version      $Revision: 1.4 $
14 UserTag harness             Routine      <<EOR
15 my $Test = 'test001';
16 sub {
17         my ($opt, $input) = @_;
18         my $not;
19         my $expected =  $opt->{expected} || 'OK';
20         $input =~ s:^\s+::;
21         $input =~ s:\s+$::;
22         $input =~ s:\s*\[expected\](.*)\[/expected\]\s*::s
23                 and $expected = $1;
24         $input =~ s:\[not\](.*)\[/not\]::s
25                 and $not = $1;
26         my $name = $Test++;
27         $name = $opt->{name}
28                 if defined $opt->{name};
29         my $result;
30         eval {
31                 $result = Vend::Interpolate::interpolate_html($input);
32         };
33         if($@) {
34                 my $msg = "DIED in test $name. \$\@: $@";
35 #::logDebug($msg);
36                 return $msg;
37         }
38         if($expected) {
39                 return "NOT OK $name: $result!=$expected" unless $result =~ /$expected/;
40         }
41         if($not) {
42                 return "NOT OK $name: $result==$not" unless $result !~ /$not/;
43         }
44         return "OK $name";
45 }
46 EOR