Author: Raymond Bosman Date: 2006-12-05 14:37:27 +0100 (Tue, 05 Dec 2006) New Revision: 4189
Log: - Added some missing tests. Added: trunk/Template/tests/regression_tests/functions/correct/array_functions.send trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_array.in trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_array.out trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_date.in trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_date.out trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_debug.in trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_debug.out trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_math.in trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_math.out trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_regexp.in trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_regexp.out trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_string.in trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_string.out trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_type.in trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_type.out trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_web.in trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_web.out Modified: trunk/Template/src/functions/type_functions.php trunk/Template/tests/regression_tests/functions/correct/array_functions.in trunk/Template/tests/regression_tests/functions/correct/array_functions.out trunk/Template/tests/regression_tests/functions/correct/math_functions.in trunk/Template/tests/regression_tests/functions/correct/math_functions.out trunk/Template/tests/regression_tests/functions/correct/string_functions.in trunk/Template/tests/regression_tests/functions/correct/string_functions.out trunk/Template/tests/regression_tests/functions/correct/type_functions.in trunk/Template/tests/regression_tests/functions/correct/type_functions.out trunk/Template/tests/regression_tests/functions/correct/type_functions.send trunk/Template/tests/regression_tests/functions/correct/web_functions.in trunk/Template/tests/regression_tests/functions/correct/web_functions.out Modified: trunk/Template/src/functions/type_functions.php =================================================================== --- trunk/Template/src/functions/type_functions.php 2006-12-05 10:51:07 UTC (rev 4188) +++ trunk/Template/src/functions/type_functions.php 2006-12-05 13:37:27 UTC (rev 4189) @@ -58,12 +58,15 @@ // is_class( $v, $class ):: // getclass( $v ) == $class // TODO, needs to be tested. - case "is_class": return array( array( "%var", "%class" ), - array( "ezcTemplateEqualOperatorAstNode", array( - self::functionCall( "getclass", array( "%var" ) ), - self::value( "%class" ) - ) ) ); + case "is_class": return array( + ezcTemplateAstnode::TYPE_VALUE, + array( "%var", "%class" ), + array( "ezcTemplateIdenticalOperatorAstNode", array( + self::functionCall( "get_class", array( "%var" ) ), + "%class" ) + ) ); + // is_scalar( $v ):: // is_scalar( $v ) case "is_scalar": return array( array( "%var" ), Modified: trunk/Template/tests/regression_tests/functions/correct/array_functions.in =================================================================== --- trunk/Template/tests/regression_tests/functions/correct/array_functions.in 2006-12-05 10:51:07 UTC (rev 4188) +++ trunk/Template/tests/regression_tests/functions/correct/array_functions.in 2006-12-05 13:37:27 UTC (rev 4189) @@ -1,3 +1,4 @@ +{use $users} {var $a, $arr} array_count: { array_count(array('a', 'b', 'c') )} @@ -81,6 +82,10 @@ array_sum: {array_sum( array( 1,2,3) )} +array_extract_by_properties: +{$a = array_extract_by_properties( $users, array( "name" ) )} +{debug_dump($a)} + array_repeat: { $a = array_repeat( array('a', 'b'), 2 ) }{$a[0]}{$a[1]}{$a[2]}{$a[3]} @@ -97,10 +102,12 @@ {$a = hash_sort_reverse( array('x' => 'b', 'y' => 'a', 'z' => 'c') )} hash_sort_keys: -{$a = hash_sort_reverse( array('x' => 'b', 'y' => 'a', 'z' => 'c') )} +{$a = hash_sort_keys( array('x' => 'b', 'y' => 'a', 'z' => 'c') )} +{debug_dump($a)} hash_sort_keys_reverse: -{$a = hash_sort_reverse( array('x' => 'b', 'y' => 'a', 'z' => 'c') )} +{$a = hash_sort_keys_reverse( array('x' => 'b', 'y' => 'a', 'z' => 'c') )} +{debug_dump($a)} hash_diff: {$a = hash_diff( array( 'x' => 'b', 'y' => 'c' ), array( 'x' => 'c' ) )} @@ -121,3 +128,7 @@ hash_values: {$a = hash_values( array( 'x' => 'b', 'y' => 'c' ) )} + +hash_flip: +{$a = hash_flip( array ( 'x' => 'b', 'y' => 'c' ) )} +{debug_dump ($a)} Modified: trunk/Template/tests/regression_tests/functions/correct/array_functions.out =================================================================== --- trunk/Template/tests/regression_tests/functions/correct/array_functions.out 2006-12-05 10:51:07 UTC (rev 4188) +++ trunk/Template/tests/regression_tests/functions/correct/array_functions.out 2006-12-05 13:37:27 UTC (rev 4189) @@ -80,6 +80,13 @@ array_sum: 6 +array_extract_by_properties: +array ( + 0 => 'Bernard', + 1 => 'Manny', + 2 => 'Fran', +) + array_repeat: abab @@ -94,8 +101,18 @@ hash_sort_reverse: hash_sort_keys: +array ( + 'x' => 'b', + 'y' => 'a', + 'z' => 'c', +) hash_sort_keys_reverse: +array ( + 'z' => 'c', + 'y' => 'a', + 'x' => 'b', +) hash_diff: @@ -114,3 +131,9 @@ hash_keys: hash_values: + +hash_flip: +array ( + 'b' => 'x', + 'c' => 'y', +) Added: trunk/Template/tests/regression_tests/functions/correct/array_functions.send =================================================================== --- trunk/Template/tests/regression_tests/functions/correct/array_functions.send 2006-12-05 10:51:07 UTC (rev 4188) +++ trunk/Template/tests/regression_tests/functions/correct/array_functions.send 2006-12-05 13:37:27 UTC (rev 4189) @@ -0,0 +1,26 @@ +<?php +ezcTestRunner::addFileToFilter( __FILE__ ); + +$v = new ezcTemplateVariableCollection(); + + +$users = array(); + +$users[] = new User10101( "Bernard" ); +$users[] = new User10101( "Manny" ); +$users[] = new User10101( "Fran" ); + +$v->users = $users; + +return $v; + +class User10101 +{ + public $name; + + public function __construct( $name ) + { + $this->name = $name; + } +} +?> Property changes on: trunk/Template/tests/regression_tests/functions/correct/array_functions.send ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/Template/tests/regression_tests/functions/correct/math_functions.in =================================================================== --- trunk/Template/tests/regression_tests/functions/correct/math_functions.in 2006-12-05 10:51:07 UTC (rev 4188) +++ trunk/Template/tests/regression_tests/functions/correct/math_functions.in 2006-12-05 13:37:27 UTC (rev 4189) @@ -47,6 +47,7 @@ {!math_is_infinite( 3 )} math_is_nan: +{math_is_nan( 3 )} math_bin_to_dec: {math_bin_to_dec( "0101" )} Modified: trunk/Template/tests/regression_tests/functions/correct/math_functions.out =================================================================== --- trunk/Template/tests/regression_tests/functions/correct/math_functions.out 2006-12-05 10:51:07 UTC (rev 4188) +++ trunk/Template/tests/regression_tests/functions/correct/math_functions.out 2006-12-05 13:37:27 UTC (rev 4189) @@ -48,6 +48,7 @@ math_is_nan: + math_bin_to_dec: 5 Modified: trunk/Template/tests/regression_tests/functions/correct/string_functions.in =================================================================== --- trunk/Template/tests/regression_tests/functions/correct/string_functions.in 2006-12-05 10:51:07 UTC (rev 4188) +++ trunk/Template/tests/regression_tests/functions/correct/string_functions.in 2006-12-05 13:37:27 UTC (rev 4189) @@ -45,3 +45,6 @@ 36. {str_wrap("abcdefghijklmnop", 4, "\n", true)}{str_wrap("qrst asdf asdf", 5, "\n")} 37. {str_base64_encode( "I don't want to be encoded!" )} 38. {str_base64_decode( "SSBkb24ndCB3YW50IHRvIGJlIGVuY29kZWQh" )} +39. {str_ord( 65 )} +40. {str_char_count( "hello" )} +41. {str_index_of( "Hello", "l")} Modified: trunk/Template/tests/regression_tests/functions/correct/string_functions.out =================================================================== --- trunk/Template/tests/regression_tests/functions/correct/string_functions.out 2006-12-05 10:51:07 UTC (rev 4188) +++ trunk/Template/tests/regression_tests/functions/correct/string_functions.out 2006-12-05 13:37:27 UTC (rev 4189) @@ -44,3 +44,6 @@ asdf 37. SSBkb24ndCB3YW50IHRvIGJlIGVuY29kZWQh 38. I don't want to be encoded! +39. A +40. 5 +41. 2 Modified: trunk/Template/tests/regression_tests/functions/correct/type_functions.in =================================================================== --- trunk/Template/tests/regression_tests/functions/correct/type_functions.in 2006-12-05 10:51:07 UTC (rev 4188) +++ trunk/Template/tests/regression_tests/functions/correct/type_functions.in 2006-12-05 13:37:27 UTC (rev 4189) @@ -1,4 +1,4 @@ -{use $myTstStdObject} +{use $user, $myTstStdObject} is_empty: {is_empty( "" )} @@ -20,6 +20,10 @@ is_object: {!is_object( 2 )} +is_class: +{is_class( $user, "RaysClass" )} +{is_class( $user, "RaysBeautifulClass" )} + is_scalar: {is_scalar( 2 )} Modified: trunk/Template/tests/regression_tests/functions/correct/type_functions.out =================================================================== --- trunk/Template/tests/regression_tests/functions/correct/type_functions.out 2006-12-05 10:51:07 UTC (rev 4188) +++ trunk/Template/tests/regression_tests/functions/correct/type_functions.out 2006-12-05 13:37:27 UTC (rev 4189) @@ -19,6 +19,10 @@ is_object: 1 +is_class: + +1 + is_scalar: 1 Modified: trunk/Template/tests/regression_tests/functions/correct/type_functions.send =================================================================== --- trunk/Template/tests/regression_tests/functions/correct/type_functions.send 2006-12-05 10:51:07 UTC (rev 4188) +++ trunk/Template/tests/regression_tests/functions/correct/type_functions.send 2006-12-05 13:37:27 UTC (rev 4189) @@ -1,6 +1,13 @@ <?php $v = new ezcTemplateVariableCollection(); $v->myTstStdObject = new StdClass(); +$v->user = new RaysBeautifulClass; return $v; + +class RaysBeautifulClass +{ + public $name = "Bernard"; +} + ?> Modified: trunk/Template/tests/regression_tests/functions/correct/web_functions.in =================================================================== --- trunk/Template/tests/regression_tests/functions/correct/web_functions.in 2006-12-05 10:51:07 UTC (rev 4188) +++ trunk/Template/tests/regression_tests/functions/correct/web_functions.in 2006-12-05 13:37:27 UTC (rev 4189) @@ -2,5 +2,5 @@ 4. {url_decode( "some+string+%2F+for+%26+an+%25+URL" )} 5. {url_parameters_build( array( "foo" => "bar", "baz" => "foo" ) )} 6. {url_parameters_build( array( "foo", "bar", "baz" ), "ez_" )} -7. {debug_dump(url_build(array ( "scheme" => "http", "host" => "ez.no", "user" => "user", "pass" => "pass", "path" => "/test/index.php", "query" => "index=1", "fragment" => "target" ) ) )} +7. {debug_dump(url_build(array ( "scheme" => "http", "host" => "ez.no", "user" => "user", "pass" => "pass", "path" => "/test/index.php", "query" => "index=1", "fragment" => "target", "port" => "port" ) ) )} 8. {var $a = url_parse( "http://user:[EMAIL PROTECTED]/test/index.php?index=1#target" )}{$a["scheme"]} {$a["host"]} {$a["user"]} {$a["pass"]} {$a["path"]} {$a["query"]} {$a["fragment"]} Modified: trunk/Template/tests/regression_tests/functions/correct/web_functions.out =================================================================== --- trunk/Template/tests/regression_tests/functions/correct/web_functions.out 2006-12-05 10:51:07 UTC (rev 4188) +++ trunk/Template/tests/regression_tests/functions/correct/web_functions.out 2006-12-05 13:37:27 UTC (rev 4189) @@ -2,5 +2,5 @@ 4. some string / for & an % URL 5. foo=bar&baz=foo 6. ez_0=foo&ez_1=bar&ez_2=baz -7. 'http://user:[EMAIL PROTECTED]/test/index.php?index=1#target' +7. 'http://user:[EMAIL PROTECTED]:port/test/index.php?index=1#target' 8. http ez.no user pass /test/index.php index=1 target Added: trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_array.in =================================================================== --- trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_array.in 2006-12-05 10:51:07 UTC (rev 4188) +++ trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_array.in 2006-12-05 13:37:27 UTC (rev 4189) @@ -0,0 +1 @@ +{array_hello(1,2)} Property changes on: trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_array.in ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_array.out =================================================================== --- trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_array.out 2006-12-05 10:51:07 UTC (rev 4188) +++ trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_array.out 2006-12-05 13:37:27 UTC (rev 4189) @@ -0,0 +1,4 @@ +mock:1:2: Unknown function call: 'array_hello' + +{array_hello(1,2)} + ^ Property changes on: trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_array.out ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_date.in =================================================================== --- trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_date.in 2006-12-05 10:51:07 UTC (rev 4188) +++ trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_date.in 2006-12-05 13:37:27 UTC (rev 4189) @@ -0,0 +1 @@ +{date_hello(1,3)} Property changes on: trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_date.in ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_date.out =================================================================== --- trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_date.out 2006-12-05 10:51:07 UTC (rev 4188) +++ trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_date.out 2006-12-05 13:37:27 UTC (rev 4189) @@ -0,0 +1,4 @@ +mock:1:2: Unknown function call: 'date_hello' + +{date_hello(1,3)} + ^ Property changes on: trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_date.out ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_debug.in =================================================================== --- trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_debug.in 2006-12-05 10:51:07 UTC (rev 4188) +++ trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_debug.in 2006-12-05 13:37:27 UTC (rev 4189) @@ -0,0 +1 @@ +{debug_bla()} Property changes on: trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_debug.in ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_debug.out =================================================================== --- trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_debug.out 2006-12-05 10:51:07 UTC (rev 4188) +++ trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_debug.out 2006-12-05 13:37:27 UTC (rev 4189) @@ -0,0 +1,4 @@ +mock:1:2: Unknown function call: 'debug_bla' + +{debug_bla()} + ^ Property changes on: trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_debug.out ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_math.in =================================================================== --- trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_math.in 2006-12-05 10:51:07 UTC (rev 4188) +++ trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_math.in 2006-12-05 13:37:27 UTC (rev 4189) @@ -0,0 +1 @@ +{math_bla()} Property changes on: trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_math.in ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_math.out =================================================================== --- trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_math.out 2006-12-05 10:51:07 UTC (rev 4188) +++ trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_math.out 2006-12-05 13:37:27 UTC (rev 4189) @@ -0,0 +1,4 @@ +mock:1:2: Unknown function call: 'math_bla' + +{math_bla()} + ^ Property changes on: trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_math.out ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_regexp.in =================================================================== --- trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_regexp.in 2006-12-05 10:51:07 UTC (rev 4188) +++ trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_regexp.in 2006-12-05 13:37:27 UTC (rev 4189) @@ -0,0 +1 @@ +{preg_bla()} Property changes on: trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_regexp.in ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_regexp.out =================================================================== --- trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_regexp.out 2006-12-05 10:51:07 UTC (rev 4188) +++ trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_regexp.out 2006-12-05 13:37:27 UTC (rev 4189) @@ -0,0 +1,4 @@ +mock:1:2: Unknown function call: 'preg_bla' + +{preg_bla()} + ^ Property changes on: trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_regexp.out ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_string.in =================================================================== --- trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_string.in 2006-12-05 10:51:07 UTC (rev 4188) +++ trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_string.in 2006-12-05 13:37:27 UTC (rev 4189) @@ -0,0 +1 @@ +{string_bla()} Property changes on: trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_string.in ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_string.out =================================================================== --- trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_string.out 2006-12-05 10:51:07 UTC (rev 4188) +++ trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_string.out 2006-12-05 13:37:27 UTC (rev 4189) @@ -0,0 +1,4 @@ +mock:1:2: Unknown function call: 'string_bla' + +{string_bla()} + ^ Property changes on: trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_string.out ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_type.in =================================================================== --- trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_type.in 2006-12-05 10:51:07 UTC (rev 4188) +++ trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_type.in 2006-12-05 13:37:27 UTC (rev 4189) @@ -0,0 +1 @@ +{is_blarp("bla")} Property changes on: trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_type.in ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_type.out =================================================================== --- trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_type.out 2006-12-05 10:51:07 UTC (rev 4188) +++ trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_type.out 2006-12-05 13:37:27 UTC (rev 4189) @@ -0,0 +1,4 @@ +mock:1:2: Unknown function call: 'is_blarp' + +{is_blarp("bla")} + ^ Property changes on: trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_type.out ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_web.in =================================================================== --- trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_web.in 2006-12-05 10:51:07 UTC (rev 4188) +++ trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_web.in 2006-12-05 13:37:27 UTC (rev 4189) @@ -0,0 +1 @@ +{url_bla("myurl")} Property changes on: trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_web.in ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_web.out =================================================================== --- trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_web.out 2006-12-05 10:51:07 UTC (rev 4188) +++ trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_web.out 2006-12-05 13:37:27 UTC (rev 4189) @@ -0,0 +1,4 @@ +mock:1:2: Unknown function call: 'url_bla' + +{url_bla("myurl")} + ^ Property changes on: trunk/Template/tests/regression_tests/functions/incorrect_call/non_existing_function_web.out ___________________________________________________________________ Name: svn:eol-style + native -- svn-components mailing list svn-components@lists.ez.no http://lists.ez.no/mailman/listinfo/svn-components