Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Spec tests for non-alphabetical partial names #58

Open
wants to merge 1 commit into from

3 participants

@sartak

from specs/partials.yml: "The tag's content MUST be a non-whitespace character sequence NOT containing the current closing delimiter."

I added spec tests for partial names that include a number, hyphen, underscore, period, forward slash, colon, tilde, caret.

@groue

Thanks for the contribution!

There are three tests that I think you should remove. They are related to the unspecified topic of the relationships between partials and the file system:

sartak@ee331c6#L0R133 deals with file extensions:

+  - name: Partial names: period
+    desc: Partial names can include periods
+    data: { text: 'content' }
+    template: '"{{>partial.name}}"'
+    partials: { 'partial.name': '*{{text}}*' }
+    expected: '"*content*"'

sartak@ee331c6#L0R143 deals with file directory hierarchies:

+  - name: Partial names: forward slash
+    desc: Partial names can include forward slashes
+    data: { text: 'content' }
+    template: '"{{>partial/name}}"'
+    partials: { 'partial/name': '*{{text}}*' }
+    expected: '"*content*"'

sartak@ee331c6#L0R154 deals with the tilde, symbol of the home directory of a user in a Unix system:

+  - name: Partial names: tilde
+    desc: Partial names can include tildes
+    data: { text: 'content' }
+    template: '"{{>partial~name}}"'
+    partials: { 'partial~name': '*{{text}}*' }
+    expected: '"*content*"'

For a non-exhaustive reference of research on the subject made by other people:

Until this topic gets some clarification, I believe those tests should be removed from this pull request.

What do you think?

@sartak sartak Spec tests for partial names
    "The tag's content MUST be a non-whitespace character sequence
    NOT containing the current closing delimiter."

    I explicitly excluded tests for period, forward slash, and tilde
    at Gwendal Roué's suggestion.
66a3526
@sartak

Hi Gwendal,

I removed the tests for period, forward slash, and tilde. I don't want this pull request to block on those discussions either, yeah :)

I amended my commit (it's now 66a3526); it looks like github got the metadata on that right.

Cheers,
Shawn

@groue

Cool :-) Now let's wait for @pvande, the repo maintainer. I hope he merges your commit it :)

@devinrhode2

ping @pvande

What do you guys think of moving the mustache spec to be much more like handlebars, but that will of course work server side also?

Also, based on participation, @groue should be allowed as a maintainer for the spec, out of everyone he clearly cares the most about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 5, 2012
  1. @sartak

    Spec tests for partial names

    sartak authored
        "The tag's content MUST be a non-whitespace character sequence
        NOT containing the current closing delimiter."
    
        I explicitly excluded tests for period, forward slash, and tilde
        at Gwendal Roué's suggestion.
This page is out of date. Refresh to see the latest.
Showing with 37 additions and 0 deletions.
  1. +37 −0 specs/partials.yml
View
37 specs/partials.yml
@@ -107,3 +107,40 @@ tests:
template: "|{{> partial }}|"
partials: { partial: "[]" }
expected: '|[]|'
+
+ # Partial name parsing
+ - name: Partial names: numbers
+ desc: Partial names can include numbers
+ data: { text: 'content' }
+ template: '"{{>partial5name}}"'
+ partials: { 'partial5name': '*{{text}}*' }
+ expected: '"*content*"'
+
+ - name: Partial names: hyphen
+ desc: Partial names can include hyphens
+ data: { text: 'content' }
+ template: '"{{>partial-name}}"'
+ partials: { 'partial-name': '*{{text}}*' }
+ expected: '"*content*"'
+
+ - name: Partial names: underscore
+ desc: Partial names can include underscores
+ data: { text: 'content' }
+ template: '"{{>partial_name}}"'
+ partials: { 'partial_name': '*{{text}}*' }
+ expected: '"*content*"'
+
+ - name: Partial names: colon
+ desc: Partial names can include colons
+ data: { text: 'content' }
+ template: '"{{>partial:name}}"'
+ partials: { 'partial:name': '*{{text}}*' }
+ expected: '"*content*"'
+
+ - name: Partial names: caret
+ desc: Partial names can include carets
+ data: { text: 'content' }
+ template: '"{{>partial^name}}"'
+ partials: { 'partial^name': '*{{text}}*' }
+ expected: '"*content*"'
+
Something went wrong with that request. Please try again.