Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions specs/~lambdas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ tests:
python: 'lambda: "world"'
clojure: '(fn [] "world")'
lisp: '(lambda () "world")'
bash: 'echo -n "world"'
template: "Hello, {{lambda}}!"
expected: "Hello, world!"

Expand All @@ -38,6 +39,7 @@ tests:
python: 'lambda: "{{planet}}"'
clojure: '(fn [] "{{planet}}")'
lisp: '(lambda () "{{planet}}")'
bash: 'echo -n "{{planet}}"'
template: "Hello, {{lambda}}!"
expected: "Hello, world!"

Expand All @@ -53,6 +55,7 @@ tests:
python: 'lambda: "|planet| => {{planet}}"'
clojure: '(fn [] "|planet| => {{planet}}")'
lisp: '(lambda () "|planet| => {{planet}}")'
bash: 'echo -n "|planet| => {{planet}}"'
template: "{{= | | =}}\nHello, (|&lambda|)!"
expected: "Hello, (|planet| => world)!"

Expand All @@ -67,6 +70,7 @@ tests:
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)))'
bash: 'calls=$(( ${calls:- 0} + 1 ));echo -n $calls'
template: '{{lambda}} == {{{lambda}}} == {{lambda}}'
expected: '1 == 2 == 3'

Expand All @@ -81,6 +85,7 @@ tests:
python: 'lambda: ">"'
clojure: '(fn [] ">")'
lisp: '(lambda () ">")'
bash: 'echo -n ">"'
template: "<{{lambda}}{{{lambda}}}"
expected: "<&gt;>"

Expand All @@ -96,6 +101,7 @@ tests:
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"))'
bash: '[[ "$1" == "{{x}}" ]] && echo -n "yes" || echo -n "no"'
template: "<{{#lambda}}{{x}}{{/lambda}}>"
expected: "<yes>"

Expand All @@ -111,6 +117,7 @@ tests:
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))'
bash: 'echo -n "${1}{{planet}}${1}"'
template: "<{{#lambda}}-{{/lambda}}>"
expected: "<-Earth->"

Expand All @@ -126,6 +133,7 @@ tests:
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))'
bash: 'echo -n "${1}{{planet}} => |planet|${1}"'
template: "{{= | | =}}<|#lambda|-|/lambda|>"
expected: "<-{{planet}} => Earth->"

Expand All @@ -140,6 +148,7 @@ tests:
python: 'lambda text: "__%s__" % (text)'
clojure: '(fn [text] (str "__" text "__"))'
lisp: '(lambda (text) (format nil "__~a__" text))'
bash: 'echo -n "__${1}__"'
template: '{{#lambda}}FILE{{/lambda}} != {{#lambda}}LINE{{/lambda}}'
expected: '__FILE__ != __LINE__'

Expand All @@ -155,5 +164,6 @@ tests:
python: 'lambda text: 0'
clojure: '(fn [text] false)'
lisp: '(lambda (text) (declare (ignore text)) nil)'
bash: ''
template: "<{{^lambda}}{{static}}{{/lambda}}>"
expected: "<>"