noahmorrison / chevron

A Python implementation of mustache
MIT License
486 stars 52 forks source link

test incorrect #74

Closed RekGRpth closed 3 years ago

RekGRpth commented 4 years ago
print(args['template'].encode('utf-8'))
b'{{# comments }}\n<div class=comment>\n    <span class=user>{{ user }}</span>\n    <span class=body>{{ body }}</span>\n    <span class=vote>{{ vote }}</span>\n</div>\n{{/ comments }}\n'

\n before <div and afer </div> !!! but You expect only ONE \n between div !!!

print(args['expected'].encode('utf-8'))
b"<div class=comment>\n    <span class=user>tommy</span>\n    <span class=body>If this gets to the front page I'll eat my hat!</span>\n    <span class=vote>625</span>\n</div>\n<div class=comment>\n    <span class=user>trololol</span>\n    <span class=body>this</span>\n    <span class=vote>-142</span>\n</div>\n<div class=comment>\n    <span class=user>mctom</span>\n    <span class=body>I wish thinking of test phrases was easier</span>\n    <span class=vote>83</span>\n</div>\n<div class=comment>\n    <span class=user>the_thinker</span>\n    <span class=body>Why is /u/trololol's post higher than ours?</span>\n    <span class=vote>36</span>\n</div>\n"
dmorrison42 commented 3 years ago

It looks like that example is from the benchmarks, and is a little lengthy and hard to read so if I'm misunderstanding please feel free to clarify with a small simple example.

The mustache spec states that "standalone lines should be removed from the template".

I believe the newlines that are referenced in the issue are standalone lines for prettier printing.

Again, if I just misunderstood please feel free to reopen the issue with a simplified example.

noahmorrison commented 3 years ago

@RekGRpth I'm going to close this for now, but if you give an example that's a little clearer I'll open it back up and try to help you out. :)