Skip to content

Commit

Permalink
Add lambda spec for Common Lisp.
Browse files Browse the repository at this point in the history
  • Loading branch information
kanru committed Jan 29, 2012
1 parent 9b1bc7a commit 341b1bc
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions specs/~lambdas.yml
Expand Up @@ -22,6 +22,7 @@ tests:
php: 'return "world";'
python: 'lambda: "world"'
clojure: '(fn [] "world")'
lisp: '(lambda () "world")'
template: "Hello, {{lambda}}!"
expected: "Hello, world!"

Expand All @@ -36,6 +37,7 @@ tests:
php: 'return "{{planet}}";'
python: 'lambda: "{{planet}}"'
clojure: '(fn [] "{{planet}}")'
lisp: '(lambda () "{{planet}}")'
template: "Hello, {{lambda}}!"
expected: "Hello, world!"

Expand All @@ -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)!"

Expand All @@ -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'

Expand All @@ -76,6 +80,7 @@ tests:
php: 'return ">";'
python: 'lambda: ">"'
clojure: '(fn [] ">")'
lisp: '(lambda () ">")'
template: "<{{lambda}}{{{lambda}}}"
expected: "<&gt;>"

Expand All @@ -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>"

Expand All @@ -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->"

Expand All @@ -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->"

Expand All @@ -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__'

Expand All @@ -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: "<>"

0 comments on commit 341b1bc

Please sign in to comment.