1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824
|
#============================================================= -*-perl-*-
#
# t/view.t
#
# Tests the 'View' plugin.
#
# Written by Andy Wardley <abw@kfs.org>
#
# Copyright (C) 2000 Andy Wardley. All Rights Reserved.
#
# This is free software; you can redistribute it and/or modify it
# under the same terms as Perl itself.
#
# $Id$
#
#========================================================================
use strict;
use lib qw( ./lib ../lib );
use Template::Test;
$^W = 1;
use Template::View;
#$Template::View::DEBUG = 1;
#$Template::Test::DEBUG = 0;
#$Template::Parser::DEBUG = 1;
#$Template::Directive::PRETTY = 1;
$Template::Test::PRESERVE = 1;
#------------------------------------------------------------------------
package Foo;
sub new {
my $class = shift;
bless { @_ }, $class;
}
sub present {
my $self = shift;
return '{ ' . join(', ', map { "$_ => $self->{ $_ }" }
sort keys %$self) . ' }';
}
sub reverse {
my $self = shift;
return '{ ' . join(', ', map { "$_ => $self->{ $_ }" }
reverse sort keys %$self) . ' }';
}
#------------------------------------------------------------------------
package Blessed::List;
sub as_list {
my $self = shift;
return @$self;
}
#------------------------------------------------------------------------
package main;
my $vars = {
foo => Foo->new( pi => 3.14, e => 2.718 ),
blessed_list => bless([ "Hello", "World" ], 'Blessed::List'),
};
my $template = Template->new() || die Template->error;
my $context = $template->context();
my $view = $context->view( );
ok( $view );
$view = $context->view( prefix => 'my' );
ok( $view );
match( $view->prefix(), 'my' );
my $config = {
VIEWS => [
bottom => { prefix => 'bottom/' },
middle => { prefix => 'middle/', base => 'bottom' },
],
};
test_expect(\*DATA, $config, $vars);
__DATA__
-- test --
-- name pre-defined bottom view --
[% BLOCK bottom/list; "BOTTOM LIST: "; item.join(', '); END;
list = [10, 20 30];
bottom.print(list)
%]
-- expect --
BOTTOM LIST: 10, 20, 30
-- test --
-- name pre-defined middle view --
[% BLOCK bottom/list; "BOTTOM LIST: "; item.join(', '); END;
BLOCK middle/hash; "MIDDLE HASH: "; item.values.nsort.join(', '); END;
list = [10, 20 30];
hash = { pi => 3.142, e => 2.718 };
middle.print(list); "\n";
middle.print(hash); "\n";
%]
-- expect --
BOTTOM LIST: 10, 20, 30
MIDDLE HASH: 2.718, 3.142
-- test --
[% USE v = View -%]
[[% v.prefix %]]
-- expect --
[]
-- test --
[% USE v = View( map => { default="any" } ) -%]
[[% v.map.default %]]
-- expect --
[any]
-- test --
[% USE view( prefix=> 'foo/', suffix => '.tt2') -%]
[[% view.prefix %]bar[% view.suffix %]]
[[% view.template_name('baz') %]]
-- expect --
[foo/bar.tt2]
[foo/baz.tt2]
-- test --
[% USE view( prefix=> 'foo/', suffix => '.tt2') -%]
[[% view.prefix %]bar[% view.suffix %]]
[[% view.template_name('baz') %]]
-- expect --
[foo/bar.tt2]
[foo/baz.tt2]
-- test --
[% USE view -%]
[% view.print('Hello World') %]
[% BLOCK text %]TEXT: [% item %][% END -%]
-- expect --
TEXT: Hello World
-- test --
[% USE view -%]
[% view.print( { foo => 'bar' } ) %]
[% BLOCK hash %]HASH: {
[% FOREACH key = item.keys.sort -%]
[% key %] => [% item.$key %]
[%- END %]
}
[% END -%]
-- expect --
HASH: {
foo => bar
}
-- test --
[% USE view -%]
[% view = view.clone( prefix => 'my_' ) -%]
[% view.view('hash', { bar => 'baz' }) %]
[% BLOCK my_hash %]HASH: {
[% FOREACH key = item.keys.sort -%]
[% key %] => [% item.$key %]
[%- END %]
}
[% END -%]
-- expect --
HASH: {
bar => baz
}
-- test --
[% USE view(prefix='my_') -%]
[% view.print( foo => 'wiz', bar => 'waz' ) %]
[% BLOCK my_hash %]KEYS: [% item.keys.sort.join(', ') %][% END %]
-- expect --
KEYS: bar, foo
-- test --
[% USE view -%]
[% view.print( view ) %]
[% BLOCK Template_View %]Printing a Template::View object[% END -%]
-- expect --
Printing a Template::View object
-- test --
[% USE view(prefix='my_') -%]
[% view.print( view ) %]
[% view.print( view, prefix='your_' ) %]
[% BLOCK my_Template_View %]Printing my Template::View object[% END -%]
[% BLOCK your_Template_View %]Printing your Template::View object[% END -%]
-- expect --
Printing my Template::View object
Printing your Template::View object
-- test --
[% USE view(prefix='my_', notfound='any' ) -%]
[% view.print( view ) %]
[% view.print( view, prefix='your_' ) %]
[% BLOCK my_any %]Printing any of my objects[% END -%]
[% BLOCK your_any %]Printing any of your objects[% END -%]
-- expect --
Printing any of my objects
Printing any of your objects
-- test --
[% USE view(prefix => 'my_', map => { default => 'catchall' } ) -%]
[% view.print( view ) %]
[% view.print( view, default="catchsome" ) %]
[% BLOCK my_catchall %]Catching all defaults[% END -%]
[% BLOCK my_catchsome %]Catching some defaults[% END -%]
-- expect --
Catching all defaults
Catching some defaults
-- test --
[% USE view(prefix => 'my_', map => { default => 'catchnone' } ) -%]
[% view.default %]
[% view.default = 'catchall' -%]
[% view.default %]
[% view.print( view ) %]
[% view.print( view, default="catchsome" ) %]
[% BLOCK my_catchall %]Catching all defaults[% END -%]
[% BLOCK my_catchsome %]Catching some defaults[% END -%]
-- expect --
catchnone
catchall
Catching all defaults
Catching some defaults
-- test --
[% USE view(prefix='my_', default='catchall' notfound='lost') -%]
[% view.print( view ) %]
[% BLOCK my_lost %]Something has been found[% END -%]
-- expect --
Something has been found
-- test --
[% USE view -%]
[% TRY ;
view.print( view ) ;
CATCH view ;
"[$error.type] $error.info" ;
END
%]
-- expect --
[view] file error - Template_View: not found
-- test --
[% USE view -%]
[% view.print( foo ) %]
-- expect --
{ e => 2.718, pi => 3.14 }
-- test --
[% USE view -%]
[% view.print( foo, method => 'reverse' ) %]
-- expect --
{ pi => 3.14, e => 2.718 }
-- test --
[% USE view(prefix='my_', include_naked=0, view_naked=1) -%]
[% BLOCK my_foo; "Foo: $item"; END -%]
[[% view.view_foo(20) %]]
[[% view.foo(30) %]]
-- expect --
[Foo: 20]
[Foo: 30]
-- test --
[% USE view(prefix='my_', include_naked=0, view_naked=0) -%]
[% BLOCK my_foo; "Foo: $item"; END -%]
[[% view.view_foo(20) %]]
[% TRY ;
view.foo(30) ;
CATCH ;
error.info ;
END
%]
-- expect --
[Foo: 20]
no such view member: foo
-- test --
[% USE view(map => { HASH => 'my_hash', ARRAY => 'your_list' }) -%]
[% BLOCK text %]TEXT: [% item %][% END -%]
[% BLOCK my_hash %]HASH: [% item.keys.sort.join(', ') %][% END -%]
[% BLOCK your_list %]LIST: [% item.join(', ') %][% END -%]
[% view.print("some text") %]
[% view.print({ alpha => 'a', bravo => 'b' }) %]
[% view.print([ 'charlie', 'delta' ]) %]
-- expect --
TEXT: some text
HASH: alpha, bravo
LIST: charlie, delta
-- test --
[% USE view(item => 'thing',
map => { HASH => 'my_hash', ARRAY => 'your_list' }) -%]
[% BLOCK text %]TEXT: [% thing %][% END -%]
[% BLOCK my_hash %]HASH: [% thing.keys.sort.join(', ') %][% END -%]
[% BLOCK your_list %]LIST: [% thing.join(', ') %][% END -%]
[% view.print("some text") %]
[% view.print({ alpha => 'a', bravo => 'b' }) %]
[% view.print([ 'charlie', 'delta' ]) %]
-- expect --
TEXT: some text
HASH: alpha, bravo
LIST: charlie, delta
-- test --
[% USE view -%]
[% view.print('Hello World') %]
[% view1 = view.clone( prefix='my_') -%]
[% view1.print('Hello World') %]
[% view2 = view1.clone( prefix='dud_', notfound='no_text' ) -%]
[% view2.print('Hello World') %]
[% BLOCK text %]TEXT: [% item %][% END -%]
[% BLOCK my_text %]MY TEXT: [% item %][% END -%]
[% BLOCK dud_no_text %]NO TEXT: [% item %][% END -%]
-- expect --
TEXT: Hello World
MY TEXT: Hello World
NO TEXT: Hello World
-- test --
[% USE view( prefix = 'base_', default => 'any' ) -%]
[% view1 = view.clone( prefix => 'one_') -%]
[% view2 = view.clone( prefix => 'two_') -%]
[% view.default %] / [% view.map.default %]
[% view1.default = 'anyone' -%]
[% view1.default %] / [% view1.map.default %]
[% view2.map.default = 'anytwo' -%]
[% view2.default %] / [% view2.map.default %]
[% view.print("Hello World") %] / [% view.print(blessed_list) %]
[% view1.print("Hello World") %] / [% view1.print(blessed_list) %]
[% view2.print("Hello World") %] / [% view2.print(blessed_list) %]
[% BLOCK base_text %]ANY TEXT: [% item %][% END -%]
[% BLOCK one_text %]ONE TEXT: [% item %][% END -%]
[% BLOCK two_text %]TWO TEXT: [% item %][% END -%]
[% BLOCK base_any %]BASE ANY: [% item.as_list.join(', ') %][% END -%]
[% BLOCK one_anyone %]ONE ANY: [% item.as_list.join(', ') %][% END -%]
[% BLOCK two_anytwo %]TWO ANY: [% item.as_list.join(', ') %][% END -%]
-- expect --
any / any
anyone / anyone
anytwo / anytwo
ANY TEXT: Hello World / BASE ANY: Hello, World
ONE TEXT: Hello World / ONE ANY: Hello, World
TWO TEXT: Hello World / TWO ANY: Hello, World
-- test --
[% USE view( prefix => 'my_', item => 'thing' ) -%]
[% view.view('thingy', [ 'foo', 'bar'] ) %]
[% BLOCK my_thingy %]thingy: [ [% thing.join(', ') %] ][%END %]
-- expect --
thingy: [ foo, bar ]
-- test --
[% USE view -%]
[% view.map.${'Template::View'} = 'myview' -%]
[% view.print(view) %]
[% BLOCK myview %]MYVIEW[% END%]
-- expect --
MYVIEW
-- test --
[% USE view -%]
[% view.include('greeting', msg => 'Hello World!') %]
[% BLOCK greeting %]msg: [% msg %][% END -%]
-- expect --
msg: Hello World!
-- test --
[% USE view( prefix="my_" )-%]
[% view.include('greeting', msg => 'Hello World!') %]
[% BLOCK my_greeting %]msg: [% msg %][% END -%]
-- expect --
msg: Hello World!
-- test --
[% USE view( prefix="my_" )-%]
[% view.include_greeting( msg => 'Hello World!') %]
[% BLOCK my_greeting %]msg: [% msg %][% END -%]
-- expect --
msg: Hello World!
-- test --
[% USE view( prefix="my_" )-%]
[% INCLUDE $view.template('greeting')
msg = 'Hello World!' %]
[% BLOCK my_greeting %]msg: [% msg %][% END -%]
-- expect --
msg: Hello World!
-- test --
[% USE view( title="My View" )-%]
[% view.title %]
-- expect --
My View
-- test --
[% USE view( title="My View" )-%]
[% newview = view.clone( col = 'Chartreuse') -%]
[% newerview = newview.clone( title => 'New Title' ) -%]
[% view.title %]
[% newview.title %]
[% newview.col %]
[% newerview.title %]
[% newerview.col %]
-- expect --
My View
My View
Chartreuse
New Title
Chartreuse
#------------------------------------------------------------------------
-- test --
[% VIEW fred prefix='blat_' %]
This is the view
[% END -%]
[% BLOCK blat_foo; 'This is blat_foo'; END -%]
[% fred.view_foo %]
-- expect --
This is blat_foo
-- test --
[% VIEW fred %]
This is the view
[% view.prefix = 'blat_' %]
[% END -%]
[% BLOCK blat_foo; 'This is blat_foo'; END -%]
[% fred.view_foo %]
-- expect --
This is blat_foo
-- test --
[% VIEW fred %]
This is the view
[% view.prefix = 'blat_' %]
[% view.thingy = 'bloop' %]
[% fred.name = 'Freddy' %]
[% END -%]
[% fred.prefix %]
[% fred.thingy %]
[% fred.name %]
-- expect --
blat_
bloop
Freddy
-- test --
[% VIEW fred prefix='blat_'; view.name='Fred'; END -%]
[% fred.prefix %]
[% fred.name %]
[% TRY;
fred.prefix = 'nonblat_';
CATCH;
error;
END
%]
[% TRY;
fred.name = 'Derek';
CATCH;
error;
END
%]
-- expect --
blat_
Fred
view error - cannot update config item in sealed view: prefix
view error - cannot update item in sealed view: name
-- test --
[% VIEW foo prefix='blat_' default="default" notfound="notfound"
title="fred" age=23 height=1.82 %]
[% view.other = 'another' %]
[% END -%]
[% BLOCK blat_hash -%]
[% FOREACH key = item.keys.sort -%]
[% key %] => [% item.$key %]
[% END -%]
[% END -%]
[% foo.print(foo.data) %]
-- expect --
age => 23
height => 1.82
other => another
title => fred
-- test --
[% VIEW foo %]
[% BLOCK hello -%]
Hello World!
[% END %]
[% BLOCK goodbye -%]
Goodbye World!
[% END %]
[% END -%]
[% TRY; INCLUDE foo; CATCH; error; END %]
[% foo.include_hello %]
-- expect --
file error - foo: not found
Hello World!
-- test --
[% title = "Previous Title" -%]
[% VIEW foo
include_naked = 1
title = title or 'Default Title'
copy = 'me, now'
-%]
[% view.bgcol = '#ffffff' -%]
[% BLOCK header -%]
Header: bgcol: [% view.bgcol %]
title: [% title %]
view.title: [% view.title %]
[%- END %]
[% BLOCK footer -%]
© Copyright [% view.copy %]
[%- END %]
[% END -%]
[% title = 'New Title' -%]
[% foo.header %]
[% foo.header(bgcol='#dead' title="Title Parameter") %]
[% foo.footer %]
[% foo.footer(copy="you, then") %]
-- expect --
Header: bgcol: #ffffff
title: New Title
view.title: Previous Title
Header: bgcol: #ffffff
title: Title Parameter
view.title: Previous Title
© Copyright me, now
© Copyright me, now
-- test --
[% VIEW foo
title = 'My View'
author = 'Andy Wardley'
bgcol = bgcol or '#ffffff'
-%]
[% view.arg1 = 'argument #1' -%]
[% view.data.arg2 = 'argument #2' -%]
[% END -%]
[% foo.title %]
[% foo.author %]
[% foo.bgcol %]
[% foo.arg1 %]
[% foo.arg2 %]
[% bar = foo.clone( title='New View', arg1='New Arg1' ) %]cloned!
[% bar.title %]
[% bar.author %]
[% bar.bgcol %]
[% bar.arg1 %]
[% bar.arg2 %]
originals:
[% foo.title %]
[% foo.arg1 %]
-- expect --
My View
Andy Wardley
#ffffff
argument #1
argument #2
cloned!
New View
Andy Wardley
#ffffff
New Arg1
argument #2
originals:
My View
argument #1
-- test --
[% VIEW basic title = "My Web Site" %]
[% BLOCK header -%]
This is the basic header: [% title or view.title %]
[%- END -%]
[% END -%]
[%- VIEW fancy
title = "<fancy>$basic.title</fancy>"
basic = basic
%]
[% BLOCK header ; view.basic.header(title = title or view.title) %]
Fancy new part of header
[%- END %]
[% END -%]
===
[% basic.header %]
[% basic.header( title = "New Title" ) %]
===
[% fancy.header %]
[% fancy.header( title = "Fancy Title" ) %]
-- expect --
===
This is the basic header: My Web Site
This is the basic header: New Title
===
This is the basic header: <fancy>My Web Site</fancy>
Fancy new part of header
This is the basic header: Fancy Title
Fancy new part of header
-- test --
[% VIEW baz notfound='lost' %]
[% BLOCK lost; 'lost, not found'; END %]
[% END -%]
[% baz.any %]
-- expect --
lost, not found
-- test --
[% VIEW woz prefix='outer_' %]
[% BLOCK wiz; 'The inner wiz'; END %]
[% END -%]
[% BLOCK outer_waz; 'The outer waz'; END -%]
[% woz.wiz %]
[% woz.waz %]
-- expect --
The inner wiz
The outer waz
-- test --
[% VIEW foo %]
[% BLOCK file -%]
File: [% item.name %]
[%- END -%]
[% BLOCK directory -%]
Dir: [% item.name %]
[%- END %]
[% END -%]
[% foo.view_file({ name => 'some_file' }) %]
[% foo.include_file(item => { name => 'some_file' }) %]
[% foo.view('directory', { name => 'some_dir' }) %]
-- expect --
File: some_file
File: some_file
Dir: some_dir
-- test --
[% BLOCK parent -%]
This is the base block
[%- END -%]
[% VIEW super %]
[%- BLOCK parent -%]
[%- INCLUDE parent | replace('base', 'super') -%]
[%- END -%]
[% END -%]
base: [% INCLUDE parent %]
super: [% super.parent %]
-- expect --
base: This is the base block
super: This is the super block
-- test --
[% BLOCK foo -%]
public foo block
[%- END -%]
[% VIEW plain %]
[% BLOCK foo -%]
<plain>[% PROCESS foo %]</plain>
[%- END %]
[% END -%]
[% VIEW fancy %]
[% BLOCK foo -%]
[%- plain.foo | replace('plain', 'fancy') -%]
[%- END %]
[% END -%]
[% plain.foo %]
[% fancy.foo %]
-- expect --
<plain>public foo block</plain>
<fancy>public foo block</fancy>
-- test --
[% VIEW foo %]
[% BLOCK Blessed_List -%]
This is a list: [% item.as_list.join(', ') %]
[% END -%]
[% END -%]
[% foo.print(blessed_list) %]
-- expect --
This is a list: Hello, World
-- test --
[% VIEW my.foo value=33; END -%]
n: [% my.foo.value %]
-- expect --
n: 33
-- test --
[% VIEW parent -%]
[% BLOCK one %]This is base one[% END %]
[% BLOCK two %]This is base two[% END %]
[% END -%]
[%- VIEW child1 base=parent %]
[% BLOCK one %]This is child1 one[% END %]
[% END -%]
[%- VIEW child2 base=parent %]
[% BLOCK two %]This is child2 two[% END %]
[% END -%]
[%- VIEW child3 base=child2 %]
[% BLOCK two %]This is child3 two[% END %]
[% END -%]
[%- FOREACH child = [ child1, child2, child3 ] -%]
one: [% child.one %]
[% END -%]
[% FOREACH child = [ child1, child2, child3 ] -%]
two: [% child.two %]
[% END %]
-- expect --
one: This is child1 one
one: This is base one
one: This is base one
two: This is base two
two: This is child2 two
two: This is child3 two
-- test --
[% VIEW my.view.default
prefix = 'view/default/'
value = 3.14;
END
-%]
value: [% my.view.default.value %]
-- expect --
value: 3.14
-- test --
[% VIEW my.view.default
prefix = 'view/default/'
value = 3.14;
END;
VIEW my.view.one
base = my.view.default
prefix = 'view/one/';
END;
VIEW my.view.two
base = my.view.default
value = 2.718;
END;
-%]
[% BLOCK view/default/foo %]Default foo[% END -%]
[% BLOCK view/one/foo %]One foo[% END -%]
0: [% my.view.default.foo %]
1: [% my.view.one.foo %]
2: [% my.view.two.foo %]
0: [% my.view.default.value %]
1: [% my.view.one.value %]
2: [% my.view.two.value %]
-- expect --
0: Default foo
1: One foo
2: Default foo
0: 3.14
1: 3.14
2: 2.718
-- test --
[% VIEW foo number = 10 sealed = 0; END -%]
a: [% foo.number %]
b: [% foo.number = 20 %]
c: [% foo.number %]
d: [% foo.number(30) %]
e: [% foo.number %]
-- expect --
a: 10
b:
c: 20
d: 30
e: 30
-- test --
[% VIEW foo number = 10 silent = 1; END -%]
a: [% foo.number %]
b: [% foo.number = 20 %]
c: [% foo.number %]
d: [% foo.number(30) %]
e: [% foo.number %]
-- expect --
a: 10
b:
c: 10
d: 10
e: 10
-- test --
-- name bad base --
[% TRY;
VIEW wiz base=no_such_base_at_all;
END;
CATCH;
error;
END
-%]
-- expect --
view error - Invalid base specified for view
|