# This file contains tests for all known mustache syntax errors and their # desired error messages. Each one is converted into an Odin test. name: Missing 2nd closing brace enable: false # TODO: Re-enable when passing should: error input: | {{> icons/chevron_up} {{#params.social}} {{>* icon}} {{/params.social}}

Proudly built with Thor and :1:1 1 |

2 | {{> icons/chevron_up} | ^^ opened ^ never closed 3 | {{#params.social}} 4 | {{>* icon}} 5 | {{/params.social}} | --- name: Missing 2nd opening brace enable: false # TODO: Re-enable when passing should: error input: | {> icons/chevron_up}} {{#params.social}} {{>* icon}} {{/params.social}}

Proudly built with Thor and :1:1 1 |

2 | {> icons/chevron_up}} | ^ opened ^^ closed 3 | {{#params.social}} 4 | {{>* icon}} 5 | {{/params.social}} | --- # TODO: make it work name: Invalid timezone enable: false should: warn input: | { "date": { "timezone": "America/New_Yorkside" } } expected: "Did you mean 'America/New_York'? pointing to line+col no in the config" actual: | [WARN ] --- [148:init_site()] unable to load timezone 'America/New_Yorkside' --- name: Mismatched section tags enable: false # TODO: Re-enable when passing should: error input: | expected: | Mismatched section: 'ocial' opened, 'social' closed --> :4:5 | 4 | {{#params.ocial}} | ^^^^^ opened — did you mean 'social'? 5 | {{>* icon}} 6 | {{/params.social}} | ^^^^^^ expected {{/params.ocial}}, got {{/params.social}} | --- name: Missing closing section enable: false # TODO: Re-enable when passing should: error input: | expected: | Missing closing tag '{{/params.social}}' --> :4:5 | 4 | {{#params.social}} | ^^^^^^^^^^^^^^^^^ opened 5 | {{>* icon}} 6 | | ^^^^^^^^^^^^^^^^^^ closing tag is commented out | --- name: empty tag enable: true should: error input: | expected: | Empty tag --> :11:28 | 9 | href="https://edwardtufte.github.io/tufte-css/">Tufte CSS 10 |

11 |

© {{}} {{params.author.name}}

| ^^^^ tag must contain a key 12 | | --- name: empty raw tag enable: true should: error input: | Hello, {{&}} expected: | Empty tag --> :1:8 | 1 | Hello, {{&}} | ^^^^^ tag must contain a key | --- name: Missing pipe arguement enable: true should: error input: | expected: | group_by expects 1 argument, got 0 --> :11:36 | 9 | href="https://edwardtufte.github.io/tufte-css/">Tufte CSS 10 |

11 |

© {{now | group_by }} {{params.author.name}}

| ^^^^^^^^ missing argument 12 | | --- name: Double dot access enable: false # TODO: Re-enable when passing should: error input: | expected: | Invalid key path: consecutive dots --> :11:60 | 9 | href="https://edwardtufte.github.io/tufte-css/">Tufte CSS 10 |

11 |

© {{now | format "2006" }} {{params..name}}

| ^^ missing path name 12 | | --- name: Too many opening braces enable: false # TODO: Re-enable when passing should: error input: | expected: | Too many opening braces --> :11:28 | 9 | href="https://edwardtufte.github.io/tufte-css/">Tufte CSS 10 |

11 |

© {{{{now | format "2006" }}} {{params.author.name}}

| ^^^^ expected {{{, got {{{{ 12 | | --- name: Too many closing braces enable: false # TODO: Re-enable when passing should: error input: | expected: | Too many closing braces --> :11:50 | 9 | href="https://edwardtufte.github.io/tufte-css/">Tufte CSS 10 |

11 |

© {{now | format "2006" }}}} {{params.author.name}}

| ^^^^ expected }}, got }}} 12 | | --- # TODO: Implement name: Frontmatter missing closing quote on key enable: false should: warn input: | { "title: Docs" } [TOC] ## Introduction expected: 'TODO:' actual: | [ERROR] --- [42:parse_frontmatter()] failed to parse frontmatter JSON: Expected_Colon_After_Key --- # TODO: Implement name: Fronmatter missing opening quote on value should: warn enable: false input: | { "title": Docs" } [TOC] ## Introduction expected: 'detailed diagnostic pointing to the point of failure and suggesting the addition of a quote' actual: Nothing. The page compiles with no warnings or errors --- name: No error when missing index page enable: false # TODO: Re-enable when passing should: error expected: 'Your site has no index page! Please create an index.md or index.html file in ./content/' --- # FIXME: Doesn't work properly name: format pipe with no date format set enable: false # TODO: Re-enable when passing should: warn input: '{{ now | format }}' expected: | no date format configured — set date.format in thor.json or specify a format, e.g. {{key | format "2 Jan 2006"}} --> :1:10 | 1 | {{now | format}} | ^^^^^^ defaulting to "2 Jan 2006" --- # TODO: called First/last, but only tests first name: first/last with zero argument enable: true should: error input: |
    {{#items | first 0}}
  • {{.}}
  • {{/items}}
expected: | argument must not be zero --> :1:16 | 1 |
    {{#items | first 0}}
  • {{.}}
  • {{/items}}
| ^^^^^^^ | --- # TODO: called First/last, but only tests first name: first/last with negative argument enable: true should: warn input: |
    {{#items | first -3}}
  • {{.}}
  • {{/items}}
expected: | first -3 is equivalent to last 3 --> :1:16 | 1 |
    {{#items | first -3}}
  • {{.}}
  • {{/items}}
| ^^^^^^^^ consider using the clearer form | --- # TODO: called First/last, but only tests first name: first/last on string with no argument # enable: true input: '{{word | first}}' should: warn expected: | defaulting to n=1 for string --> :1:1 | 1 | {{word | first}} | ^^^^^ consider specifying n explicitly | --- name: "first succeeds on params.author.name" enable: true input: '{{ params.author.name | first 3 }}' should: ok expected: "foo" --- # TODO: called First/last, but only tests first # TODO: Include | last 3 }} in the suggestion. name: "first/last in partial" enable: true input: "{{> footer }}" should: warn expected: | first -3 is equivalent to last 3 --> /home/spencer/github.com/sbrow.github.io/thor/mustache/fixtures/layouts/partials/footer.html:11:78 | 9 | href="https://edwardtufte.github.io/tufte-css/">Tufte CSS 10 |

11 |

© {{! now | format "2006" }} {{params.author.name | first -3 }}

| ^^^^^^^^ consider using the clearer form 12 | | --- name: "Pipes are ignored in comments" enable: true should: ok input: 'Hello, {{! now | format "2006" }}' expected: 'Hello, '