|
4083 - in trunk/Template/tests: . scripts [eZComponents: Trunk]: msg#00253web.ezcomponents.cvs
Author: Jan Borsodi Date: 2006-11-27 14:36:01 +0100 (Mon, 27 Nov 2006) New Revision: 4083 Log: - Added some scripts to help making test files (.in) for the regression tests. Added: trunk/Template/tests/scripts/ trunk/Template/tests/scripts/permutation.php trunk/Template/tests/scripts/permutation_array_append.php trunk/Template/tests/scripts/permutation_array_create.php trunk/Template/tests/scripts/permutation_array_create2.php trunk/Template/tests/scripts/permutation_array_create3.php trunk/Template/tests/scripts/permutation_block_wrong.php trunk/Template/tests/scripts/permutation_if_basic.php trunk/Template/tests/scripts/permutation_if_execute.php trunk/Template/tests/scripts/permutation_if_nested.php trunk/Template/tests/scripts/permutation_switch_nested.php Added: trunk/Template/tests/scripts/permutation.php =================================================================== --- trunk/Template/tests/scripts/permutation.php 2006-11-27 13:30:49 UTC (rev 4082) +++ trunk/Template/tests/scripts/permutation.php 2006-11-27 13:36:01 UTC (rev 4083) @@ -0,0 +1,301 @@ +<?php +/** + * File containing the Permutation classes. + * + * @package + * @version //autogen// + * @copyright Copyright (C) 2005, 2006 eZ systems as. All rights reserved. + * @license http://ez.no/licenses/new_bsd New BSD License + */ + +/** + * A system for generating permutations of possible combinations. + * + * @package + * @version //autogen// + */ + +abstract class ezcTemplatePermutation +{ + public function __construct() + { + $this->index = 0; + } + + abstract public function generate(); + + abstract public function increase(); + + public function reset() + { + $this->index = 0; + } + + static function generateString( $list ) + { + $str = ''; + for ( $i = 0; $i < count( $list ); ++$i ) + { + $p = $list[$i]; + if ( is_object( $p ) ) + { + $str .= $p->generate(); + } + else + { + $str .= $p; + } + } + return $str; + } + + static function increaseList( $list ) + { + for ( $i = count( $list ) - 1; $i >= 0; --$i ) + { + $p = $list[$i]; + if ( is_object( $p ) ) + { + if ( $p->increase() ) + return true; + $p->reset(); + } + } + return false; + } + + static function indentBlock( $text, $indentation ) + { + $lines = preg_split( "#(\r\n|\r|\n)#", $text, -1, PREG_SPLIT_DELIM_CAPTURE ); + for ( $i = 0; $i < count( $lines ); $i += 2 ) + { + if ( $i == count( $lines ) - 1 ) + continue; + $lines[$i] = $indentation . $lines[$i]; + } + return implode( "", $lines ); + } +} + +class ezcTemplatePermutationList extends ezcTemplatePermutation +{ + public function __construct( $list = null ) + { + parent::__construct(); + $this->list = $list; + } + + public function generate() + { + return self::generateString( $this->list ); + } + + public function increase() + { + return self::increaseList( $this->list ); + } +} + +class ezcTemplatePermutationAlternative extends ezcTemplatePermutation +{ + public function __construct( $list = null, $indentation = '' ) + { + parent::__construct(); + $this->list = $list; + $this->indentation = $indentation; + } + + public function __clone() + { + foreach ( $this->list as $i => $v ) + { + if ( is_object( $v ) ) + { + $this->list[$i] = clone $v; + } + } + } + + public function generate() + { + $p = $this->list[$this->index]; + if ( is_object( $p ) ) + { + return self::indentBlock( $p->generate(), $this->indentation ); + } + else + { + return $p; + } + } + + public function increase() + { + $p = $this->list[$this->index]; + if ( is_object( $p ) ) + { + if ( $p->increase() ) + return true; + $p->reset(); + } + $this->index++; + return $this->index < count( $this->list ); + } + + public function reset() + { + foreach ( $this->list as $p ) + { + if ( is_object( $p ) ) + { + $p->reset(); + } + } + $this->index = 0; + } +} + +/*class ezcTemplatePermutationOccurence extends ezcTemplatePermutation +{ + public function __construct( $list, $min, $max ) + { + parent::__construct(); + $this->list = $list; + $this->min = $min; + $this->max = $max; + } + + public function generate() + { + $times = $this->min + $this->index; + if ( $times === 0 ) + return ''; + + $str = self::generateString( $this->list ); + return str_repeat( $str, $times ); + } + + public function increase() + { + if ( self::increase( $this->list ) ) + return true; + $this->index++; + return $this->index <= ( $this->max - $this->min ); + } +}*/ + +class ezcTemplatePermutationNumber extends ezcTemplatePermutation +{ + public function __construct( $min = false, $max = false ) + { + parent::__construct(); + $this->min = $min; + $this->max = $max; + } + + public function generate() + { + return $this->min + $this->index; + } + + public function increase() + { + $this->index++; + return $this->index <= ( $this->max - $this->min ); + } +} + +class ezcTemplatePermutationApp +{ + public $outputToFile; + + public function __construct( $file, $args = false, $dir = false ) + { + $this->outputToFile = false; + if ( $dir === false ) + { + $dir = dirname( __FILE__ ) . "/../regression_tests"; + } + $this->fd = false; + $this->dir = $dir; + $this->file = $file; + + if ( is_array( $args ) ) + { + foreach( $args as $arg ) + { + if ( $arg == '--generate-file' ) + $this->outputToFile = true; + } + } + + if ( $this->outputToFile && !file_exists( $dir ) ) + { + mkdir( $dir, 0777, true ); + } + } + + public function store( $content, $file = false ) + { + if ( $file === false ) + $file = $this->dir . '/' . $this->file; + + if ( $this->outputToFile ) + { + echo "Writing to ", $file, "\n"; + file_put_contents( $file, $content ); + } + else + { + echo basename( $file ), "\n"; + echo $content, "\n"; + } + } + + public function output( $content ) + { + if ( $this->outputToFile ) + { + if ( $this->fd === false ) + { + $this->fd = fopen( $this->dir . '/' . $this->file, "w" ); + } + fwrite( $this->fd, $content ); + } + else + { + echo $content; + } + } +} + +function app( $file, $args, $dir = false ) +{ + return new ezcTemplatePermutationApp( $file, $args, $dir ); +} + +function perm() +{ + $args = func_get_args(); + return new ezcTemplatePermutationList( $args ); +} + +function alt() +{ + $args = func_get_args(); + return new ezcTemplatePermutationAlternative( $args ); +} + +function altI() +{ + $args = func_get_args(); + $indent = array_shift( $args ); + return new ezcTemplatePermutationAlternative( $args, $indent ); +} + +function num( $min = false, $max = false ) +{ + return new ezcTemplatePermutationNumber( $min, $max ); +} + +?> Property changes on: trunk/Template/tests/scripts/permutation.php ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/Template/tests/scripts/permutation_array_append.php =================================================================== --- trunk/Template/tests/scripts/permutation_array_append.php 2006-11-27 13:30:49 UTC (rev 4082) +++ trunk/Template/tests/scripts/permutation_array_append.php 2006-11-27 13:36:01 UTC (rev 4083) @@ -0,0 +1,32 @@ +<?php + +require_once dirname( __FILE__ ) . "/permutation.php"; + +// Writes to: regression_tests/array_append/append_with_comments.in + +$ws = alt( "", " \t", "\n" ); +$comment = alt( "/*c*/", "//c\n" ); +$wsComment = alt( clone $ws, clone $comment, clone $ws ); +$comments = alt( clone $ws, clone $comment/*, clone $wsComment*/ ) ; + +$list = perm( alt( '$a' ), + clone $comments, + alt( '[' ), + clone $comments, + alt( ']' ), + clone $comments, + alt( '=1' ) + ); + + +$a = app( "array_append/append_with_comments.in", $argv ); + +$a->output( "{var \$a = array( 0 )}\n" ); +do +{ + $str = $list->generate(); + $a->output( "{" . $str . "}\n" ); +} while( $list->increase() ); +$a->output( "{debug_dump( \$a )}\n" ); + +?> Property changes on: trunk/Template/tests/scripts/permutation_array_append.php ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/Template/tests/scripts/permutation_array_create.php =================================================================== --- trunk/Template/tests/scripts/permutation_array_create.php 2006-11-27 13:30:49 UTC (rev 4082) +++ trunk/Template/tests/scripts/permutation_array_create.php 2006-11-27 13:36:01 UTC (rev 4083) @@ -0,0 +1,29 @@ +<?php + +require_once dirname( __FILE__ ) . "/permutation.php"; + +// Writes to: regression_tests/literals/array_create_with_comments.in + +$ws = alt( "", " \t", "\n" ); +$comment = alt( "/*c*/", "//c\n" ); +$wsComment = alt( clone $ws, clone $comment, clone $ws ); +$comments = alt( clone $ws, clone $comment/*, clone $wsComment*/ ); + +$list = perm( 'debug_dump( array', + clone $comments, + '(', + clone $comments, + '0', + clone $comments, + ') )' + ); + +$a = app( "literals/array_create_with_comments.in", $argv ); + +do +{ + $str = $list->generate(); + $a->output( "{" . $str . "}\n" ); +} while( $list->increase() ); + +?> Property changes on: trunk/Template/tests/scripts/permutation_array_create.php ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/Template/tests/scripts/permutation_array_create2.php =================================================================== --- trunk/Template/tests/scripts/permutation_array_create2.php 2006-11-27 13:30:49 UTC (rev 4082) +++ trunk/Template/tests/scripts/permutation_array_create2.php 2006-11-27 13:36:01 UTC (rev 4083) @@ -0,0 +1,36 @@ +<?php + +require_once dirname( __FILE__ ) . "/permutation.php"; + +// Writes to: regression_tests/literals/array_create_with_comments2.in + +$ws = alt( "", " \t", "\n" ); +$comment = alt( "/*c*/", "//c\n" ); +$wsComment = alt( clone $ws, clone $comment, clone $ws ); +$comments = alt( clone $ws, clone $comment/*, clone $wsComment*/ ); + +$list = perm( 'debug_dump( array', + '(', + alt( perm( clone $comments, + alt( '0' ), + clone $comments ), + perm( clone $comments, + alt( '0' ), + clone $comments, + alt( ',' ), + clone $comments ) + ), +// new ezcTemplatePermutationNumber( 0 ), + ') )' + ); + + +$a = app( "literals/array_create_with_comments2.in", $argv ); + +do +{ + $str = $list->generate(); + $a->output( "{" . $str . "}\n" ); +} while( $list->increase() ); + +?> Property changes on: trunk/Template/tests/scripts/permutation_array_create2.php ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/Template/tests/scripts/permutation_array_create3.php =================================================================== --- trunk/Template/tests/scripts/permutation_array_create3.php 2006-11-27 13:30:49 UTC (rev 4082) +++ trunk/Template/tests/scripts/permutation_array_create3.php 2006-11-27 13:36:01 UTC (rev 4083) @@ -0,0 +1,33 @@ +<?php + +require_once dirname( __FILE__ ) . "/permutation.php"; + +// Writes to: regression_tests/literals/array_create_with_comments3.in + +$ws = alt( "", " \t", "\n" ); +$comment = alt( "/*c*/", "//c\n" ); +$wsComment = alt( clone $ws, clone $comment, clone $ws ); +$comments = alt( clone $ws, clone $comment/*, clone $wsComment*/ ); + +$list = perm( 'debug_dump( array', + '(', + alt( perm( clone $comments, + '0', + clone $comments, + ',', + clone $comments, + '1', + clone $comments ) ), +// new ezcTemplatePermutationNumber( 0 ), + ') )' + ); + +$a = app( "literals/array_create_with_comments3.in", $argv ); + +do +{ + $str = $list->generate(); + $a->output( "{" . $str . "}\n" ); +} while( $list->increase() ); + +?> Property changes on: trunk/Template/tests/scripts/permutation_array_create3.php ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/Template/tests/scripts/permutation_block_wrong.php =================================================================== --- trunk/Template/tests/scripts/permutation_block_wrong.php 2006-11-27 13:30:49 UTC (rev 4082) +++ trunk/Template/tests/scripts/permutation_block_wrong.php 2006-11-27 13:36:01 UTC (rev 4083) @@ -0,0 +1,65 @@ +<?php + +require_once dirname( __FILE__ ) . "/permutation.php"; + +// Writes to: regression_tests/blocks/incorrect/non_matching_block_*.in + +$blocksStart = alt( "", + "{foreach \$array as \$bar}", + "{while \$_false}", + "{delimiter}", + "{if \$foo}", + "{elseif \$foo}", + "{else}", + "{switch \$foo}", + "{case \$foo}", + "{default}" + ); +$blocksEnd = alt( "", + "{/foreach}", + "{/while}", + "{/delimiter}", + "{/if}", + "{/switch}", + "{/case}", + "{/default}" + ); + +$blocksStartEnd = perm( $blocksStart, + "\n {\$foo}\n", + $blocksEnd, + "\n" + ); + +$blocksNested = alt( perm( "{foreach \$array as \$bar}\n", + altI( ' ', clone $blocksStartEnd ), + "{/foreach}\n" + ) ); + +$list = perm( alt( clone $blocksStartEnd, + clone $blocksNested + ) + ); + +$dir = dirname( __FILE__ ) . "/regression_tests/blocks/incorrect/"; + +$a = app( "", $argv, $dir ); + +$i = 1; +$top = "{var \$foo = 1, \$_false = false, \$array = array( 1, 2 )}\n"; +if ( !$a->outputToFile ) +{ + echo $top; +} + +do +{ + $num = sprintf( "%04d", $i ); + $str = $list->generate(); + $file = $dir . "/non_matching_block_" . $num . ".in"; + $a->store( "{* file: " . "non_matching_block_" . $num . ".in" . " *}\n" . $top . $str . "\n", + $file ); + ++$i; +} while( $list->increase() ); + +?> Property changes on: trunk/Template/tests/scripts/permutation_block_wrong.php ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/Template/tests/scripts/permutation_if_basic.php =================================================================== --- trunk/Template/tests/scripts/permutation_if_basic.php 2006-11-27 13:30:49 UTC (rev 4082) +++ trunk/Template/tests/scripts/permutation_if_basic.php 2006-11-27 13:36:01 UTC (rev 4083) @@ -0,0 +1,31 @@ +<?php + +require_once dirname( __FILE__ ) . "/permutation.php"; + +// Writes to: regression_tests/if/correct/if_with_comments.in + +$ws = alt( "", " \t", "\n" ); +$comment = alt( "/*c*/", "//c\n" ); +$wsComment = alt( clone $ws, clone $comment, clone $ws ); +$comments = alt( clone $ws, clone $comment/*, clone $wsComment*/ ); + +$list = perm( '{', + clone $comments, + 'if', + clone $comments, + '$a', + clone $comments, + '}', + "\n {\$a}\n{/if}" + ); + +$a = app( "if/correct/if_with_comments.in", $argv ); + +$a->output( "{var \$a = \"foo\"}\n" ); +do +{ + $str = $list->generate(); + $a->output( $str . "\n" ); +} while( $list->increase() ); + +?> Property changes on: trunk/Template/tests/scripts/permutation_if_basic.php ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/Template/tests/scripts/permutation_if_execute.php =================================================================== --- trunk/Template/tests/scripts/permutation_if_execute.php 2006-11-27 13:30:49 UTC (rev 4082) +++ trunk/Template/tests/scripts/permutation_if_execute.php 2006-11-27 13:36:01 UTC (rev 4083) @@ -0,0 +1,121 @@ +<?php + +require_once dirname( __FILE__ ) . "/permutation.php"; + +// Writes to: regression_tests/if/correct/if_else_elseif_nested.in + +$ws = alt( "", " \t", "\n" ); +$comment = alt( "/*c*/", "//c\n" ); +$wsComment = alt( clone $ws, clone $comment, clone $ws ); +$comments = alt( clone $ws, clone $comment/*, clone $wsComment*/ ); + +$empty = alt( '' ); + +$if = perm( "if(%cnt%)\n{if \$_true}", + "\n ok(%cnt%)\n", + "{/if}/if(%cnt%)\n" + ); + +$if2 = perm( "if(%cnt%)\n{if \$_false}", + "\n fail(%cnt%)\n", + "{/if}ok(%cnt%)\n/if(%cnt%)\n" + ); + +$ifElse = perm( "if(%cnt%)\n{if \$_true}", + "\n ok(%cnt%)\n", + "{else}", + "\n fail(%cnt%)\n", + "{/if}/if(%cnt%)\n" + ); + +$ifElse2 = perm( "if(%cnt%)\n{if \$_false}", + "\n fail(%cnt%)\n", + "{else}", + "\n ok(%cnt%)\n", + "{/if}/if(%cnt%)\n" + ); + +$ifElseIf = perm( "if(%cnt%)\n{if \$_true}", + "\n ok(%cnt%)\n", + "{elseif \$_false}", + "\n fail(%cnt%)\n", + "{/if}/if(%cnt%)\n" + ); + +$ifElseIf2 = perm( "if(%cnt%)\n{if \$_false}", + "\n fail(%cnt%)\n", + "{elseif \$_true}", + "\n ok(%cnt%)\n", + "{/if}/if(%cnt%)\n" + ); + +$ifElseIf3 = perm( "if(%cnt%)\n{if \$_false}", + "\n fail(%cnt%)\n", + "{elseif \$_false}", + "\n fail(%cnt%)\n", + "{/if}ok(%cnt%)\n/if(%cnt%)\n" + ); + +$ifElseIfElse = perm( "if(%cnt%)\n{if \$_true}", + "\n ok(%cnt%)\n", + "{elseif \$_false}", + "\n fail(%cnt%)\n", + "{else}", + "\n fail(%cnt%)\n", + "{/if}/if(%cnt%)\n" + ); + +$ifElseIfElse2 = perm( "if(%cnt%)\n{if \$_false}", + "\n fail(%cnt%)\n", + "{elseif \$_true}", + "\n ok(%cnt%)\n", + "{else}", + "\n fail(%cnt%)\n", + "{/if}/if(%cnt%)\n" + ); + +$ifElseIfElse3 = perm( "if(%cnt%)\n{if \$_false}", + "\n fail(%cnt%)\n", + "{elseif \$_false}", + "\n fail(%cnt%)\n", + "{else}", + "\n ok(%cnt%)\n", + "{/if}/if(%cnt%)\n" + ); + +$ifNested = perm( "if(%cnt%)\n{if \$_true}\n", + altI( ' ', /*clone $empty, */clone $if, clone $ifElse, clone $ifElseIf, clone $ifElseIfElse, clone $ifElseIfElse2 ), + "{/if}/if(%cnt%)\n" + ); + +$ifNested2 = perm( "{if \$_true}\n", + alt( '===>', clone $if, clone $ifElse, clone $ifElseIf, clone $ifElseIfElse, clone $ifElseIfElse2, clone $ifNested ), + "{/if}" + ); + +$list = perm( alt( clone $if, + clone $if2, + clone $ifElse, + clone $ifElse2, + clone $ifElseIf, + clone $ifElseIf2, + clone $ifElseIf3, + clone $ifElseIfElse, + clone $ifElseIfElse2, + clone $ifElseIfElse3, + clone $ifNested + ) + ); + +$a = app( "if/correct/if_else_elseif_nested.in", $argv ); + +$a->output( "{var \$_false = false,\n \$_true = true}\n" ); +$i = 0; +do +{ + $str = $list->generate(); + $a->output( str_replace( "%cnt%", $i, $str ) . "\n" ); + ++$i; +} while( $list->increase() ); + +?> Property changes on: trunk/Template/tests/scripts/permutation_if_execute.php ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/Template/tests/scripts/permutation_if_nested.php =================================================================== --- trunk/Template/tests/scripts/permutation_if_nested.php 2006-11-27 13:30:49 UTC (rev 4082) +++ trunk/Template/tests/scripts/permutation_if_nested.php 2006-11-27 13:36:01 UTC (rev 4083) @@ -0,0 +1,80 @@ +<?php + +require_once dirname( __FILE__ ) . "/permutation.php"; + +// Writes to: regression_tests/if/correct/if_nested.in + +$ws = alt( "", " \t", "\n" ); +$comment = alt( "/*c*/", "//c\n" ); +$wsComment = alt( clone $ws, clone $comment, clone $ws ); +$comments = alt( clone $ws, clone $comment/*, clone $wsComment*/ ); + +$empty = alt( '' ); + +$if = perm( "{if \$_foo}", + "\n {\$_foo}\n", + "{/if}\n" + ); + +$ifElse = perm( "{if \$_false}", + "\n {\$_foo}\n", + "{else}", + "\n {\$_bar}\n", + "{/if}\n" + ); + +$ifElseIf = perm( "{if \$_false}", + "\n {\$_foo}\n", + "{elseif \$_true}", + "\n {\$_bar}\n", + "{/if}\n" + ); + +$ifElseIfElse = perm( "{if \$_false}", + "\n {\$_foo}\n", + "{elseif \$_true}", + "\n {\$_bar}\n", + "{else}", + "\n {\$_false}\n", + "{/if}\n" + ); + +$ifElseIfElse2 = perm( "{if \$_false}", + "\n {\$_foo}\n", + "{elseif \$_true}", + "\n {\$_bar}\n", + "{elseif \$_false}", + "\n {\$_bar}\n", + "{else}", + "\n {\$_false}\n", + "{/if}\n" + ); + +$ifNested = perm( "{if \$_foo}\n", + altI( '--->', clone $empty, clone $if, clone $ifElse, clone $ifElseIf, clone $ifElseIfElse, clone $ifElseIfElse2 ), + "{/if}\n" + ); + +$ifNested2 = perm( "{if \$_foo}\n", + altI( '===>', clone $if, clone $ifElse, clone $ifElseIf, clone $ifElseIfElse, clone $ifElseIfElse2, clone $ifNested ), + "{/if}" + ); + +$list = perm( clone $if, + clone $ifElse, + clone $ifElseIf, + clone $ifElseIfElse, + clone $ifElseIfElse2, + clone $ifNested2 + ); + +$a = app( "if/correct/if_nested.in", $argv ); + +$a->output( "{var \$_foo = \"foo\",\n \$_bar = \"bar\",\n \$_false = false,\n \$_true = true}\n" ); +do +{ + $str = $list->generate(); + $a->output( $str . "\n" ); +} while( $list->increase() ); + +?> Property changes on: trunk/Template/tests/scripts/permutation_if_nested.php ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/Template/tests/scripts/permutation_switch_nested.php =================================================================== --- trunk/Template/tests/scripts/permutation_switch_nested.php 2006-11-27 13:30:49 UTC (rev 4082) +++ trunk/Template/tests/scripts/permutation_switch_nested.php 2006-11-27 13:36:01 UTC (rev 4083) @@ -0,0 +1,77 @@ +<?php + +require_once dirname( __FILE__ ) . "/permutation.php"; + +// Writes to: regression_tests/switch/correct/switch_nested.in + +$ws = alt( "", " \t", "\n" ); +$comment = alt( "/*c*/", "//c\n" ); +$wsComment = alt( clone $ws, clone $comment, clone $ws ); +$comments = alt( clone $ws, clone $comment/*, clone $wsComment*/ ); + +$empty = alt( '' ); + +function makeCase( $nums ) +{ + if ( !is_array( $nums ) ) + $nums = array( $nums ); + $list = array(); + return alt( "{case " . implode( ",", $nums ) . "}\n {\"{case " . var_export( implode( ",", $nums ), true ) . "}\"}\n{/case}\n" ); +} + +$switch = perm( "{switch \$_num_1}\n", + "{/switch}\n" + ); + +$switch1 = perm( "{switch \$_num_1}\n", + alt( makeCase( '1' ), makeCase( array( '1', '2' ) ) ), + "{/switch}\n" + ); + +$switch2 = perm( "{switch \$_num_2}\n", + alt( makeCase( '1' ), makeCase( array( '1', '3' ) ) ), + alt( makeCase( '2' ), makeCase( array( '2', '3' ) ) ), + "{/switch}\n" + ); + + +$switchDef = perm( "{switch \$_num_4}\n", + alt( makeCase( '1' ), makeCase( array( '1', '3' ) ) ), + alt( makeCase( '2' ), makeCase( array( '2', '3' ) ) ), + "{default}\n {\"{default}\"}\n{/default}\n", + "{/switch}\n" + ); + +$switchDef2 = perm( "{switch \$_num_3}\n", + "{default}\n {\"{default}\"}\n{/default}\n", + "{/switch}\n" + ); + + + +$switchNested = perm( "{switch \$_num_1}\n", + "{case '1'}\n", + altI( ' ', clone $switch, clone $switch1, clone $switch2, clone $switchDef, clone $switchDef2 ), + "{/case}\n", + "{default}\n {\"{default}\"}\n{/default}\n", + "{/switch}\n" + ); + +$list = perm( alt( clone $switch, + clone $switch1, + clone $switch2, + clone $switchDef, + clone $switchDef2, + clone $switchNested + ) ); + +$a = app( "switch/correct/switch_nested.in", $argv ); + +$a->output( "{var \$_num_1 = 1, \$_num_2 = 2, \$_num_3 = 3, \$_num_4 = 4}\n" ); +do +{ + $str = $list->generate(); + $a->output( $str . "\n" ); +} while( $list->increase() ); + +?> Property changes on: trunk/Template/tests/scripts/permutation_switch_nested.php ___________________________________________________________________ Name: svn:eol-style + native |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | 4083 - in trunk/Template/tests: . scripts [eZComponents: Scripts]: 00253, Jan Borsodi |
|---|---|
| Next by Date: | 4081 - trunk/EventLog/tests/writers [eZComponents: Trunk]: 00253, Alexandru Stanoi |
| Previous by Thread: | 4083 - in trunk/Template/tests: . scripts [eZComponents: Scripts]i: 00253, Jan Borsodi |
| Next by Thread: | 4081 - trunk/EventLog/tests/writers [eZComponents: Trunk]: 00253, Alexandru Stanoi |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |