init
This commit is contained in:
9
bml/test/codeblocks/_config.bml
Executable file
9
bml/test/codeblocks/_config.bml
Executable file
@@ -0,0 +1,9 @@
|
||||
LookRoot $testlookroot
|
||||
DefaultScheme scheme
|
||||
DefaultLanguage en
|
||||
|
||||
AllowOldSyntax 0
|
||||
AllowCode 1
|
||||
AllowTemplateCode 1
|
||||
|
||||
|
||||
6
bml/test/codeblocks/carry-variables.bml
Executable file
6
bml/test/codeblocks/carry-variables.bml
Executable file
@@ -0,0 +1,6 @@
|
||||
<?_code $content = "This should show up twice"; _code?>
|
||||
<?_code $content _code?>
|
||||
|
||||
<?_code my $other = "This should only show up once."; _code?>
|
||||
<?_code $other _code?>
|
||||
|
||||
6
bml/test/codeblocks/carry-variables.correct
Executable file
6
bml/test/codeblocks/carry-variables.correct
Executable file
@@ -0,0 +1,6 @@
|
||||
This should show up twice
|
||||
This should show up twice
|
||||
|
||||
This should only show up once.
|
||||
|
||||
|
||||
15
bml/test/codeblocks/complex1.bml
Executable file
15
bml/test/codeblocks/complex1.bml
Executable file
@@ -0,0 +1,15 @@
|
||||
<?_code
|
||||
|
||||
sub some_function { return "This is from the first codeblock"; }
|
||||
$package = __PACKAGE__;
|
||||
|
||||
return "Returning from the first codeblock.";
|
||||
|
||||
_code?>
|
||||
|
||||
<?_code
|
||||
|
||||
$package->some_function();
|
||||
|
||||
_code?>
|
||||
|
||||
4
bml/test/codeblocks/complex1.correct
Executable file
4
bml/test/codeblocks/complex1.correct
Executable file
@@ -0,0 +1,4 @@
|
||||
Returning from the first codeblock.
|
||||
|
||||
This is from the first codeblock
|
||||
|
||||
28
bml/test/codeblocks/complex2.bml
Executable file
28
bml/test/codeblocks/complex2.bml
Executable file
@@ -0,0 +1,28 @@
|
||||
<?_code
|
||||
package Foo;
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my ( $this, $that ) = @_;
|
||||
bless {
|
||||
this => $this || "default this",
|
||||
that => $that || "default that",
|
||||
}, $class;
|
||||
}
|
||||
|
||||
sub this { my $self = shift; $self->{this} = shift if @_; $self->{this} }
|
||||
sub that { my $self = shift; $self->{that} = shift if @_; $self->{that} }
|
||||
|
||||
sub msg {
|
||||
my $self = shift;
|
||||
return "[This: ". $self->this . ", That: ". $self->that . "]";
|
||||
}
|
||||
_code?>
|
||||
|
||||
|
||||
<?_code
|
||||
my $f = new Foo "pony", "not yours";
|
||||
$f->msg;
|
||||
_code?>
|
||||
|
||||
|
||||
6
bml/test/codeblocks/complex2.correct
Executable file
6
bml/test/codeblocks/complex2.correct
Executable file
@@ -0,0 +1,6 @@
|
||||
|
||||
|
||||
|
||||
[This: pony, That: not yours]
|
||||
|
||||
|
||||
9
bml/test/codeblocks/re-expand.bml
Executable file
9
bml/test/codeblocks/re-expand.bml
Executable file
@@ -0,0 +1,9 @@
|
||||
Return a BML construct:
|
||||
<?_code return "<?tag Foo tag?>" _code?>
|
||||
|
||||
Inside-out from above:
|
||||
<?exec return "[This is it.]" exec?>
|
||||
|
||||
Recurse:
|
||||
<?exec return '<?_code return "[Foo.]" _code?>' exec?>
|
||||
|
||||
9
bml/test/codeblocks/re-expand.correct
Executable file
9
bml/test/codeblocks/re-expand.correct
Executable file
@@ -0,0 +1,9 @@
|
||||
Return a BML construct:
|
||||
[Tag: Foo]
|
||||
|
||||
Inside-out from above:
|
||||
[This is it.]
|
||||
|
||||
Recurse:
|
||||
[Error: <b>_CODE block failed to execute by permission settings</b>]
|
||||
|
||||
4
bml/test/codeblocks/scheme.look
Executable file
4
bml/test/codeblocks/scheme.look
Executable file
@@ -0,0 +1,4 @@
|
||||
tag=>{D}[Tag: %%DATA%%]
|
||||
exec=>{D}<?_code %%DATA%% _code?>
|
||||
|
||||
|
||||
12
bml/test/codeblocks/simple.bml
Executable file
12
bml/test/codeblocks/simple.bml
Executable file
@@ -0,0 +1,12 @@
|
||||
Immediate value/Simple string:
|
||||
<?_code "Foo" _code?>
|
||||
|
||||
Immediate value/List:
|
||||
<?_code qw{this is some data in a list} _code?>
|
||||
|
||||
Returned string:
|
||||
<?_code return "Bar" _code?>
|
||||
|
||||
Returned List:
|
||||
<?_code return ("some", "stuff", "in", "a", "list") _code?>
|
||||
|
||||
12
bml/test/codeblocks/simple.correct
Executable file
12
bml/test/codeblocks/simple.correct
Executable file
@@ -0,0 +1,12 @@
|
||||
Immediate value/Simple string:
|
||||
Foo
|
||||
|
||||
Immediate value/List:
|
||||
list
|
||||
|
||||
Returned string:
|
||||
Bar
|
||||
|
||||
Returned List:
|
||||
list
|
||||
|
||||
Reference in New Issue
Block a user