diff --git a/DIAGNOSTIC_TODOS.yaml b/DIAGNOSTIC_TODOS.yaml index 9116ca1..9befd7a 100644 --- a/DIAGNOSTIC_TODOS.yaml +++ b/DIAGNOSTIC_TODOS.yaml @@ -1,4 +1,8 @@ +# 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: true +should: error input: | {{> icons/chevron_up} @@ -7,20 +11,20 @@ input: | {{/params.social}}

Proudly built with Thor and /home/spencer/github.com/sbrow.github.io/layouts/partials/footer.html:6:5 +expected: | + Missing closing brace + --> :1:1 + 1 |

+ 2 | {{> icons/chevron_up} + | ^^ opened ^ never closed + 3 | {{#params.social}} + 4 | {{>* icon}} + 5 | {{/params.social}} | - 4 | {{#params.social}} - 5 | {{>* icon}} - 6 | {{/params.social}} - | ^^^^^^^^^^^^^^^^^^ - 7 | - 8 |

Proudly built with Thor and {> icons/chevron_up}} @@ -29,10 +33,21 @@ input: | {{/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": { @@ -44,6 +59,8 @@ actual: | [WARN ] --- [148:init_site()] unable to load timezone 'America/New_Yorkside' --- name: Mismatched section tags +enable: true +should: error input: | -expected: Mostly the same, but with rust style markers at the opening and close -actual: | - [ERROR] --- [383:load_partials()] expected {{/params.ocial}}, got {{/params.social}} - --> /home/spencer/github.com/sbrow.github.io/layouts/partials/footer.html:6:5 +expected: | + Mismatched section: 'ocial' opened, 'social' closed + --> :4:5 | 4 | {{#params.ocial}} + | ^^^^^ opened — did you mean 'social'? 5 | {{>* icon}} 6 | {{/params.social}} - | ^^^^^^^^^^^^^^^^^^ - 7 | - 8 |

Proudly built with Thor and

@@ -83,10 +101,20 @@ input: |

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

-expected: "Missing closing tag '{{/params.social}}' ...opened ... expected close " -actual: Nothing. The page compiles with no warnings or errors +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: "Found an empty tag at " -actual: | - [WARN ] --- [920:warn_unknown_key()] unknown key '' - --> /home/spencer/github.com/sbrow.github.io/layouts/partials/footer.html:1:1 - | - 1 |
- | ^ - 2 | - 3 | {{> icons/chevron_up}} - | +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: Missing pipe arguement +enable: true +should: error input: |
@@ -125,18 +155,20 @@ input: |

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

-expected: "Missing filter argument " -actual: | - [ERROR] --- [152:render_template()] group_by expects 1 argument, got 0 - --> /home/spencer/github.com/sbrow.github.io/layouts/partials/footer.html:1:1 - | - 1 |
- | ^ - 2 | - 3 | {{> icons/chevron_up}} +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: true +should: error input: |
@@ -150,10 +182,20 @@ input: |

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

-expected: Error "Invalid access key" -actual: Nothing. The page compiles with no warnings or errors +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: true +should: error input: |
@@ -167,18 +209,20 @@ input: |

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

-expected: "Too many opening braces " -actual: | - [WARN ] --- [920:warn_unknown_key()] unknown key '{now' - --> /home/spencer/github.com/sbrow.github.io/layouts/partials/footer.html:1:1 - | - 1 |
- | ^ did you mean 'now'? - 2 | - 3 | {{> icons/chevron_up}} - | +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: true +should: error input: |
@@ -192,10 +236,21 @@ input: |

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

-expected: "Too many closing braces " -actual: Nothing. The page compiles with no warnings or errors +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" @@ -208,7 +263,10 @@ 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" @@ -220,48 +278,87 @@ input: | 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. +name: No error when missing index page +enable: true +should: error expected: 'Your site has no index page! Please create an index.md or index.html file in ./content/' -actual: Nothing. The site compiles with no warnings or errors --- +# FIXME: Doesn't work properly name: format pipe with no date format set +enable: true +should: warn +input: '{{ now | format }}' expected: | - Show where the error was triggered. Should also show the format that will be used -actual: | - [ERROR] --- [333:apply_format()] format pipe used but no date format configured (set date.format in thor.json) Default will be used + 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: Error with source location — "argument must not be zero" -actual: | - [ERROR] --- [render_template()] argument must not be zero - --> :: +expected: | + argument must not be zero + --> :1:5 | - N |
    {{#items | first 0}}
  • {{.}}
  • {{/items}}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 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: Warning with source location — "first -3 is equivalent to last 3 — consider using the clearer form" -actual: | - [WARN ] --- [take()] first -3 is equivalent to last 3 - --> :: +expected: | + first -3 is equivalent to last 3 + --> :1:5 | - N |
    {{#items | first -3}}
  • {{.}}
  • {{/items}}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^ consider using the clearer form + 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 -input: | - {{word | first}} -expected: Warning with source location — "defaulting to n=1 for string; consider specifying n explicitly" -actual: | - [WARN ] --- [take()] defaulting to n=1 for string - --> :: +# enable: true +input: '{{word | first}}' +should: warn +expected: | + defaulting to n=1 for string + --> :1:1 | - N | {{word | first}} - | ^^^^^^^^^^^^^^^ consider specifying n explicitly + 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 +name: "first/last in partial" +enable: true +input: "{{> footer }}" +should: error +expected: | + first -3 is equivalent to last 3 + --> /home/spencer/github.com/sbrow.github.io/layouts/partials/footer.html:1:1 + | + 1 |