nurugger07 / calliope

An elixir haml parser
Apache License 2.0
198 stars 37 forks source link

Test/cleanup #62

Closed jfeaver closed 8 years ago

jfeaver commented 8 years ago

Some cleanup of tests in the compiler/renderer. I've created an equivalent html assertion (assert_equivalent_html).

The helper can lead to this gotcha with mid-line white space:

html1 = "<h1>Hello</h1>           <p>Elixir is fun</p>"
html2 = "<h1>Hello</h1><p>Elixir is fun</p>"
assert_equivalent_html(html1, html2) #=> test failure

The resulting test failure provides a helpful message though:

  1) test equivalent_html_helper (CalliopeCompilerTest)
     test/calliope/compiler_test.exs:11
     Assertion with == failed
     code: stripped(html1) == stripped(html2)
     lhs:  "<h1>Hello</h1>           <p>Elixir is fun</p>"
     rhs:  "<h1>Hello</h1><p>Elixir is fun</p>"
     stacktrace:
       test/calliope/compiler_test.exs:14
jfeaver commented 8 years ago

Any reason this can't be merged @smpallen99, @nurugger07?

smpallen99 commented 8 years ago

@jfeaver Looks like a good pr. Just need some time to review before I merge. I'll try to get to it in the next couple days. Sorry for the delay getting back to you. For some reason, I missed the notification on this. Just seeing it now for the first time.