Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add a test not to interpret strings as lists #43

Open
wants to merge 1 commit into from

2 participants

@cjerdonek

In Python, for example (as in many other languages undoubtedly), strings are sequence types that share many of the same properties as lists and other iterator types:

http://docs.python.org/library/stdtypes.html#sequence-types-str-unicode-list-tuple-bytearray-buffer-xrange

It would be good to add a test for this. One does not seem to exist yet in the spec (incidental or not).

@cjerdonek cjerdonek Added to sections.yml a test that strings should not be interpreted a…
…s lists.

In Python, for example, strings are sequence types that share many of the
same properties as lists and other iterator types:

  http://docs.python.org/library/stdtypes.html#sequence-types-str-unicode-list-tuple-bytearray-buffer-xrange

A test for this does not yet exist in the spec (incidental or not).
be426fe
@bobthecow

In Ruby 1.8.x, strings are Enumerable by line, so treating 123 as a list would still pass this test case. If you change the value to 123\n456 that should cover this case as well.

@cjerdonek cjerdonek referenced this pull request from a commit in cjerdonek/mustache-spec
@cjerdonek cjerdonek Merge remote-tracking branch 'v1.0.3+section-strings-not-lists' into …
…development

See issue #43: mustache#43
e3f4155
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 8, 2012
  1. @cjerdonek

    Added to sections.yml a test that strings should not be interpreted a…

    cjerdonek authored
    …s lists.
    
    In Python, for example, strings are sequence types that share many of the
    same properties as lists and other iterator types:
    
      http://docs.python.org/library/stdtypes.html#sequence-types-str-unicode-list-tuple-bytearray-buffer-xrange
    
    A test for this does not yet exist in the spec (incidental or not).
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 0 deletions.
  1. +6 −0 specs/sections.yml
View
6 specs/sections.yml
@@ -98,6 +98,12 @@ tests:
template: '"{{#list}}Yay lists!{{/list}}"'
expected: '""'
+ - name: Strings Not Lists
+ desc: Strings should not be interpreted as list types.
+ data: { section: '123' }
+ template: '"{{#section}}foo{{/section}}"'
+ expected: '"foo"'
+
- name: Doubled
desc: Multiple sections per template should be permitted.
data: { bool: true, two: 'second' }
Something went wrong with that request. Please try again.