summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Appel <Dan.appel00@gmail.com>2021-05-11 02:02:33 -0700
committerGitHub <noreply@github.com>2021-05-11 02:02:33 -0700
commitbb63070e701e6e5ba9fa0b4adaa259a0ef8115be (patch)
tree939747e71d1292b191329dd4fa8b8201b03e4566
parent7b09c52a149563d53156e7abcff3dde02f7b5b9d (diff)
parent0f428a711e514e1b9df651c399397b38b6ee2f0a (diff)
downloadmustache-spec-bb63070e701e6e5ba9fa0b4adaa259a0ef8115be.tar.gz
Merge pull request #126 from splumhoff/master
-rw-r--r--specs/~lambdas.json30
-rw-r--r--specs/~lambdas.yml10
2 files changed, 30 insertions, 10 deletions
diff --git a/specs/~lambdas.json b/specs/~lambdas.json
index 7b6d59c..92c902a 100644
--- a/specs/~lambdas.json
+++ b/specs/~lambdas.json
@@ -15,7 +15,8 @@
"php": "return \"world\";",
"python": "lambda: \"world\"",
"clojure": "(fn [] \"world\")",
- "lisp": "(lambda () \"world\")"
+ "lisp": "(lambda () \"world\")",
+ "pwsh": "\"world\""
}
},
"template": "Hello, {{lambda}}!",
@@ -35,7 +36,8 @@
"php": "return \"{{planet}}\";",
"python": "lambda: \"{{planet}}\"",
"clojure": "(fn [] \"{{planet}}\")",
- "lisp": "(lambda () \"{{planet}}\")"
+ "lisp": "(lambda () \"{{planet}}\")",
+ "pwsh": "\"{{planet}}\""
}
},
"template": "Hello, {{lambda}}!",
@@ -55,7 +57,8 @@
"php": "return \"|planet| => {{planet}}\";",
"python": "lambda: \"|planet| => {{planet}}\"",
"clojure": "(fn [] \"|planet| => {{planet}}\")",
- "lisp": "(lambda () \"|planet| => {{planet}}\")"
+ "lisp": "(lambda () \"|planet| => {{planet}}\")",
+ "pwsh": "\"|planet| => {{planet}}\""
}
},
"template": "{{= | | =}}\nHello, (|&lambda|)!",
@@ -74,7 +77,8 @@
"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)))"
+ "lisp": "(let ((g 0)) (lambda () (incf g)))",
+ "pwsh": "if (($null -eq $script:calls) -or ($script:calls -ge 3)){$script:calls=0}; ++$script:calls; $script:calls"
}
},
"template": "{{lambda}} == {{{lambda}}} == {{lambda}}",
@@ -93,7 +97,8 @@
"php": "return \">\";",
"python": "lambda: \">\"",
"clojure": "(fn [] \">\")",
- "lisp": "(lambda () \">\")"
+ "lisp": "(lambda () \">\")",
+ "pwsh": "\">\""
}
},
"template": "<{{lambda}}{{{lambda}}}",
@@ -113,7 +118,8 @@
"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\"))"
+ "lisp": "(lambda (text) (if (string= text \"{{x}}\") \"yes\" \"no\"))",
+ "pwsh": "if ($args[0] -eq \"{{x}}\") {\"yes\"} else {\"no\"}"
}
},
"template": "<{{#lambda}}{{x}}{{/lambda}}>",
@@ -133,7 +139,8 @@
"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))"
+ "lisp": "(lambda (text) (format nil \"~a{{planet}}~a\" text text))",
+ "pwsh": "\"$($args[0]){{planet}}$($args[0])\""
}
},
"template": "<{{#lambda}}-{{/lambda}}>",
@@ -153,7 +160,8 @@
"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))"
+ "lisp": "(lambda (text) (format nil \"~a{{planet}} => |planet|~a\" text text))",
+ "pwsh": "\"$($args[0]){{planet}} => |planet|$($args[0])\""
}
},
"template": "{{= | | =}}<|#lambda|-|/lambda|>",
@@ -172,7 +180,8 @@
"php": "return \"__\" . $text . \"__\";",
"python": "lambda text: \"__%s__\" % (text)",
"clojure": "(fn [text] (str \"__\" text \"__\"))",
- "lisp": "(lambda (text) (format nil \"__~a__\" text))"
+ "lisp": "(lambda (text) (format nil \"__~a__\" text))",
+ "pwsh": "\"__$($args[0])__\""
}
},
"template": "{{#lambda}}FILE{{/lambda}} != {{#lambda}}LINE{{/lambda}}",
@@ -192,7 +201,8 @@
"php": "return false;",
"python": "lambda text: 0",
"clojure": "(fn [text] false)",
- "lisp": "(lambda (text) (declare (ignore text)) nil)"
+ "lisp": "(lambda (text) (declare (ignore text)) nil)",
+ "pwsh": "$false"
}
},
"template": "<{{^lambda}}{{static}}{{/lambda}}>",
diff --git a/specs/~lambdas.yml b/specs/~lambdas.yml
index e4eea42..2e3316b 100644
--- a/specs/~lambdas.yml
+++ b/specs/~lambdas.yml
@@ -24,6 +24,7 @@ tests:
python: 'lambda: "world"'
clojure: '(fn [] "world")'
lisp: '(lambda () "world")'
+ pwsh: '"world"'
template: "Hello, {{lambda}}!"
expected: "Hello, world!"
@@ -40,6 +41,7 @@ tests:
python: 'lambda: "{{planet}}"'
clojure: '(fn [] "{{planet}}")'
lisp: '(lambda () "{{planet}}")'
+ pwsh: '"{{planet}}"'
template: "Hello, {{lambda}}!"
expected: "Hello, world!"
@@ -56,6 +58,7 @@ tests:
python: 'lambda: "|planet| => {{planet}}"'
clojure: '(fn [] "|planet| => {{planet}}")'
lisp: '(lambda () "|planet| => {{planet}}")'
+ pwsh: '"|planet| => {{planet}}"'
template: "{{= | | =}}\nHello, (|&lambda|)!"
expected: "Hello, (|planet| => world)!"
@@ -71,6 +74,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)))'
+ pwsh: 'if (($null -eq $script:calls) -or ($script:calls -ge 3)){$script:calls=0}; ++$script:calls; $script:calls'
template: '{{lambda}} == {{{lambda}}} == {{lambda}}'
expected: '1 == 2 == 3'
@@ -86,6 +90,7 @@ tests:
python: 'lambda: ">"'
clojure: '(fn [] ">")'
lisp: '(lambda () ">")'
+ pwsh: '">"'
template: "<{{lambda}}{{{lambda}}}"
expected: "<&gt;>"
@@ -102,6 +107,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"))'
+ pwsh: 'if ($args[0] -eq "{{x}}") {"yes"} else {"no"}'
template: "<{{#lambda}}{{x}}{{/lambda}}>"
expected: "<yes>"
@@ -118,6 +124,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))'
+ pwsh: '"$($args[0]){{planet}}$($args[0])"'
template: "<{{#lambda}}-{{/lambda}}>"
expected: "<-Earth->"
@@ -134,6 +141,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))'
+ pwsh: '"$($args[0]){{planet}} => |planet|$($args[0])"'
template: "{{= | | =}}<|#lambda|-|/lambda|>"
expected: "<-{{planet}} => Earth->"
@@ -149,6 +157,7 @@ tests:
python: 'lambda text: "__%s__" % (text)'
clojure: '(fn [text] (str "__" text "__"))'
lisp: '(lambda (text) (format nil "__~a__" text))'
+ pwsh: '"__$($args[0])__"'
template: '{{#lambda}}FILE{{/lambda}} != {{#lambda}}LINE{{/lambda}}'
expected: '__FILE__ != __LINE__'
@@ -165,5 +174,6 @@ tests:
python: 'lambda text: 0'
clojure: '(fn [text] false)'
lisp: '(lambda (text) (declare (ignore text)) nil)'
+ pwsh: '$false'
template: "<{{^lambda}}{{static}}{{/lambda}}>"
expected: "<>"