Commits

Ville Saalo committed 089b4a5

Some tests for turning changeset ids into links.

  • Participants
  • Parent commits 102be9c
  • Branches default

Comments (0)

Files changed (1)

src/com/saibotd/bitbeaker/tests/MarkupHelperTest.java

 				MarkupHelper.decorateCreole("@Test test asd", "", ""));
 	}
 	
+	public void test_decorate_changeset_links() {
+		assertEquals("Basic changeset link at the end of the string test case fails!", 
+				"It was done in <a href=\"https://bitbucket.org/user/repo/changeset/abcd12345\">abcd12345</a>", 
+				MarkupHelper.decorateCreole("It was done in abcd12345", "user", "repo"));
+		
+		assertEquals("Basic changeset link ending in period fails!", 
+				"I dit it in <a href=\"https://bitbucket.org/user/repo/changeset/1234cafe\">1234cafe</a>.", 
+				MarkupHelper.decorateCreole("I dit it in 1234cafe.", "user", "repo"));
+		
+		assertEquals("Basic changeset link in parenthesis fails!", 
+				"The changes (<a href=\"https://bitbucket.org/user/repo/changeset/D3ADB33F\">DEADB33F</a>) are superb!", 
+				MarkupHelper.decorateCreole("The changes (DEADB33F) are superb!", "user", "repo"));
+	}
+	
+	public void test_decorate_changeset_links_not_being_too_aggressive() {
+		assertEquals("The decoration method messed up a link that was already in HTML format!", 
+				"Changeset <a href=\"https://bitbucket.org/user/repo/changeset/abc123def456\">abc123def456</a> rocks!", 
+				MarkupHelper.decorateCreole("Changeset <a href=\"https://bitbucket.org/user/repo/changeset/abc123def456\">abc123def456</a> rocks!", "user", "repo"));
+	}
+	
 	public void test_decorate_email_addresses() {
 		assertEquals("An email address wasn't rendered properly!",
 				"<a href=\"mailto:someone@example.org\">someone@example.org</a>",