summaryrefslogtreecommitdiff
path: root/ext/zlib/tests/gzseek_variation7.phpt
diff options
context:
space:
mode:
authorDave Kelsey <dkelsey@php.net>2009-01-21 15:24:13 (GMT)
committerDave Kelsey <dkelsey@php.net>2009-01-21 15:24:13 (GMT)
commit7d8c189a6dc9ccc58d1b4ccc8a6497fb1d7ba4e9 (patch)
tree13122ddb8874553af36c6e622cf1e65010eb9c9a /ext/zlib/tests/gzseek_variation7.phpt
parent30a0135d184e749759a4370a14171a1fe5621192 (diff)
downloadphp-7d8c189a6dc9ccc58d1b4ccc8a6497fb1d7ba4e9.tar.gz
new tests for zlib extension, tested on windows, linux and linux64
Diffstat (limited to 'ext/zlib/tests/gzseek_variation7.phpt')
-rw-r--r--ext/zlib/tests/gzseek_variation7.phpt47
1 files changed, 47 insertions, 0 deletions
diff --git a/ext/zlib/tests/gzseek_variation7.phpt b/ext/zlib/tests/gzseek_variation7.phpt
new file mode 100644
index 0000000..aab0834
--- /dev/null
+++ b/ext/zlib/tests/gzseek_variation7.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test function gzseek() by calling it with SEEK_END when writing
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+$f = "temp3.txt.gz";
+$h = gzopen($f, 'w');
+$str1 = "This is the first line.";
+$str2 = "This is the second line.";
+gzwrite($h, $str1);
+echo "tell=";
+var_dump(gztell($h));
+
+//seek to the end which is not sensible of course.
+echo "move to the end of the file\n";
+var_dump(gzseek($h, 0, SEEK_END));
+echo "tell=";
+var_dump(gztell($h));
+gzwrite($h, $str2);
+echo "tell=";
+var_dump(gztell($h));
+gzclose($h);
+echo "\nreading the output file\n";
+$h = gzopen($f, 'r');
+gzpassthru($h);
+gzclose($h);
+echo "\n";
+unlink($f);
+?>
+===DONE===
+--EXPECTF--
+tell=int(23)
+move to the end of the file
+
+Warning: gzseek(): SEEK_END is not supported in %s on line %d
+int(-1)
+tell=int(23)
+tell=int(47)
+
+reading the output file
+This is the first line.This is the second line.
+===DONE=== \ No newline at end of file