summaryrefslogtreecommitdiff
path: root/specs/~lambdas.yml
diff options
context:
space:
mode:
Diffstat (limited to 'specs/~lambdas.yml')
-rw-r--r--specs/~lambdas.yml10
1 files changed, 10 insertions, 0 deletions
diff --git a/specs/~lambdas.yml b/specs/~lambdas.yml
index e0e9bf3..27fe140 100644
--- a/specs/~lambdas.yml
+++ b/specs/~lambdas.yml
@@ -21,6 +21,7 @@ tests:
js: 'function() { return "world" }'
php: 'return "world";'
python: 'lambda: "world"'
+ clojure: '(fn [] "world")'
template: "Hello, {{lambda}}!"
expected: "Hello, world!"
@@ -34,6 +35,7 @@ tests:
js: 'function() { return "{{planet}}" }'
php: 'return "{{planet}}";'
python: 'lambda: "{{planet}}"'
+ clojure: '(fn [] "{{planet}}")'
template: "Hello, {{lambda}}!"
expected: "Hello, world!"
@@ -47,6 +49,7 @@ tests:
js: 'function() { return "|planet| => {{planet}}" }'
php: 'return "|planet| => {{planet}}";'
python: 'lambda: "|planet| => {{planet}}"'
+ clojure: '(fn [] "|planet| => {{planet}}")'
template: "{{= | | =}}\nHello, (|&lambda|)!"
expected: "Hello, (|planet| => world)!"
@@ -59,6 +62,7 @@ tests:
js: 'function() { return (g=(function(){return this})()).calls=(g.calls||0)+1 }'
php: 'global $calls; return ++$calls;'
python: 'lambda: globals().update(calls=globals().get("calls",0)+1) or calls'
+ clojure: '(def g (atom 0)) (fn [] (swap! g inc))'
template: '{{lambda}} == {{{lambda}}} == {{lambda}}'
expected: '1 == 2 == 3'
@@ -71,6 +75,7 @@ tests:
js: 'function() { return ">" }'
php: 'return ">";'
python: 'lambda: ">"'
+ clojure: '(fn [] ">")'
template: "<{{lambda}}{{{lambda}}}"
expected: "<&gt;>"
@@ -84,6 +89,7 @@ tests:
js: 'function(txt) { return (txt == "{{x}}" ? "yes" : "no") }'
php: 'return ($text == "{{x}}") ? "yes" : "no";'
python: 'lambda text: text == "{{x}}" and "yes" or "no"'
+ clojure: '(fn [text] (if (= text "{{x}}") "yes" "no"))'
template: "<{{#lambda}}{{x}}{{/lambda}}>"
expected: "<yes>"
@@ -97,6 +103,7 @@ tests:
js: 'function(txt) { return txt + "{{planet}}" + txt }'
php: 'return $text . "{{planet}}" . $text;'
python: 'lambda text: "%s{{planet}}%s" % (text, text)'
+ clojure: '(fn [text] (str text "{{planet}}" text))'
template: "<{{#lambda}}-{{/lambda}}>"
expected: "<-Earth->"
@@ -110,6 +117,7 @@ tests:
js: 'function(txt) { return txt + "{{planet}} => |planet|" + txt }'
php: 'return $text . "{{planet}} => |planet|" . $text;'
python: 'lambda text: "%s{{planet}} => |planet|%s" % (text, text)'
+ clojure: '(fn [text] (str text "{{planet}} => |planet|" text))'
template: "{{= | | =}}<|#lambda|-|/lambda|>"
expected: "<-{{planet}} => Earth->"
@@ -122,6 +130,7 @@ tests:
js: 'function(txt) { return "__" + txt + "__" }'
php: 'return "__" . $text . "__";'
python: 'lambda text: "__%s__" % (text)'
+ clojure: '(fn [text] (str "__" text "__"))'
template: '{{#lambda}}FILE{{/lambda}} != {{#lambda}}LINE{{/lambda}}'
expected: '__FILE__ != __LINE__'
@@ -135,5 +144,6 @@ tests:
js: 'function(txt) { return false }'
php: 'return false;'
python: 'lambda text: 0'
+ clojure: '(fn [text] false)'
template: "<{{^lambda}}{{static}}{{/lambda}}>"
expected: "<>"