mustache / spec

The Mustache spec.
MIT License
371 stars 71 forks source link

Variable test in sections.yml doesn't conform to internal whitespace expectations #117

Closed adam-fowler closed 3 years ago

adam-fowler commented 3 years ago
- name: Variable test
    desc: |
      Non-false sections have their value at the top of context,
      accessible as {{.}} or through the parent context. This gives
      a simple way to display content conditionally if a variable exists.
    data: { foo: "bar" }
    template: '"{{#foo}} {{.}} is {{foo}} {{/foo}}"'
    expected: '"bar is bar"'

Should expected not be '" bar is bar "' ie with whitespace surrounding the "bar is bar" text, or am I missing something

gasche commented 3 years ago

Indeed! This is a mistake that was recently introduced in the spec (#114), and I'm the author of the faulty test; apologies for the trouble.

The template should be {{#foo}}{{.}} is {{foo}}{{/foo}}. Would you be willing to submit a fix?

I was confident I had run the tests by a Mustache implementation to check that they were sane, but apparently I made a mistake when later modifying the tests for readability. It would be nice to have some sort of continuous integration where we check proposed changes to the spec against an existing implementation, to catch this kind of dumb mistakes.

adam-fowler commented 3 years ago

118

jgonggrijp commented 3 years ago

@gasche

I was confident I had run the tests by a Mustache implementation to check that they were sane, but apparently I made a mistake when later modifying the tests for readability. It would be nice to have some sort of continuous integration where we check proposed changes to the spec against an existing implementation, to catch this kind of dumb mistakes.

I could contribute a CI with tests against several major implementations (say about three) using GitLab or Travis, somewhere in the upcoming weeks. (I know that GitHub Actions is in fashion these days, but I personally don't like it, so if you believe that it should be Actions, I suggest that somebody else do it.)

gasche commented 3 years ago

I'm no maintainer, but I think the CI you propose would be very nice. (If someone wants to use Github actions, it's easier for them to port you check than starting from nothing.)

jgonggrijp commented 3 years ago

Oh, I thought you were. Who should I mention when I want to address the maintainers?

gasche commented 3 years ago

@spullara and @Danappelxx are the new maintainers of this repository.

Danappelxx commented 3 years ago

I could contribute a CI with tests against several major implementations (say about three) using GitLab or Travis, somewhere in the upcoming weeks. (I know that GitHub Actions is in fashion these days, but I personally don't like it, so if you believe that it should be Actions, I suggest that somebody else do it.)

This sounds super useful! I'm sure we'd fit under Travis's free for open source plan. If you want to give it a shot, would be very appreciated.