--TEST--
Test trim() function : error conditions 
--FILE--
<?php

/* Prototype  : string trim  ( string $str  [, string $charlist  ] )
 * Description: Strip whitespace (or other characters) from the begining and end of a string.
 * Source code: ext/standard/string.c
*/


echo "*** Testing trim() : error conditions ***\n";

echo 
"\n-- Testing trim() function with no arguments --\n";
var_dumptrim() );

echo 
"\n-- Testing trim() function with more than expected no. of arguments --\n";
$extra_arg 10;
var_dumptrim("Hello World",  "Heo"$extra_arg) );


$hello "  Hello World\n";
echo 
"\n-- Test trim function with various invalid charlists --\n";
var_dump(trim($hello"..a"));
var_dump(trim($hello"a.."));
var_dump(trim($hello"z..a"));
var_dump(trim($hello"a..b..c"));

?>
===DONE===
--EXPECTF--
*** Testing trim() : error conditions ***

-- Testing trim() function with no arguments --

Warning: trim() expects at least 1 parameter, 0 given in %s on line %d
NULL

-- Testing trim() function with more than expected no. of arguments --

Warning: trim() expects at most 2 parameters, 3 given in %s on line %d
NULL

-- Test trim function with various invalid charlists --

Warning: trim(): Invalid '..'-range, no character to the left of '..' in %s on line %d
string(14) "  Hello World
"

Warning: trim(): Invalid '..'-range, no character to the right of '..' in %s on line %d
string(14) "  Hello World
"

Warning: trim(): Invalid '..'-range, '..'-range needs to be incrementing in %s on line %d
string(14) "  Hello World
"

Warning: trim(): Invalid '..'-range in %s on line %d
string(14) "  Hello World
"
===DONE===0);
test("stream_set_blocking - 4", $fd2, true, "stream_set_blocking", array($fd2,1), STREAM_OPTION_BLOCKING, 1);

test("stream_set_write_buffer - 1", $fd, true, "stream_set_write_buffer", array($fd,0), STREAM_OPTION_WRITE_BUFFER, STREAM_BUFFER_NONE);
test("stream_set_write_buffer - 2", $fd, true, "stream_set_write_buffer", array($fd,4096), STREAM_OPTION_WRITE_BUFFER, STREAM_BUFFER_FULL);
test("stream_set_write_buffer - 3", $fd, false, "stream_set_write_buffer", array($fd,8192), STREAM_OPTION_WRITE_BUFFER, STREAM_BUFFER_FULL);

test("stream_set_timeout - 1", $fd, true, "stream_set_timeout", array($fd,10,11), STREAM_OPTION_READ_TIMEOUT, 10);
test("stream_set_timeout - 2", $fd, false, "stream_set_timeout", array($fd,11,12), STREAM_OPTION_READ_TIMEOUT, 11);

?>
--EXPECTF--
bool(true)
bool(true)

------ stream_set_blocking - 1: -------
value:
int(0)
ptrparam:
NULL
$option === 1 === 1:
bool(true)
$value === 0 === 0:
bool(true)
bool(true)

------ stream_set_blocking - 2: -------
value:
int(1)
ptrparam:
NULL
$option === 1 === 1:
bool(true)
$value === 1 === 1:
bool(true)
bool(false)

------ stream_set_blocking - 3: -------
value:
int(0)
ptrparam:
NULL
$option === 1 === 1:
bool(true)
$value === 0 === 0:
bool(true)
bool(true)

------ stream_set_blocking - 4: -------

Warning: stream_set_blocking(): test_wrapper_base::stream_set_option is not implemented! in %s
bool(false)

------ stream_set_write_buffer - 1: -------
value:
int(0)
ptrparam:
int(%d)
$option === 3 === 3:
bool(true)
$value === 0 === 0:
bool(true)
int(0)

------ stream_set_write_buffer - 2: -------
value:
int(2)
ptrparam:
int(4096)
$option === 3 === 3:
bool(true)
$value === 2 === 2:
bool(true)
int(0)

------ stream_set_write_buffer - 3: -------
value:
int(2)
ptrparam:
int(8192)
$option === 3 === 3:
bool(true)
$value === 2 === 2:
bool(true)
int(-1)

------ stream_set_timeout - 1: -------
value:
int(10)
ptrparam:
int(11)
$option === 4 === 4:
bool(true)
$value === 10 === 10:
bool(true)
bool(true)

------ stream_set_timeout - 2: -------
value:
int(11)
ptrparam:
int(12)
$option === 4 === 4:
bool(true)
$value === 11 === 11:
bool(true)
bool(false)