Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add lambda spec for Common Lisp #36

Merged
merged 1 commit into from

2 participants

@kanru

No description provided.

@locks locks merged commit 934db98 into mustache:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 29, 2012
  1. @kanru

    Add lambda spec for Common Lisp.

    kanru authored
This page is out of date. Refresh to see the latest.
Showing with 10 additions and 0 deletions.
  1. +10 −0 specs/~lambdas.yml
View
10 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: "<>"
Something went wrong with that request. Please try again.