You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by sf...@apache.org on 2011/05/14 15:25:29 UTC
svn commit: r1103100 - in /httpd/test/framework/trunk/t: apache/expr.t
htdocs/expr/zero
Author: sf
Date: Sat May 14 13:25:29 2011
New Revision: 1103100
URL: http://svn.apache.org/viewvc?rev=1103100&view=rev
Log:
Add some tests for the new ap_expr file operators
Added:
httpd/test/framework/trunk/t/htdocs/expr/zero
Modified:
httpd/test/framework/trunk/t/apache/expr.t
Modified: httpd/test/framework/trunk/t/apache/expr.t
URL: http://svn.apache.org/viewvc/httpd/test/framework/trunk/t/apache/expr.t?rev=1103100&r1=1103099&r2=1103100&view=diff
==============================================================================
--- httpd/test/framework/trunk/t/apache/expr.t (original)
+++ httpd/test/framework/trunk/t/apache/expr.t Sat May 14 13:25:29 2011
@@ -11,6 +11,10 @@ use File::Spec;
Apache::TestRequest::user_agent(keep_alive => 1);
+my $file_foo = Apache::Test::vars('serverroot') . '/htdocs/expr/index.html';
+my $dir_foo = Apache::Test::vars('serverroot') . '/htdocs/expr';
+my $file_notexist = Apache::Test::vars('serverroot') . '/htdocs/expr/none';
+my $file_zero = Apache::Test::vars('serverroot') . '/htdocs/expr/zero';
my @test_cases = (
[ 'true' => 1 ],
[ 'false' => 0 ],
@@ -118,13 +122,31 @@ my @test_cases = (
[ q[toupper(escape('?')) = '%3F' ] => 1 ],
[ q[tolower(toupper(escape('?'))) = '%3f' ] => 1 ],
[ q[%{toupper:%{escape:?}} = '%3F' ] => 1 ],
- [ q[file('] . Apache::Test::vars('serverroot')
- . q[/htdocs/expr/index.html') = 'foo\n' ] => 1 ],
+ [ q[file('] . $file_foo . q[') = 'foo\n' ] => 1 ],
+ [ q[filesize('] . $file_foo . q[') = 4 ] => 1 ],
+ [ q[filesize('] . $file_notexist . q[') = 0 ] => 1 ],
+ [ q[filesize('] . $file_zero . q[') = 0 ] => 1 ],
# unary operators
[ q[-n ''] => 0 ],
[ q[-z ''] => 1 ],
[ q[-n '1'] => 1 ],
[ q[-z '1'] => 0 ],
+ [ qq[-d '$file_foo' ] => 0 ],
+ [ qq[-e '$file_foo' ] => 1 ],
+ [ qq[-f '$file_foo' ] => 1 ],
+ [ qq[-S '$file_foo' ] => 1 ],
+ [ qq[-d '$file_zero' ] => 0 ],
+ [ qq[-e '$file_zero' ] => 1 ],
+ [ qq[-f '$file_zero' ] => 1 ],
+ [ qq[-S '$file_zero' ] => 0 ],
+ [ qq[-d '$dir_foo' ] => 1 ],
+ [ qq[-e '$dir_foo' ] => 1 ],
+ [ qq[-f '$dir_foo' ] => 0 ],
+ [ qq[-S '$dir_foo' ] => 0 ],
+ [ qq[-d '$file_notexist' ] => 0 ],
+ [ qq[-e '$file_notexist' ] => 0 ],
+ [ qq[-f '$file_notexist' ] => 0 ],
+ [ qq[-S '$file_notexist' ] => 0 ],
# IP match
[ q[-R 'abc'] => undef ],
[ q[-R %{REMOTE_ADDR}] => undef ],
Added: httpd/test/framework/trunk/t/htdocs/expr/zero
URL: http://svn.apache.org/viewvc/httpd/test/framework/trunk/t/htdocs/expr/zero?rev=1103100&view=auto
==============================================================================
(empty)