Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Side by Side Diff: pkg/mustache/test/spec/~lambdas.json

Issue 804973002: Add appengine/gcloud/mustache dependencies. (Closed) Base URL: git@github.com:dart-lang/pub-dartlang-dart.git@master
Patch Set: Added AUTHORS/LICENSE/PATENTS files Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/mustache/test/spec/sections.yml ('k') | pkg/mustache/test/spec/~lambdas.yml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 {"__ATTN__":"Do not edit this file; changes belong in the appropriate YAML file. ","overview":"Lambdas are a special-cased data type for use in interpolations an d\nsections.\n\nWhen used as the data value for an Interpolation tag, the lambda MUST be\ntreatable as an arity 0 function, and invoked as such. The returned v alue\nMUST be rendered against the default delimiters, then interpolated in plac e\nof the lambda.\n\nWhen used as the data value for a Section tag, the lambda M UST be treatable\nas an arity 1 function, and invoked as such (passing a String containing the\nunprocessed section contents). The returned value MUST be rende red against\nthe current delimiters, then interpolated in place of the section.\ n","tests":[{"name":"Interpolation","data":{"lambda":{"php":"return \"world\";", "clojure":"(fn [] \"world\")","__tag__":"code","perl":"sub { \"world\" }","pytho n":"lambda: \"world\"","ruby":"proc { \"world\" }","js":"function() { return \"w orld\" }"}},"expected":"Hello, world!","template":"Hello, {{lambda}}!","desc":"A lambda's return value should be interpolated."},{"name":"Interpolation - Expans ion","data":{"planet":"world","lambda":{"php":"return \"{{planet}}\";","clojure" :"(fn [] \"{{planet}}\")","__tag__":"code","perl":"sub { \"{{planet}}\" }","pyth on":"lambda: \"{{planet}}\"","ruby":"proc { \"{{planet}}\" }","js":"function() { return \"{{planet}}\" }"}},"expected":"Hello, world!","template":"Hello, {{lamb da}}!","desc":"A lambda's return value should be parsed."},{"name":"Interpolatio n - Alternate Delimiters","data":{"planet":"world","lambda":{"php":"return \"|pl anet| => {{planet}}\";","clojure":"(fn [] \"|planet| => {{planet}}\")","__tag__" :"code","perl":"sub { \"|planet| => {{planet}}\" }","python":"lambda: \"|planet| => {{planet}}\"","ruby":"proc { \"|planet| => {{planet}}\" }","js":"function() { return \"|planet| => {{planet}}\" }"}},"expected":"Hello, (|planet| => world)! ","template":"{{= | | =}}\nHello, (|&lambda|)!","desc":"A lambda's return value should parse with the default delimiters."},{"name":"Interpolation - Multiple Ca lls","data":{"lambda":{"php":"global $calls; return ++$calls;","clojure":"(def g (atom 0)) (fn [] (swap! g inc))","__tag__":"code","perl":"sub { no strict; $cal ls += 1 }","python":"lambda: globals().update(calls=globals().get(\"calls\",0)+1 ) or calls","ruby":"proc { $calls ||= 0; $calls += 1 }","js":"function() { retur n (g=(function(){return this})()).calls=(g.calls||0)+1 }"}},"expected":"1 == 2 = = 3","template":"{{lambda}} == {{{lambda}}} == {{lambda}}","desc":"Interpolated lambdas should not be cached."},{"name":"Escaping","data":{"lambda":{"php":"retu rn \">\";","clojure":"(fn [] \">\")","__tag__":"code","perl":"sub { \">\" }","py thon":"lambda: \">\"","ruby":"proc { \">\" }","js":"function() { return \">\" }" }},"expected":"<&gt;>","template":"<{{lambda}}{{{lambda}}}","desc":"Lambda resul ts should be appropriately escaped."},{"name":"Section","data":{"x":"Error!","la mbda":{"php":"return ($text == \"{{x}}\") ? \"yes\" : \"no\";","clojure":"(fn [t ext] (if (= text \"{{x}}\") \"yes\" \"no\"))","__tag__":"code","perl":"sub { $_[ 0] eq \"{{x}}\" ? \"yes\" : \"no\" }","python":"lambda text: text == \"{{x}}\" a nd \"yes\" or \"no\"","ruby":"proc { |text| text == \"{{x}}\" ? \"yes\" : \"no\" }","js":"function(txt) { return (txt == \"{{x}}\" ? \"yes\" : \"no\") }"}},"exp ected":"<yes>","template":"<{{#lambda}}{{x}}{{/lambda}}>","desc":"Lambdas used f or sections should receive the raw section string."},{"name":"Section - Expansio n","data":{"planet":"Earth","lambda":{"php":"return $text . \"{{planet}}\" . $te xt;","clojure":"(fn [text] (str text \"{{planet}}\" text))","__tag__":"code","pe rl":"sub { $_[0] . \"{{planet}}\" . $_[0] }","python":"lambda text: \"%s{{planet }}%s\" % (text, text)","ruby":"proc { |text| \"#{text}{{planet}}#{text}\" }","js ":"function(txt) { return txt + \"{{planet}}\" + txt }"}},"expected":"<-Earth->" ,"template":"<{{#lambda}}-{{/lambda}}>","desc":"Lambdas used for sections should have their results parsed."},{"name":"Section - Alternate Delimiters","data":{" planet":"Earth","lambda":{"php":"return $text . \"{{planet}} => |planet|\" . $te xt;","clojure":"(fn [text] (str text \"{{planet}} => |planet|\" text))","__tag__ ":"code","perl":"sub { $_[0] . \"{{planet}} => |planet|\" . $_[0] }","python":"l ambda text: \"%s{{planet}} => |planet|%s\" % (text, text)","ruby":"proc { |text| \"#{text}{{planet}} => |planet|#{text}\" }","js":"function(txt) { return txt + \"{{planet}} => |planet|\" + txt }"}},"expected":"<-{{planet}} => Earth->","temp late":"{{= | | =}}<|#lambda|-|/lambda|>","desc":"Lambdas used for sections shoul d parse with the current delimiters."},{"name":"Section - Multiple Calls","data" :{"lambda":{"php":"return \"__\" . $text . \"__\";","clojure":"(fn [text] (str \ "__\" text \"__\"))","__tag__":"code","perl":"sub { \"__\" . $_[0] . \"__\" }"," python":"lambda text: \"__%s__\" % (text)","ruby":"proc { |text| \"__#{text}__\" }","js":"function(txt) { return \"__\" + txt + \"__\" }"}},"expected":"__FILE__ != __LINE__","template":"{{#lambda}}FILE{{/lambda}} != {{#lambda}}LINE{{/lambda }}","desc":"Lambdas used for sections should not be cached."},{"name":"Inverted Section","data":{"static":"static","lambda":{"php":"return false;","clojure":"(f n [text] false)","__tag__":"code","perl":"sub { 0 }","python":"lambda text: 0"," ruby":"proc { |text| false }","js":"function(txt) { return false }"}},"expected" :"<>","template":"<{{^lambda}}{{static}}{{/lambda}}>","desc":"Lambdas used for i nverted sections should be considered truthy."}]}
OLDNEW
« no previous file with comments | « pkg/mustache/test/spec/sections.yml ('k') | pkg/mustache/test/spec/~lambdas.yml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698