From 72fa528054ed882fb34b5eaca93a462c14be8061 Mon Sep 17 00:00:00 2001 From: Tyler Akins Date: Mon, 26 Jan 2015 12:57:09 -0600 Subject: [PATCH] Adding functions for bash I did not rebuild the *.json files because the __tag__ => "code" bit is missing whenever I run `rake build`. --- specs/~lambdas.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/specs/~lambdas.yml b/specs/~lambdas.yml index f3f3b0b..693c4c8 100644 --- a/specs/~lambdas.yml +++ b/specs/~lambdas.yml @@ -23,6 +23,7 @@ tests: python: 'lambda: "world"' clojure: '(fn [] "world")' lisp: '(lambda () "world")' + bash: 'echo -n "world"' template: "Hello, {{lambda}}!" expected: "Hello, world!" @@ -38,6 +39,7 @@ tests: python: 'lambda: "{{planet}}"' clojure: '(fn [] "{{planet}}")' lisp: '(lambda () "{{planet}}")' + bash: 'echo -n "{{planet}}"' template: "Hello, {{lambda}}!" expected: "Hello, world!" @@ -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)!" @@ -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' @@ -81,6 +85,7 @@ tests: python: 'lambda: ">"' clojure: '(fn [] ">")' lisp: '(lambda () ">")' + bash: 'echo -n ">"' template: "<{{lambda}}{{{lambda}}}" expected: "<>>" @@ -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: "" @@ -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->" @@ -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->" @@ -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__' @@ -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: "<>"