Skip to content

Instantly share code, notes, and snippets.

@fbiville
Created May 20, 2012 10:14
Show Gist options
  • Select an option

  • Save fbiville/2757562 to your computer and use it in GitHub Desktop.

Select an option

Save fbiville/2757562 to your computer and use it in GitHub Desktop.
Tests of Gist https://t.co/hD8iMBLM
@Test
public void when_plain_text_then_equal_text_returned() {
assertThat(markupKiller.stripTags("10 < 9")).isEqualTo("10 < 9");
}
@Test
public void when_unbalanced_html_then_markup_removed() {
assertThat(markupKiller.stripTags("<b>10 < 9")).isEqualTo("10 < 9");
assertThat(markupKiller.stripTags("<b id='whatever'>10 < 9<img />")).isEqualTo("10 < 9");
}
@Test
public void when_balanced_html_then_markup_removed() {
assertThat(markupKiller.stripTags("<b>10 < 9</b>")).isEqualTo("10 < 9");
assertThat(markupKiller.stripTags("<b id='whatever'>10 < 9")).isEqualTo("10 < 9");
}
@Test
@Ignore("not supported and might be not needed")
public void when_balanced_html_entities_then_markup_removed() {
assertThat(markupKiller.stripTags("&lt;b&gt;10 &lt; 9</b>")).isEqualTo("10 &lt; 9");
assertThat(markupKiller.stripTags("&lt;b id='whatever'&gt;10 &lt; 9")).isEqualTo("10 &lt; 9");
}
@pyricau

pyricau commented May 20, 2012

Copy link
Copy Markdown

Invalid tests are invalid

@fbiville

Copy link
Copy Markdown
Author

use of CDATA would allow 10 < 9 appearance... not critical right now, tho ;)

@pyricau

pyricau commented May 20, 2012

Copy link
Copy Markdown

Use of CDATA requires tests with CDATA :)

@fbiville

Copy link
Copy Markdown
Author

I might consider hiring you. Rephrasing in quantic: YOU ARE HFIRED :P

@pyricau

pyricau commented May 20, 2012

Copy link
Copy Markdown

Incorrect English grammar is incorrect

@fbiville

Copy link
Copy Markdown
Author

Hmm? :P

@pyricau

pyricau commented May 20, 2012

Copy link
Copy Markdown

Edited comments are edited

@pyricau

pyricau commented May 20, 2012

Copy link
Copy Markdown

Not to mention that Git notifications are event based, and contain the original comment :)

@fbiville

Copy link
Copy Markdown
Author

I is the gist owner, I is your dictator.

@pyricau

pyricau commented May 20, 2012

Copy link
Copy Markdown

All your base are belong to GitHub

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment