From 0b4fc7c76841399c4a9c3946a3f162e774a9e295 Mon Sep 17 00:00:00 2001 From: Raghubansh Kumar Date: Sat, 21 Jul 2007 07:55:07 +0000 Subject: [PATCH] New testcases for fgetc() and fgets() functions --- ext/standard/tests/file/fgetc_variation1.phpt | 94 +++ ext/standard/tests/file/fgetc_variation2.phpt | 65 ++ ext/standard/tests/file/fgetc_variation3.phpt | 117 ++++ ext/standard/tests/file/fgetc_variation4.phpt | 290 +++++++++ ext/standard/tests/file/fgets_basic.phpt | 318 ++++++++++ ext/standard/tests/file/fgets_error.phpt | 107 ++++ ext/standard/tests/file/fgets_variation1.phpt | 116 ++++ ext/standard/tests/file/fgets_variation2.phpt | 62 ++ ext/standard/tests/file/fgets_variation3.phpt | 500 +++++++++++++++ .../tests/file/fgets_variation4-win32.phpt | 574 ++++++++++++++++++ ext/standard/tests/file/fgets_variation4.phpt | 574 ++++++++++++++++++ ext/standard/tests/file/fgets_variation5.phpt | 302 +++++++++ .../tests/file/fgets_variation6-win32.phpt | 372 ++++++++++++ ext/standard/tests/file/fgets_variation6.phpt | 372 ++++++++++++ 14 files changed, 3863 insertions(+) create mode 100644 ext/standard/tests/file/fgetc_variation1.phpt create mode 100644 ext/standard/tests/file/fgetc_variation2.phpt create mode 100644 ext/standard/tests/file/fgetc_variation3.phpt create mode 100644 ext/standard/tests/file/fgetc_variation4.phpt create mode 100644 ext/standard/tests/file/fgets_basic.phpt create mode 100644 ext/standard/tests/file/fgets_error.phpt create mode 100644 ext/standard/tests/file/fgets_variation1.phpt create mode 100644 ext/standard/tests/file/fgets_variation2.phpt create mode 100644 ext/standard/tests/file/fgets_variation3.phpt create mode 100644 ext/standard/tests/file/fgets_variation4-win32.phpt create mode 100644 ext/standard/tests/file/fgets_variation4.phpt create mode 100644 ext/standard/tests/file/fgets_variation5.phpt create mode 100644 ext/standard/tests/file/fgets_variation6-win32.phpt create mode 100644 ext/standard/tests/file/fgets_variation6.phpt diff --git a/ext/standard/tests/file/fgetc_variation1.phpt b/ext/standard/tests/file/fgetc_variation1.phpt new file mode 100644 index 00000000000..007b2e0f9cd --- /dev/null +++ b/ext/standard/tests/file/fgetc_variation1.phpt @@ -0,0 +1,94 @@ +--TEST-- +Test fgetc() function : usage variations - read when file pointer at EOF +--FILE-- + +--CLEAN-- + +--EXPECTF-- +*** Testing fgetc() : usage variations *** +-- Testing fgetc() with file whose file pointer is pointing to EOF -- +-- File opened in mode : r -- +int(0) +bool(false) +int(1024) +bool(false) +bool(true) +int(1024) +-- File opened in mode : rb -- +int(0) +bool(false) +int(1024) +bool(false) +bool(true) +int(1024) +-- File opened in mode : rt -- +int(0) +bool(false) +int(1024) +bool(false) +bool(true) +int(1024) +-- File opened in mode : r+ -- +int(0) +bool(false) +int(1024) +bool(false) +bool(true) +int(1024) +-- File opened in mode : r+b -- +int(0) +bool(false) +int(1024) +bool(false) +bool(true) +int(1024) +-- File opened in mode : r+t -- +int(0) +bool(false) +int(1024) +bool(false) +bool(true) +int(1024) +Done diff --git a/ext/standard/tests/file/fgetc_variation2.phpt b/ext/standard/tests/file/fgetc_variation2.phpt new file mode 100644 index 00000000000..d733c290927 --- /dev/null +++ b/ext/standard/tests/file/fgetc_variation2.phpt @@ -0,0 +1,65 @@ +--TEST-- +Test fgetc() function : usage variations - closed handle +--FILE-- + +--EXPECTF-- +*** Testing fgetc() : usage variations *** +-- Testing fgetc() with closed handle -- + +Warning: fgetc(): 6 is not a valid stream resource in %s on line %d +bool(false) +-- Testing fgetc() with unset handle -- + +Notice: Undefined variable: file_handle in %s on line %d + +Warning: fgetc(): supplied argument is not a valid stream resource in %s on line %d +bool(false) +Done +--UEXPECTF-- +*** Testing fgetc() : usage variations *** +-- Testing fgetc() with closed handle -- + +Warning: fgetc(): 6 is not a valid stream resource in %s on line %d +bool(false) +-- Testing fgetc() with unset handle -- + +Notice: Undefined variable: file_handle in %s on line %d + +Warning: fgetc(): supplied argument is not a valid stream resource in %s on line %d +bool(false) +Done diff --git a/ext/standard/tests/file/fgetc_variation3.phpt b/ext/standard/tests/file/fgetc_variation3.phpt new file mode 100644 index 00000000000..036db51451c --- /dev/null +++ b/ext/standard/tests/file/fgetc_variation3.phpt @@ -0,0 +1,117 @@ +--TEST-- +Test fgetc() function : usage variations - write only modes (fails, see bug#42036) +--FILE-- + +--EXPECTF-- +*** Testing fgetc() with file opened in write only mode *** +-- File opened in mode : w -- +bool(true) +int(0) +bool(false) +bool(false) +int(0) +bool(false) +-- File opened in mode : wb -- +bool(true) +int(0) +bool(false) +bool(false) +int(0) +bool(false) +-- File opened in mode : wt -- +bool(true) +int(0) +bool(false) +bool(false) +int(0) +bool(false) +-- File opened in mode : a -- +bool(true) +int(0) +bool(false) +bool(false) +int(0) +bool(false) +-- File opened in mode : ab -- +bool(true) +int(0) +bool(false) +bool(false) +int(0) +bool(false) +-- File opened in mode : at -- +bool(true) +int(0) +bool(false) +bool(false) +int(0) +bool(false) +-- File opened in mode : x -- +bool(true) +int(0) +bool(false) +bool(false) +int(0) +bool(false) +-- File opened in mode : xb -- +bool(true) +int(0) +bool(false) +bool(false) +int(0) +bool(false) +-- File opened in mode : xt -- +bool(true) +int(0) +bool(false) +bool(false) +int(0) +bool(false) +Done diff --git a/ext/standard/tests/file/fgetc_variation4.phpt b/ext/standard/tests/file/fgetc_variation4.phpt new file mode 100644 index 00000000000..15d5b60b8cc --- /dev/null +++ b/ext/standard/tests/file/fgetc_variation4.phpt @@ -0,0 +1,290 @@ +--TEST-- +Test fgetc() function : usage variations - different read modes +--FILE-- + +--EXPECTF-- + *** Testing fgetc() : usage variations *** +-- Testing fgetc() with files opened with different read modes -- +-- File opened in mode : a+ -- +bool(true) +int(0) +bool(false) +string(1) "f" +int(1) +bool(false) +string(1) "g" +int(2) +bool(false) +string(1) "e" +int(3) +bool(false) +string(1) "t" +int(4) +bool(false) +string(1) "c" +int(5) +bool(false) +string(1) " +" +int(6) +bool(false) +string(1) " " +int(7) +bool(false) +-- File opened in mode : a+b -- +bool(true) +int(0) +bool(false) +string(1) "f" +int(1) +bool(false) +string(1) "g" +int(2) +bool(false) +string(1) "e" +int(3) +bool(false) +string(1) "t" +int(4) +bool(false) +string(1) "c" +int(5) +bool(false) +string(1) " +" +int(6) +bool(false) +string(1) " " +int(7) +bool(false) +-- File opened in mode : a+t -- +bool(true) +int(0) +bool(false) +string(1) "f" +int(1) +bool(false) +string(1) "g" +int(2) +bool(false) +string(1) "e" +int(3) +bool(false) +string(1) "t" +int(4) +bool(false) +string(1) "c" +int(5) +bool(false) +string(1) " +" +int(6) +bool(false) +string(1) " " +int(7) +bool(false) +-- File opened in mode : x+ -- +bool(true) +int(0) +bool(false) +string(1) "f" +int(1) +bool(false) +string(1) "g" +int(2) +bool(false) +string(1) "e" +int(3) +bool(false) +string(1) "t" +int(4) +bool(false) +string(1) "c" +int(5) +bool(false) +string(1) " +" +int(6) +bool(false) +string(1) " " +int(7) +bool(false) +-- File opened in mode : x+b -- +bool(true) +int(0) +bool(false) +string(1) "f" +int(1) +bool(false) +string(1) "g" +int(2) +bool(false) +string(1) "e" +int(3) +bool(false) +string(1) "t" +int(4) +bool(false) +string(1) "c" +int(5) +bool(false) +string(1) " +" +int(6) +bool(false) +string(1) " " +int(7) +bool(false) +-- File opened in mode : x+t -- +bool(true) +int(0) +bool(false) +string(1) "f" +int(1) +bool(false) +string(1) "g" +int(2) +bool(false) +string(1) "e" +int(3) +bool(false) +string(1) "t" +int(4) +bool(false) +string(1) "c" +int(5) +bool(false) +string(1) " +" +int(6) +bool(false) +string(1) " " +int(7) +bool(false) +-- File opened in mode : w+ -- +bool(true) +int(0) +bool(false) +string(1) "f" +int(1) +bool(false) +string(1) "g" +int(2) +bool(false) +string(1) "e" +int(3) +bool(false) +string(1) "t" +int(4) +bool(false) +string(1) "c" +int(5) +bool(false) +string(1) " +" +int(6) +bool(false) +string(1) " " +int(7) +bool(false) +-- File opened in mode : w+b -- +bool(true) +int(0) +bool(false) +string(1) "f" +int(1) +bool(false) +string(1) "g" +int(2) +bool(false) +string(1) "e" +int(3) +bool(false) +string(1) "t" +int(4) +bool(false) +string(1) "c" +int(5) +bool(false) +string(1) " +" +int(6) +bool(false) +string(1) " " +int(7) +bool(false) +-- File opened in mode : w+t -- +bool(true) +int(0) +bool(false) +string(1) "f" +int(1) +bool(false) +string(1) "g" +int(2) +bool(false) +string(1) "e" +int(3) +bool(false) +string(1) "t" +int(4) +bool(false) +string(1) "c" +int(5) +bool(false) +string(1) " +" +int(6) +bool(false) +string(1) " " +int(7) +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/file/fgets_basic.phpt b/ext/standard/tests/file/fgets_basic.phpt new file mode 100644 index 00000000000..9865f1fc9ac --- /dev/null +++ b/ext/standard/tests/file/fgets_basic.phpt @@ -0,0 +1,318 @@ +--TEST-- +Test fgets() function : basic functionality +--FILE-- + +--EXPECTF-- +*** Testing fgets() : basic functionality *** + +-- Testing fgets() with file opened using mode r -- +-- File content type : numeric -- +-- fgets() with default length, file pointer at 0 -- +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(22) "2222222222222222222222" +int(22) +bool(false) +-- File content type : text -- +-- fgets() with default length, file pointer at 0 -- +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(22) "text text text text te" +int(22) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with default length, file pointer at 0 -- +string(5) "line +" +int(5) +bool(false) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with default length, file pointer at 0 -- +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(22) "ab12 ab12 ab12 ab12 ab" +int(22) +bool(false) + +-- Testing fgets() with file opened using mode rb -- +-- File content type : numeric -- +-- fgets() with default length, file pointer at 0 -- +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(22) "2222222222222222222222" +int(22) +bool(false) +-- File content type : text -- +-- fgets() with default length, file pointer at 0 -- +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(22) "text text text text te" +int(22) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with default length, file pointer at 0 -- +string(5) "line +" +int(5) +bool(false) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with default length, file pointer at 0 -- +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(22) "ab12 ab12 ab12 ab12 ab" +int(22) +bool(false) + +-- Testing fgets() with file opened using mode rt -- +-- File content type : numeric -- +-- fgets() with default length, file pointer at 0 -- +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(22) "2222222222222222222222" +int(22) +bool(false) +-- File content type : text -- +-- fgets() with default length, file pointer at 0 -- +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(22) "text text text text te" +int(22) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with default length, file pointer at 0 -- +string(5) "line +" +int(5) +bool(false) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with default length, file pointer at 0 -- +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(22) "ab12 ab12 ab12 ab12 ab" +int(22) +bool(false) + +-- Testing fgets() with file opened using mode r+ -- +-- File content type : numeric -- +-- fgets() with default length, file pointer at 0 -- +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(22) "2222222222222222222222" +int(22) +bool(false) +-- File content type : text -- +-- fgets() with default length, file pointer at 0 -- +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(22) "text text text text te" +int(22) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with default length, file pointer at 0 -- +string(5) "line +" +int(5) +bool(false) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with default length, file pointer at 0 -- +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(22) "ab12 ab12 ab12 ab12 ab" +int(22) +bool(false) + +-- Testing fgets() with file opened using mode r+b -- +-- File content type : numeric -- +-- fgets() with default length, file pointer at 0 -- +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(22) "2222222222222222222222" +int(22) +bool(false) +-- File content type : text -- +-- fgets() with default length, file pointer at 0 -- +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(22) "text text text text te" +int(22) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with default length, file pointer at 0 -- +string(5) "line +" +int(5) +bool(false) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with default length, file pointer at 0 -- +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(22) "ab12 ab12 ab12 ab12 ab" +int(22) +bool(false) + +-- Testing fgets() with file opened using mode r+t -- +-- File content type : numeric -- +-- fgets() with default length, file pointer at 0 -- +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(22) "2222222222222222222222" +int(22) +bool(false) +-- File content type : text -- +-- fgets() with default length, file pointer at 0 -- +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(22) "text text text text te" +int(22) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with default length, file pointer at 0 -- +string(5) "line +" +int(5) +bool(false) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with default length, file pointer at 0 -- +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +bool(true) +string(22) "ab12 ab12 ab12 ab12 ab" +int(22) +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/file/fgets_error.phpt b/ext/standard/tests/file/fgets_error.phpt new file mode 100644 index 00000000000..347a10d955e --- /dev/null +++ b/ext/standard/tests/file/fgets_error.phpt @@ -0,0 +1,107 @@ +--TEST-- +Test fgets() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing error conditions *** +-- Testing fgets() with zero argument -- + +Warning: Wrong parameter count for fgets() in %s on line %d +NULL +-- Testing fgets() with more than expected number of arguments -- + +Warning: Wrong parameter count for fgets() in %s on line %d +NULL +-- Testing fgets() with invalid length arguments -- + +Warning: fgets(): Length parameter must be greater than 0 in %s on line %d +bool(false) + +Warning: fgets(): Length parameter must be greater than 0 in %s on line %d +bool(false) +bool(false) +-- Testing fgets() with invalid arguments -- +-- Iteration 1 -- + +Warning: fgets(): supplied argument is not a valid stream resource in %s on line %d +bool(false) +-- Iteration 2 -- + +Warning: fgets(): supplied argument is not a valid stream resource in %s on line %d +bool(false) +-- Iteration 3 -- + +Warning: fgets(): supplied argument is not a valid stream resource in %s on line %d +bool(false) +-- Iteration 4 -- + +Warning: fgets(): supplied argument is not a valid stream resource in %s on line %d +bool(false) +-- Iteration 5 -- + +Warning: fgets(): supplied argument is not a valid stream resource in %s on line %s +bool(false) +-- Iteration 6 -- + +Warning: fgets(): supplied argument is not a valid stream resource in %s on line %d +bool(false) +-- Testing fgets() with closed/unset file handle -- +Warning: fgets(): 5 is not a valid stream resource in %s on line %d +bool(false) + +Warning: fgets(): supplied argument is not a valid stream resource in %s on line %d +bool(false) +Done diff --git a/ext/standard/tests/file/fgets_variation1.phpt b/ext/standard/tests/file/fgets_variation1.phpt new file mode 100644 index 00000000000..fdc7e263828 --- /dev/null +++ b/ext/standard/tests/file/fgets_variation1.phpt @@ -0,0 +1,116 @@ +--TEST-- +Test fgets() function : usage variations - write only modes(fails, see bug#42036) +--FILE-- + +--EXPECTF-- +*** Testing fgets() with file opened in write only mode *** +-- File opened in mode : w -- +bool(true) +int(0) +bool(false) +bool(false) +int(0) +bool(false) +-- File opened in mode : wb -- +bool(true) +int(0) +bool(false) +bool(false) +int(0) +bool(false) +-- File opened in mode : wt -- +bool(true) +int(0) +bool(false) +bool(false) +int(0) +bool(false) +-- File opened in mode : a -- +bool(true) +int(0) +bool(false) +bool(false) +int(0) +bool(false) +-- File opened in mode : ab -- +bool(true) +int(0) +bool(false) +bool(false) +int(0) +bool(true) +-- File opened in mode : at -- +bool(true) +int(0) +bool(false) +bool(false) +int(0) +bool(false) +-- File opened in mode : x -- +bool(true) +int(0) +bool(false) +bool(false) +int(0) +bool(false) +-- File opened in mode : xb -- +bool(true) +int(0) +bool(false) +bool(false) +int(0) +bool(false) +-- File opened in mode : xt -- +bool(true) +int(0) +bool(false) +bool(false) +int(0) +bool(false) +Done diff --git a/ext/standard/tests/file/fgets_variation2.phpt b/ext/standard/tests/file/fgets_variation2.phpt new file mode 100644 index 00000000000..b37a9f099d3 --- /dev/null +++ b/ext/standard/tests/file/fgets_variation2.phpt @@ -0,0 +1,62 @@ +--TEST-- +Test fgets() function : usage variations - closed handle +--FILE-- + +--EXPECTF-- +*** Testing fgets() : usage variations *** +-- Testing fgets() with closed handle -- + +Warning: fgets(): 6 is not a valid stream resource in %s on line %d +bool(false) + +Warning: fgets(): 6 is not a valid stream resource in %s on line %d +bool(false) +-- Testing fgets() with unset handle -- + +Notice: Undefined variable: file_handle in %s on line %d + +Warning: fgets(): supplied argument is not a valid stream resource in %s on line %d +bool(false) + +Notice: Undefined variable: file_handle in %s on line %d + +Warning: fgets(): supplied argument is not a valid stream resource in %s on line %d +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/file/fgets_variation3.phpt b/ext/standard/tests/file/fgets_variation3.phpt new file mode 100644 index 00000000000..4f0364132a2 --- /dev/null +++ b/ext/standard/tests/file/fgets_variation3.phpt @@ -0,0 +1,500 @@ +--TEST-- +Test fgets() function : usage variations - read with/without length +--FILE-- + +--EXPECTF-- +*** Testing fgets() : usage variations *** + +-- Testing fgets() with file opened using mode w+ -- +-- File content type : numeric -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "2222222222222222222222" +int(22) +bool(false) +-- File content type : text -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "text text text text te" +int(22) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "ab12 ab12 ab12 ab12 ab" +int(22) +bool(false) + +-- Testing fgets() with file opened using mode w+b -- +-- File content type : numeric -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "2222222222222222222222" +int(22) +bool(false) +-- File content type : text -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "text text text text te" +int(22) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "ab12 ab12 ab12 ab12 ab" +int(22) +bool(false) + +-- Testing fgets() with file opened using mode w+t -- +-- File content type : numeric -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "2222222222222222222222" +int(22) +bool(false) +-- File content type : text -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "text text text text te" +int(22) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "ab12 ab12 ab12 ab12 ab" +int(22) +bool(false) + +-- Testing fgets() with file opened using mode a+ -- +-- File content type : numeric -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "2222222222222222222222" +int(22) +bool(false) +-- File content type : text -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "text text text text te" +int(22) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "ab12 ab12 ab12 ab12 ab" +int(22) +bool(false) + +-- Testing fgets() with file opened using mode a+b -- +-- File content type : numeric -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "2222222222222222222222" +int(22) +bool(false) +-- File content type : text -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "text text text text te" +int(22) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "ab12 ab12 ab12 ab12 ab" +int(22) +bool(false) + +-- Testing fgets() with file opened using mode a+t -- +-- File content type : numeric -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "2222222222222222222222" +int(22) +bool(false) +-- File content type : text -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "text text text text te" +int(22) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "ab12 ab12 ab12 ab12 ab" +int(22) +bool(false) + +-- Testing fgets() with file opened using mode x+ -- +-- File content type : numeric -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "2222222222222222222222" +int(22) +bool(false) +-- File content type : text -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "text text text text te" +int(22) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "ab12 ab12 ab12 ab12 ab" +int(22) +bool(false) + +-- Testing fgets() with file opened using mode x+b -- +-- File content type : numeric -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "2222222222222222222222" +int(22) +bool(false) +-- File content type : text -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "text text text text te" +int(22) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "ab12 ab12 ab12 ab12 ab" +int(22) +bool(false) + +-- Testing fgets() with file opened using mode x+t -- +-- File content type : numeric -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "2222222222222222222222" +int(22) +bool(false) +-- File content type : text -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "text text text text te" +int(22) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with default length, file pointer at 0 -- +int(0) +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 -- +int(0) +string(22) "ab12 ab12 ab12 ab12 ab" +int(22) +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/file/fgets_variation4-win32.phpt b/ext/standard/tests/file/fgets_variation4-win32.phpt new file mode 100644 index 00000000000..6d2bbf6caf8 --- /dev/null +++ b/ext/standard/tests/file/fgets_variation4-win32.phpt @@ -0,0 +1,574 @@ +--TEST-- +Test fgets() function : usage variations - seek n read +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing fgets() : usage variations *** + +-- Testing fgets() with file opened using mode w+ -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(13) "line of text +" +int(18) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(11) "ne of text +" +int(36) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) + +-- Testing fgets() with file opened using mode w+b -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(13) "line of text +" +int(18) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(11) "ne of text +" +int(36) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) + +-- Testing fgets() with file opened using mode w+t -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(1) " +" +int(6) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(12) "ine of text +" +int(37) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) + +-- Testing fgets() with file opened using mode a+ -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(13) "line of text +" +int(18) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(11) "ne of text +" +int(36) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) + +-- Testing fgets() with file opened using mode a+b -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(13) "line of text +" +int(18) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(11) "ne of text +" +int(36) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) + +-- Testing fgets() with file opened using mode a+t -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(1) " +" +int(6) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(12) "ine of text +" +int(37) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) + +-- Testing fgets() with file opened using mode x+ -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(13) "line of text +" +int(18) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(11) "ne of text +" +int(36) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) + +-- Testing fgets() with file opened using mode x+b -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(13) "line of text +" +int(18) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(11) "ne of text +" +int(36) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) + +-- Testing fgets() with file opened using mode x+t -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(1) " +" +int(6) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(12) "ine of text +" +int(37) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) +Done diff --git a/ext/standard/tests/file/fgets_variation4.phpt b/ext/standard/tests/file/fgets_variation4.phpt new file mode 100644 index 00000000000..4ffa3f19750 --- /dev/null +++ b/ext/standard/tests/file/fgets_variation4.phpt @@ -0,0 +1,574 @@ +--TEST-- +Test fgets() function : usage variations - seek n read +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing fgets() : usage variations *** + +-- Testing fgets() with file opened using mode w+ -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(13) "line of text +" +int(18) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(11) "ne of text +" +int(36) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) + +-- Testing fgets() with file opened using mode w+b -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(13) "line of text +" +int(18) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(11) "ne of text +" +int(36) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) + +-- Testing fgets() with file opened using mode w+t -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(13) "line of text +" +int(18) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(11) "ne of text +" +int(36) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) + +-- Testing fgets() with file opened using mode a+ -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(13) "line of text +" +int(18) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(11) "ne of text +" +int(36) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) + +-- Testing fgets() with file opened using mode a+b -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(13) "line of text +" +int(18) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(11) "ne of text +" +int(36) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) + +-- Testing fgets() with file opened using mode a+t -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(13) "line of text +" +int(18) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(11) "ne of text +" +int(36) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) + +-- Testing fgets() with file opened using mode x+ -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(13) "line of text +" +int(18) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(11) "ne of text +" +int(36) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) + +-- Testing fgets() with file opened using mode x+b -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(13) "line of text +" +int(18) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(11) "ne of text +" +int(36) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) + +-- Testing fgets() with file opened using mode x+t -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(13) "line of text +" +int(18) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(11) "ne of text +" +int(36) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/file/fgets_variation5.phpt b/ext/standard/tests/file/fgets_variation5.phpt new file mode 100644 index 00000000000..4a1ed9f0391 --- /dev/null +++ b/ext/standard/tests/file/fgets_variation5.phpt @@ -0,0 +1,302 @@ +--TEST-- +Test fgets() function : usage variations - read beyond filesize +--FILE-- + filesize --\n"; + rewind($file_handle); + + var_dump( ftell($file_handle) ); + var_dump( fgets($file_handle, 50 + 23) ); // expected: 50 + var_dump( ftell($file_handle) ); // ensure the file pointer position + var_dump( feof($file_handle) ); // enusre if eof set + + //close file + fclose($file_handle); + + // delete file + delete_file($filename); + } // file_content_type loop +} // file_mode loop + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing fgets() : usage variations *** + +-- Testing fgets() with file opened using mode w+ -- +-- File content type : numeric -- +-- fgets() with length > filesize -- +int(0) +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- File content type : text -- +-- fgets() with length > filesize -- +int(0) +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with length > filesize -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with length > filesize -- +int(0) +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) + +-- Testing fgets() with file opened using mode w+b -- +-- File content type : numeric -- +-- fgets() with length > filesize -- +int(0) +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- File content type : text -- +-- fgets() with length > filesize -- +int(0) +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with length > filesize -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with length > filesize -- +int(0) +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) + +-- Testing fgets() with file opened using mode w+t -- +-- File content type : numeric -- +-- fgets() with length > filesize -- +int(0) +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- File content type : text -- +-- fgets() with length > filesize -- +int(0) +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with length > filesize -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with length > filesize -- +int(0) +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) + +-- Testing fgets() with file opened using mode a+ -- +-- File content type : numeric -- +-- fgets() with length > filesize -- +int(0) +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- File content type : text -- +-- fgets() with length > filesize -- +int(0) +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with length > filesize -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with length > filesize -- +int(0) +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) + +-- Testing fgets() with file opened using mode a+b -- +-- File content type : numeric -- +-- fgets() with length > filesize -- +int(0) +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- File content type : text -- +-- fgets() with length > filesize -- +int(0) +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with length > filesize -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with length > filesize -- +int(0) +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) + +-- Testing fgets() with file opened using mode a+t -- +-- File content type : numeric -- +-- fgets() with length > filesize -- +int(0) +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- File content type : text -- +-- fgets() with length > filesize -- +int(0) +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with length > filesize -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with length > filesize -- +int(0) +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) + +-- Testing fgets() with file opened using mode x+ -- +-- File content type : numeric -- +-- fgets() with length > filesize -- +int(0) +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- File content type : text -- +-- fgets() with length > filesize -- +int(0) +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with length > filesize -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with length > filesize -- +int(0) +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) + +-- Testing fgets() with file opened using mode x+b -- +-- File content type : numeric -- +-- fgets() with length > filesize -- +int(0) +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- File content type : text -- +-- fgets() with length > filesize -- +int(0) +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with length > filesize -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with length > filesize -- +int(0) +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) + +-- Testing fgets() with file opened using mode x+t -- +-- File content type : numeric -- +-- fgets() with length > filesize -- +int(0) +string(50) "22222222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- File content type : text -- +-- fgets() with length > filesize -- +int(0) +string(50) "text text text text text text text text text text " +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with length > filesize -- +int(0) +string(5) "line +" +int(5) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with length > filesize -- +int(0) +string(50) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +Done \ No newline at end of file diff --git a/ext/standard/tests/file/fgets_variation6-win32.phpt b/ext/standard/tests/file/fgets_variation6-win32.phpt new file mode 100644 index 00000000000..14cb46f1859 --- /dev/null +++ b/ext/standard/tests/file/fgets_variation6-win32.phpt @@ -0,0 +1,372 @@ +--TEST-- +Test fgets() function : usage variations - read when file pointer at EOF +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing fgets() : usage variations *** + +-- Testing fgets() with file opened using mode w+ -- +-- File content type : numeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : alphanumeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) + +-- Testing fgets() with file opened using mode w+b -- +-- File content type : numeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : alphanumeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) + +-- Testing fgets() with file opened using mode w+t -- +-- File content type : numeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(55) +bool(false) +bool(false) +int(55) +bool(true) +-- File content type : alphanumeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) + +-- Testing fgets() with file opened using mode a+ -- +-- File content type : numeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : alphanumeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) + +-- Testing fgets() with file opened using mode a+b -- +-- File content type : numeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : alphanumeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) + +-- Testing fgets() with file opened using mode a+t -- +-- File content type : numeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(55) +bool(false) +bool(false) +int(55) +bool(true) +-- File content type : alphanumeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) + +-- Testing fgets() with file opened using mode x+ -- +-- File content type : numeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : alphanumeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) + +-- Testing fgets() with file opened using mode x+b -- +-- File content type : numeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : alphanumeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) + +-- Testing fgets() with file opened using mode x+t -- +-- File content type : numeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(55) +bool(false) +bool(false) +int(55) +bool(true) +-- File content type : alphanumeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +Done diff --git a/ext/standard/tests/file/fgets_variation6.phpt b/ext/standard/tests/file/fgets_variation6.phpt new file mode 100644 index 00000000000..da6c2149b91 --- /dev/null +++ b/ext/standard/tests/file/fgets_variation6.phpt @@ -0,0 +1,372 @@ +--TEST-- +Test fgets() function : usage variations - read when file pointer at EOF +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing fgets() : usage variations *** + +-- Testing fgets() with file opened using mode w+ -- +-- File content type : numeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : alphanumeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) + +-- Testing fgets() with file opened using mode w+b -- +-- File content type : numeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : alphanumeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) + +-- Testing fgets() with file opened using mode w+t -- +-- File content type : numeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : alphanumeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) + +-- Testing fgets() with file opened using mode a+ -- +-- File content type : numeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : alphanumeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) + +-- Testing fgets() with file opened using mode a+b -- +-- File content type : numeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : alphanumeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) + +-- Testing fgets() with file opened using mode a+t -- +-- File content type : numeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : alphanumeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) + +-- Testing fgets() with file opened using mode x+ -- +-- File content type : numeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : alphanumeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) + +-- Testing fgets() with file opened using mode x+b -- +-- File content type : numeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : alphanumeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) + +-- Testing fgets() with file opened using mode x+t -- +-- File content type : numeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : text_with_new_line -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +-- File content type : alphanumeric -- +-- fgets() with file pointer pointing at EOF -- +int(0) +int(50) +bool(false) +bool(false) +int(50) +bool(true) +Done \ No newline at end of file