Mustache

Artifact [1f229cebcc]
Login

Artifact 1f229cebccd1599f636a1a97aad69e92d2376dc4e0aae26f1bff4912397e63e2:


overview: |
  Additional tests for bugs found by mustache.tcl users.
tests:
  - name: Sections - Trailing Text
    desc: Nested section causes spurious repeats. <https://github.com/ianka/mustache.tcl/issues/2>
    data: { o: [ { x: a, i: 1 }, { x: b, i: 0 }, { x: c, i: 1 } ] }
    template: '{{#o}}{{#i}}{{x}}{{/i}}{{/o}}foo'
    expected: 'acfoo'

  - name: Sections - Repeated Sections
    desc: Nested sections affect repeated outer section. <https://github.com/ianka/mustache.tcl/issues/3>
    data: { items: [ { item: a, comma: true }, { item: b } ] }
    template: '{{#items}}{{item}}{{#comma}},{{/comma}}{{/items}}{{#items}}{{item}}{{/items}}{{#items}}{{item}}{{#comma}},{{/comma}}{{/items}}'
    expected: 'a,baba,b'

  - name: Sections - Truth values in list contexts
    desc: Truth values should not throw an error in a list context.
    data: { chars: [ { char: a, hasdigit: true }, { char: b } ], digits: [ { digit: 1 }, { digit: 2 } ] }
    template: '{{#chars}}{{char}}{{#hasdigit}}:{{#digits}}{{digit}}{{/digits}};{{/hasdigit}}{{/chars}}'
    expected: 'a:12;b'