]> granicus.if.org Git - php/commitdiff
Adding language tests.
authorSteve Seear <stevseea@php.net>
Wed, 19 Mar 2008 18:06:26 +0000 (18:06 +0000)
committerSteve Seear <stevseea@php.net>
Wed, 19 Mar 2008 18:06:26 +0000 (18:06 +0000)
tests/lang/empty_variation.phpt [new file with mode: 0644]
tests/lang/inc_throw.inc [new file with mode: 0644]
tests/lang/include_files/echo.inc [new file with mode: 0644]
tests/lang/include_files/eval.inc [new file with mode: 0644]
tests/lang/include_files/function.inc [new file with mode: 0644]
tests/lang/include_variation1.phpt [new file with mode: 0644]
tests/lang/include_variation2.phpt [new file with mode: 0644]
tests/lang/include_variation3.phpt [new file with mode: 0644]
tests/lang/throw_variation_001.phpt [new file with mode: 0644]

diff --git a/tests/lang/empty_variation.phpt b/tests/lang/empty_variation.phpt
new file mode 100644 (file)
index 0000000..8e940da
--- /dev/null
@@ -0,0 +1,14 @@
+--TEST--
+empty() on array elements
+--FILE--
+<?php
+$a=array('0','empty'=>'0');
+var_dump(empty($a['empty']));
+var_dump(empty($a[0]));
+$b='0';
+var_dump(empty($b));
+?>
+--EXPECT--
+bool(true)
+bool(true)
+bool(true)
diff --git a/tests/lang/inc_throw.inc b/tests/lang/inc_throw.inc
new file mode 100644 (file)
index 0000000..1f032f7
--- /dev/null
@@ -0,0 +1,5 @@
+<?php
+
+throw new Exception();
+
+?>
diff --git a/tests/lang/include_files/echo.inc b/tests/lang/include_files/echo.inc
new file mode 100644 (file)
index 0000000..60714f6
--- /dev/null
@@ -0,0 +1,3 @@
+<?php
+echo "Included!\n";
+?>
\ No newline at end of file
diff --git a/tests/lang/include_files/eval.inc b/tests/lang/include_files/eval.inc
new file mode 100644 (file)
index 0000000..16da862
--- /dev/null
@@ -0,0 +1,3 @@
+<?php
+eval("require_once 'echo.inc';");
+?>
\ No newline at end of file
diff --git a/tests/lang/include_files/function.inc b/tests/lang/include_files/function.inc
new file mode 100644 (file)
index 0000000..528f46c
--- /dev/null
@@ -0,0 +1,3 @@
+<?php
+function test() { require_once 'echo.inc'; }
+?>
diff --git a/tests/lang/include_variation1.phpt b/tests/lang/include_variation1.phpt
new file mode 100644 (file)
index 0000000..cf99ba9
--- /dev/null
@@ -0,0 +1,8 @@
+--TEST--
+include() a file from the current script directory
+--FILE--
+<?php
+include("inc.inc");
+?>
+--EXPECT--
+Included!
diff --git a/tests/lang/include_variation2.phpt b/tests/lang/include_variation2.phpt
new file mode 100644 (file)
index 0000000..051ed71
--- /dev/null
@@ -0,0 +1,9 @@
+--TEST--
+Including a file in the current script directory from an included function
+--FILE--
+<?php
+require_once 'include_files/function.inc';
+test();
+?>
+--EXPECT--
+Included!
diff --git a/tests/lang/include_variation3.phpt b/tests/lang/include_variation3.phpt
new file mode 100644 (file)
index 0000000..1fa80c5
--- /dev/null
@@ -0,0 +1,8 @@
+--TEST--
+Including a file in the current script directory from eval'd code
+--FILE--
+<?php
+require_once 'include_files/eval.inc';
+?>
+--EXPECT--
+Included!
\ No newline at end of file
diff --git a/tests/lang/throw_variation_001.phpt b/tests/lang/throw_variation_001.phpt
new file mode 100644 (file)
index 0000000..d942a87
--- /dev/null
@@ -0,0 +1,14 @@
+--TEST--
+Catching an exception thrown from an included file
+--FILE--
+<?php
+
+try {
+       include "inc_throw.inc";
+} catch (Exception $e) {
+       echo "caught exception\n";
+}
+
+?>
+--EXPECT--
+caught exception