summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKan-Ru Chen <kanru@kanru.info>2012-01-29 17:38:44 +0800
committerKan-Ru Chen <kanru@kanru.info>2012-01-29 17:38:44 +0800
commit341b1bc381df588d0c1c69768c0d232a8c5edc24 (patch)
tree61a8b1380e0489a33dcac0028de1c526428e6503
parent9b1bc7ad19247e9671304af02078f2ce30132665 (diff)
downloadmustache-spec-341b1bc381df588d0c1c69768c0d232a8c5edc24.tar.gz
Add lambda spec for Common Lisp.
-rw-r--r--specs/~lambdas.yml10
1 files changed, 10 insertions, 0 deletions
diff --git a/specs/~lambdas.yml b/specs/~lambdas.yml
index b9fb4d0..f3f3b0b 100644
--- a/specs/~lambdas.yml
+++ b/specs/~lambdas.yml
@@ -22,6 +22,7 @@ tests:
php: 'return "world";'
python: 'lambda: "world"'
clojure: '(fn [] "world")'
+ lisp: '(lambda () "world")'
template: "Hello, {{lambda}}!"
expected: "Hello, world!"
@@ -36,6 +37,7 @@ tests:
php: 'return "{{planet}}";'
python: 'lambda: "{{planet}}"'
clojure: '(fn [] "{{planet}}")'
+ lisp: '(lambda () "{{planet}}")'
template: "Hello, {{lambda}}!"
expected: "Hello, world!"
@@ -50,6 +52,7 @@ tests:
php: 'return "|planet| => {{planet}}";'
python: 'lambda: "|planet| => {{planet}}"'
clojure: '(fn [] "|planet| => {{planet}}")'
+ lisp: '(lambda () "|planet| => {{planet}}")'
template: "{{= | | =}}\nHello, (|&lambda|)!"
expected: "Hello, (|planet| => world)!"
@@ -63,6 +66,7 @@ tests:
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))'
+ lisp: '(let ((g 0)) (lambda () (incf g)))'
template: '{{lambda}} == {{{lambda}}} == {{lambda}}'
expected: '1 == 2 == 3'
@@ -76,6 +80,7 @@ tests:
php: 'return ">";'
python: 'lambda: ">"'
clojure: '(fn [] ">")'
+ lisp: '(lambda () ">")'
template: "<{{lambda}}{{{lambda}}}"
expected: "<&gt;>"
@@ -90,6 +95,7 @@ tests:
php: 'return ($text == "{{x}}") ? "yes" : "no";'
python: 'lambda text: text == "{{x}}" and "yes" or "no"'
clojure: '(fn [text] (if (= text "{{x}}") "yes" "no"))'
+ lisp: '(lambda (text) (if (string= text "{{x}}") "yes" "no"))'
template: "<{{#lambda}}{{x}}{{/lambda}}>"
expected: "<yes>"
@@ -104,6 +110,7 @@ tests:
php: 'return $text . "{{planet}}" . $text;'
python: 'lambda text: "%s{{planet}}%s" % (text, text)'
clojure: '(fn [text] (str text "{{planet}}" text))'
+ lisp: '(lambda (text) (format nil "~a{{planet}}~a" text text))'
template: "<{{#lambda}}-{{/lambda}}>"
expected: "<-Earth->"
@@ -118,6 +125,7 @@ tests:
php: 'return $text . "{{planet}} => |planet|" . $text;'
python: 'lambda text: "%s{{planet}} => |planet|%s" % (text, text)'
clojure: '(fn [text] (str text "{{planet}} => |planet|" text))'
+ lisp: '(lambda (text) (format nil "~a{{planet}} => |planet|~a" text text))'
template: "{{= | | =}}<|#lambda|-|/lambda|>"
expected: "<-{{planet}} => Earth->"
@@ -131,6 +139,7 @@ tests:
php: 'return "__" . $text . "__";'
python: 'lambda text: "__%s__" % (text)'
clojure: '(fn [text] (str "__" text "__"))'
+ lisp: '(lambda (text) (format nil "__~a__" text))'
template: '{{#lambda}}FILE{{/lambda}} != {{#lambda}}LINE{{/lambda}}'
expected: '__FILE__ != __LINE__'
@@ -145,5 +154,6 @@ tests:
php: 'return false;'
python: 'lambda text: 0'
clojure: '(fn [text] false)'
+ lisp: '(lambda (text) (declare (ignore text)) nil)'
template: "<{{^lambda}}{{static}}{{/lambda}}>"
expected: "<>"