summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPieter van de Bruggen <pvande@gmail.com>2010-12-26 08:47:32 -0800
committerPieter van de Bruggen <pvande@gmail.com>2010-12-26 08:50:49 -0800
commitcf87c2f067895f1a793454fc0112a6ad7ffe222f (patch)
treeb6b978a18979d390be8cdc345e0bf4068a736c3a
parent61d47607a9156ce0c49d12a3d7cf9e46ea1a6c68 (diff)
downloadmustache-spec-cf87c2f067895f1a793454fc0112a6ad7ffe222f.tar.gz
Merging PHP lambdas into the spec.
Incorporates changes from https://github.com/bobthecow/spec/commit/0253274f319dac2943a639d13b47c00725031d98.
-rw-r--r--specs/~lambdas.yml9
1 files changed, 9 insertions, 0 deletions
diff --git a/specs/~lambdas.yml b/specs/~lambdas.yml
index 0079e93..4ea7a1f 100644
--- a/specs/~lambdas.yml
+++ b/specs/~lambdas.yml
@@ -6,6 +6,7 @@ tests:
ruby: 'proc { "world" }'
perl: 'sub { "world" }'
js: 'function() { return "world" }'
+ php: 'return "world";'
template: "Hello, {{lambda}}!"
expected: "Hello, world!"
@@ -17,6 +18,7 @@ tests:
ruby: 'proc { "{{planet}}" }'
perl: 'sub { "{{planet}}" }'
js: 'function() { return "{{planet}}" }'
+ php: 'return "{{planet}}";'
template: "Hello, {{lambda}}!"
expected: "Hello, world!"
@@ -27,6 +29,7 @@ tests:
ruby: 'proc { $calls ||= 0; $calls += 1 }'
perl: 'sub { no strict; $calls += 1 }'
js: 'function() { f = arguments.callee; return f.calls = (f.calls || 0) + 1 }'
+ php: 'global $calls; return ++$calls;'
template: '{{lambda}} == {{{lambda}}} == {{lambda}}'
expected: '1 == 1 == 1'
@@ -40,6 +43,7 @@ tests:
ruby: 'proc { "Big" }'
perl: 'sub { "Big" }'
js: 'function() { return "Big" }'
+ php: 'return "Big";'
template: "{{#context}}{{key}} the {{lambda}}{{/context}} {{key}}"
expected: "Under the Big Top"
@@ -50,6 +54,7 @@ tests:
ruby: 'proc { ">" }'
perl: 'sub { ">" }'
js: 'function() { return ">" }'
+ php: 'return ">";'
template: "<{{lambda}}{{{lambda}}}"
expected: "<&gt;>"
@@ -61,6 +66,7 @@ tests:
ruby: 'proc { |text| text == "{{x}}" ? "yes" : "no" }'
perl: 'sub { $_[0] eq "{{x}}" ? "yes" : "no" }'
js: 'function(txt) { return (txt == "{{x}}" ? "yes" : "no") }'
+ php: 'return ($text == "{{x}}") ? "yes" : "no";'
template: "<{{#lambda}}{{x}}{{/lambda}}>"
expected: "<yes>"
@@ -72,6 +78,7 @@ tests:
ruby: 'proc { |text| "#{text}{{planet}}#{text}" }'
perl: 'sub { $_[0] . "{{planet}}" . $_[0] }'
js: 'function(txt) { return txt + "{{planet}}" + txt }'
+ php: 'return $text . "{{planet}}" . $text;'
template: "<{{#lambda}}-{{/lambda}}>"
expected: "<-Earth->"
@@ -82,6 +89,7 @@ tests:
ruby: 'proc { |text| "__#{text}__" }'
perl: 'sub { "__" . $_[0] . "__" }'
js: 'function(txt) { return "__" + txt + "__" }'
+ php: 'return "__" . $text . "__";'
template: '{{#lambda}}FILE{{/lambda}} != {{#lambda}}LINE{{/lambda}}'
expected: '__FILE__ != __LINE__'
@@ -93,5 +101,6 @@ tests:
ruby: 'proc { |text| text }'
perl: 'sub { shift }'
js: 'function(txt) { return txt }'
+ php: 'return $text;'
template: "<{{^lambda}}{{static}}{{/lambda}}>"
expected: "<>"