# 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: |
Proudly built with Thor and :1:1
1 |
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, '