diff options
author | Pieter van de Bruggen <pvande@gmail.com> | 2011-03-20 10:39:03 -0700 |
---|---|---|
committer | Pieter van de Bruggen <pvande@gmail.com> | 2011-03-20 10:39:03 -0700 |
commit | 6d8e60ea082ee173914741e1eedd6a73231ef6ac (patch) | |
tree | f1dc63ba486bd9f130bcdfd25233dbc7eeb2281e | |
parent | 3e800d1ebcc86fa2e0f243f2ceb75acbb65c16f9 (diff) | |
parent | 48c933b0bb780875acbfd15816297e263c53d6f7 (diff) | |
download | mustache-spec-6d8e60ea082ee173914741e1eedd6a73231ef6ac.tar.gz |
Merge branch 'v1.0'
Conflicts:
Changes
-rw-r--r-- | Changes | 4 | ||||
-rw-r--r-- | specs/~lambdas.yml | 33 |
2 files changed, 33 insertions, 4 deletions
@@ -1,8 +1,10 @@ 2011-03-??: v1.1.2 Added tests for standalone tags at string boundaries. + Added tests for rendering lambda returns after delimiter changes. -2011-03-??: v1.0.3 +2011-03-20: v1.0.3 Added tests for standalone tags at string boundaries. + Added tests for rendering lambda returns after delimiter changes. 2011-03-05: v1.1.1 Added tests for indented inline sections. diff --git a/specs/~lambdas.yml b/specs/~lambdas.yml index 741a98a..e0e9bf3 100644 --- a/specs/~lambdas.yml +++ b/specs/~lambdas.yml @@ -4,12 +4,13 @@ overview: | When used as the data value for an Interpolation tag, the lambda MUST be treatable as an arity 0 function, and invoked as such. The returned value - MUST be rendered, then interpolated in place of the lambda. + MUST be rendered against the default delimiters, then interpolated in place + of the lambda. When used as the data value for a Section tag, the lambda MUST be treatable as an arity 1 function, and invoked as such (passing a String containing the - unprocessed section contents). The returned value MUST be rendered, then - interpolated in place of the section. + unprocessed section contents). The returned value MUST be rendered against + the current delimiters, then interpolated in place of the section. tests: - name: Interpolation desc: A lambda's return value should be interpolated. @@ -36,6 +37,19 @@ tests: template: "Hello, {{lambda}}!" expected: "Hello, world!" + - name: Interpolation - Alternate Delimiters + desc: A lambda's return value should parse with the default delimiters. + data: + planet: "world" + lambda: !code + ruby: 'proc { "|planet| => {{planet}}" }' + perl: 'sub { "|planet| => {{planet}}" }' + js: 'function() { return "|planet| => {{planet}}" }' + php: 'return "|planet| => {{planet}}";' + python: 'lambda: "|planet| => {{planet}}"' + template: "{{= | | =}}\nHello, (|&lambda|)!" + expected: "Hello, (|planet| => world)!" + - name: Interpolation - Multiple Calls desc: Interpolated lambdas should not be cached. data: @@ -86,6 +100,19 @@ tests: template: "<{{#lambda}}-{{/lambda}}>" expected: "<-Earth->" + - name: Section - Alternate Delimiters + desc: Lambdas used for sections should parse with the current delimiters. + data: + planet: "Earth" + lambda: !code + ruby: 'proc { |text| "#{text}{{planet}} => |planet|#{text}" }' + perl: 'sub { $_[0] . "{{planet}} => |planet|" . $_[0] }' + js: 'function(txt) { return txt + "{{planet}} => |planet|" + txt }' + php: 'return $text . "{{planet}} => |planet|" . $text;' + python: 'lambda text: "%s{{planet}} => |planet|%s" % (text, text)' + template: "{{= | | =}}<|#lambda|-|/lambda|>" + expected: "<-{{planet}} => Earth->" + - name: Section - Multiple Calls desc: Lambdas used for sections should not be cached. data: |