Skip to content

Commit

Permalink
Merge remote-tracking branch 'lambdas-section-short-circuit' into dev…
Browse files Browse the repository at this point in the history
…elopment

See issue mustache#47: mustache#47
  • Loading branch information
cjerdonek committed May 2, 2012
2 parents ad86636 + 493283c commit 6db2f0a
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions specs/~lambdas.yml
Expand Up @@ -107,6 +107,40 @@ tests:
template: "<{{#lambda}}-{{/lambda}}>"
expected: "<-Earth->"

- name: Section - Expansion of List Elements
desc: Lambdas used for sections in a list should each have their results parsed.
data:
planet: "Earth"
lambdas:
- !code
python: 'lambda text: "~{{%s}}~" % text'
- !code
python: 'lambda text: "#{{%s}}#" % text'
template: "<{{#lambdas}}planet{{/lambdas}}>"
expected: "<~Earth~#Earth#>"

- name: Section - Context Stack
desc: |
Lambdas used for sections should not be pushed onto the context
stack before rendering their return value.
data:
planet: "Earth"
star: "Sun"
lambda: !code
python: 'lambda text: "~{{star}} %s {{.}}~" % text'
template: "<{{#planet}}{{#lambda}}&{{/lambda}}{{/planet}}>"
expected: "<~Sun & Earth~>"

- name: Section - No Re-interpolation
desc: The lambda return value should not be re-interpolated.
data:
planet: "Earth"
dot: "#{{.}}#"
lambda: !code
python: 'lambda text: "~{{%s}}~" % text'
template: "<{{#planet}}{{#lambda}}dot{{/lambda}}{{/planet}}>"
expected: "<~#{{.}}#~>"

- name: Section - Alternate Delimiters
desc: Lambdas used for sections should parse with the current delimiters.
data:
Expand Down

0 comments on commit 6db2f0a

Please sign in to comment.