diff options
| author | Steve Seear <stevseea@php.net> | 2008-03-19 18:06:24 +0000 |
|---|---|---|
| committer | Steve Seear <stevseea@php.net> | 2008-03-19 18:06:24 +0000 |
| commit | 801c79520816db5f4d0baf45f70068e6116f9f2f (patch) | |
| tree | 3d19da3b7d32a4198e20760cf7c97f39f5b51d36 /tests | |
| parent | 6e361fa7db07a2835993b23565c92e3b8dbfab4d (diff) | |
| download | php-git-801c79520816db5f4d0baf45f70068e6116f9f2f.tar.gz | |
Adding language tests.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/lang/empty_variation.phpt | 14 | ||||
| -rw-r--r-- | tests/lang/inc_throw.inc | 5 | ||||
| -rw-r--r-- | tests/lang/include_files/echo.inc | 3 | ||||
| -rw-r--r-- | tests/lang/include_files/eval.inc | 3 | ||||
| -rw-r--r-- | tests/lang/include_files/function.inc | 3 | ||||
| -rw-r--r-- | tests/lang/include_variation1.phpt | 8 | ||||
| -rw-r--r-- | tests/lang/include_variation2.phpt | 9 | ||||
| -rw-r--r-- | tests/lang/include_variation3.phpt | 8 | ||||
| -rw-r--r-- | tests/lang/throw_variation_001.phpt | 14 |
9 files changed, 67 insertions, 0 deletions
diff --git a/tests/lang/empty_variation.phpt b/tests/lang/empty_variation.phpt new file mode 100644 index 0000000000..8e940dae52 --- /dev/null +++ b/tests/lang/empty_variation.phpt @@ -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 index 0000000000..1f032f7e70 --- /dev/null +++ b/tests/lang/inc_throw.inc @@ -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 index 0000000000..60714f6e4f --- /dev/null +++ b/tests/lang/include_files/echo.inc @@ -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 index 0000000000..16da86295d --- /dev/null +++ b/tests/lang/include_files/eval.inc @@ -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 index 0000000000..528f46c564 --- /dev/null +++ b/tests/lang/include_files/function.inc @@ -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 index 0000000000..cf99ba9d37 --- /dev/null +++ b/tests/lang/include_variation1.phpt @@ -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 index 0000000000..051ed7157c --- /dev/null +++ b/tests/lang/include_variation2.phpt @@ -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 index 0000000000..1fa80c5ab9 --- /dev/null +++ b/tests/lang/include_variation3.phpt @@ -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 index 0000000000..d942a87930 --- /dev/null +++ b/tests/lang/throw_variation_001.phpt @@ -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 |
