You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axkit-dev@xml.apache.org by ma...@apache.org on 2003/08/28 02:50:06 UTC

cvs commit: xml-axkit/t/response/TestAxKit 01provider.pm 02language.pm 03stylechooser.pm 04plugins.pm 05mediachooser.pm 11xsp_attr_value_template.pm

mach        2003/08/27 17:50:06

  Added:       t        AxKitTestModule.pm
               t/response/TestAxKit 01provider.pm 02language.pm
                        03stylechooser.pm 04plugins.pm 05mediachooser.pm
                        11xsp_attr_value_template.pm
  Removed:     t        01provider.t 02language.t 03stylechooser.t
                        04plugins.t 05mediachooser.t
                        11xsp_attr_value_template.t test_module.pl
  Log:
  Changing test_module() tests to use Apache::Test; that way they
  run under apache1 and apache2. Problem was that Apache::Request
  won't run from the command line under apache2 as it gives undefined
  symbols.
  
  (this is so I'm running the same tests with Apache2 as with Apache1).
  
  Revision  Changes    Path
  1.1                  xml-axkit/t/AxKitTestModule.pm
  
  Index: AxKitTestModule.pm
  ===================================================================
  package AxKitTestModule;
  
  require Exporter;
  @ISA = qw(Exporter);
  
  @EXPORT_OK = qw(&test_module);
  
  use Apache::Test;
  use Apache::TestUtil;
  
  sub test_module {
      my ($module, @prereqs) = @_;
      foreach my $prereq (@prereqs) {
          my ($ok, $reason) = load_module($prereq);
          if (!$ok) {
              skip("Skip($prereq prerequisite module not available : $reason)", 1);
              return;
          }
      }
      my ($ok, $reason) = load_module($module);
      ok ($ok,1,$reason);
  }
  
  sub load_module {
      my $module = shift;
      $module =~ s/::/\//g;
      eval {
          require "$module.pm";
      };
      if ($@) {
  		wantarray ? return (0, $@) : 0;
      }
      return 1;
  }
  
  
  1;
  
  
  
  1.1                  xml-axkit/t/response/TestAxKit/01provider.pm
  
  Index: 01provider.pm
  ===================================================================
  package TestAxKit::01provider;
  
  use strict;
  use warnings FATAL => 'all';
  use Apache::Test;
  use Apache::TestUtil;
  use constant MP2 => $mod_perl::VERSION >= 1.99;
  use AxKitTestModule qw(test_module);
    
  BEGIN {
  	if (MP2) {
  		require Apache::Const;
  		Apache::Const->import(-compile => qw(OK DECLINED));
  	} else {
  		require Apache::Constants;
  		Apache::Constants->import(qw(OK DECLINED));
  	}
  } 
  
  sub handler {
      my $r = shift;
  
      plan $r, tests => 4;
  
  	test_module("Apache::AxKit::Provider");
  
  	test_module("Apache::AxKit::Provider::File");
  
  	test_module("Apache::AxKit::Provider::Scalar");
  
  	test_module("Apache::AxKit::Provider::Filter", "Apache::Filter");
  	
      return MP2 ? Apache::OK : Apache::Constants::OK; 
  }
  
  
  1;
  
  
  
  1.1                  xml-axkit/t/response/TestAxKit/02language.pm
  
  Index: 02language.pm
  ===================================================================
  package TestAxKit::02language;
  
  use strict;
  use warnings FATAL => 'all';
  use Apache::Test;
  use Apache::TestUtil;
  use constant MP2 => $mod_perl::VERSION >= 1.99;
  use AxKitTestModule qw(test_module);
    
  BEGIN {
  	if (MP2) {
  		require Apache::Const;
  		Apache::Const->import(-compile => qw(OK DECLINED));
  	} else {
  		require Apache::Constants;
  		Apache::Constants->import(qw(OK DECLINED));
  	}
  } 
  
  
  sub handler {
      my $r = shift;
  
      plan $r, tests => 9;
  
  	test_module("Apache::AxKit::Language::XPathScript", "XML::XPath");
  
  	test_module("Apache::AxKit::Language::AxPoint", "XML::Handler::AxPoint");
  
  	test_module("Apache::AxKit::Language::Sablot", "XML::Sablotron");
  
  	test_module("Apache::AxKit::Language::LibXSLT", "XML::LibXSLT");
  
  	test_module("Apache::AxKit::Language::XMLNewsRDF", "XMLNews::HTMLTemplate");
  
  	test_module("Apache::AxKit::Language::XMLNewsNITF", "XMLNews::HTMLTemplate");
  
  	test_module("Apache::AxKit::Language::XSP", "XML::LibXML");
  
  	test_module("Apache::AxKit::Language::XSP::TaglibHelper", "XML::LibXML");
  
  	test_module("Apache::AxKit::Language::PassiveTeX");
  	
      return MP2 ? Apache::OK : Apache::Constants::OK; 
  }
  
  
  1;
  
  
  
  1.1                  xml-axkit/t/response/TestAxKit/03stylechooser.pm
  
  Index: 03stylechooser.pm
  ===================================================================
  package TestAxKit::03stylechooser;
  
  use strict;
  use warnings FATAL => 'all';
  use Apache::Test;
  use Apache::TestUtil;
  use constant MP2 => $mod_perl::VERSION >= 1.99;
  use AxKitTestModule qw(test_module);
    
  BEGIN {
  	if (MP2) {
  		require Apache::Const;
  		Apache::Const->import(-compile => qw(OK DECLINED));
  	} else {
  		require Apache::Constants;
  		Apache::Constants->import(qw(OK DECLINED));
  	}
  } 
  
  
  
  sub handler {
      my $r = shift;
  
      plan $r, tests => 5;
  
  	test_module("Apache::AxKit::StyleChooser::FileSuffix");
  
  	test_module("Apache::AxKit::StyleChooser::Cookie");
  
  	test_module("Apache::AxKit::StyleChooser::PathInfo");
  
  	test_module("Apache::AxKit::StyleChooser::QueryString");
  
  	test_module("Apache::AxKit::StyleChooser::UserAgent");
  	
      return MP2 ? Apache::OK : Apache::Constants::OK; 
  }
  
  
  1;
  
  
  
  1.1                  xml-axkit/t/response/TestAxKit/04plugins.pm
  
  Index: 04plugins.pm
  ===================================================================
  package TestAxKit::04plugins;
  
  use strict;
  use warnings FATAL => 'all';
  use Apache::Test;
  use Apache::TestUtil;
  use constant MP2 => $mod_perl::VERSION >= 1.99;
  use AxKitTestModule qw(test_module);
    
  BEGIN {
  	if (MP2) {
  		require Apache::Const;
  		Apache::Const->import(-compile => qw(OK DECLINED));
  	} else {
  		require Apache::Constants;
  		Apache::Constants->import(qw(OK DECLINED));
  	}
  } 
  
  
  sub handler {
      my $r = shift;
  
      plan $r, tests => 3;
  
  	test_module("Apache::AxKit::Plugin::Fragment", "XML::XPath");
  
  	test_module("Apache::AxKit::Plugin::Passthru");
  
  	test_module("Apache::AxKit::Plugin::QueryStringCache");
  	
      return MP2 ? Apache::OK : Apache::Constants::OK; 
  }
  
  
  1;
  
  
  
  1.1                  xml-axkit/t/response/TestAxKit/05mediachooser.pm
  
  Index: 05mediachooser.pm
  ===================================================================
  package TestAxKit::05mediachooser;
  
  use strict;
  use warnings FATAL => 'all';
  use Apache::Test;
  use Apache::TestUtil;
  use constant MP2 => $mod_perl::VERSION >= 1.99;
  use AxKitTestModule qw(test_module);
    
  BEGIN {
  	if (MP2) {
  		require Apache::Const;
  		Apache::Const->import(-compile => qw(OK DECLINED));
  	} else {
  		require Apache::Constants;
  		Apache::Constants->import(qw(OK DECLINED));
  	}
  } 
  
  sub handler {
      my $r = shift;
  
      plan $r, tests => 1;
  
  	test_module("Apache::AxKit::MediaChooser::WAPCheck");
  	
      return MP2 ? Apache::OK : Apache::Constants::OK; 
  }
  
  
  1;
  
  
  
  1.1                  xml-axkit/t/response/TestAxKit/11xsp_attr_value_template.pm
  
  Index: 11xsp_attr_value_template.pm
  ===================================================================
  package TestAxKit::11xsp_attr_value_template;
  
  use strict;
  use warnings FATAL => 'all';
  use Apache::Test;
  use Apache::TestUtil;
  use constant MP2 => $mod_perl::VERSION >= 1.99;
  
  use Apache::AxKit::Language::XSP;
  
  # Test for attribute value templates
  
  sub handler{
  	my $r = shift;
  	plan $r, tests => 12;
  
  	my $e = {};
  	
  	{
  		# test no curlies is OK
  		my $value = 'value';
  		my $result = AxKit::XSP::DefaultHandler::_attr_value_template($e, $value);
  		ok($result);
  		ok($result !~ /do/);
  		print $result, "\n";
  		eval $result;
  		ok(!$@);
  	}
  	
  	{
  		# test 1 curly is OK
  		my $value = 'value {{';
  		my $result = AxKit::XSP::DefaultHandler::_attr_value_template($e, $value);
  		ok($result);
  		ok($result !~ /do/);
  		print $result, "\n";
  		eval $result;
  		ok(!$@);
  	}
  	
  	{
  		# test expr is OK
  		my $value = 'value {time()}';
  		my $result = AxKit::XSP::DefaultHandler::_attr_value_template($e, $value);
  		ok($result);
  		ok($result =~ /do/);
  		print $result, "\n";
  		eval $result;
  		ok(!$@);
  	}
  	
  	{
  		# test 2 expr is OK
  		my $value = 'value {time()} text {time()}';
  		my $result = AxKit::XSP::DefaultHandler::_attr_value_template($e, $value);
  		ok($result);
  		ok($result =~ /do/);
  		print $result, "\n";
  		eval $result;
  		ok(!$@);
  	}
  
      return MP2 ? Apache::OK : Apache::Constants::OK; 
  }
  	
  1;