blob: 9d8fdf320128072b4b60e5fd2d30b9f5d9c67d65 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
/*******************************************************************************
* Copyright (c) 2004, 2008 Eugene Kuleshov and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Eugene Kuleshov - initial API and implementation
* Tasktop Technologies - improvements
*******************************************************************************/
package org.eclipse.mylyn.tasks.tests;
import junit.framework.TestCase;
import org.eclipse.mylyn.internal.tasks.ui.notifications.TaskDiffUtil;
/**
* @author Eugene Kuleshov
* @author Steffen Pingel
*/
public class TaskDiffUtilTest extends TestCase {
public void testFoldSpaces() {
assertEquals("a b", TaskDiffUtil.foldSpaces("a b"));
assertEquals("", TaskDiffUtil.foldSpaces(" "));
assertEquals("a b c d", TaskDiffUtil.cleanCommentText("a b c d"));
assertEquals("b", TaskDiffUtil.cleanCommentText(" b "));
assertEquals("b", TaskDiffUtil.cleanCommentText(" b"));
}
public void testCleanComment() {
assertEquals("attachment: some attachment. attachment description",
TaskDiffUtil.cleanCommentText(("Created an attachment (id=111)\n" //
+ "some attachment\n" //
+ "\n" //
+ "attachment description")));
assertEquals("attachment: some attachment", TaskDiffUtil.cleanCommentText(("Created an attachment (id=111)\n" //
+ "some attachment\n" //
+ "\n")));
assertEquals("some comment", TaskDiffUtil.cleanCommentText(("(In reply to comment #11)\n" //
+ "some comment\n")));
assertEquals("some comment. other comment", TaskDiffUtil.cleanCommentText((" (In reply to comment #11)\n" //
+ "some comment\n" //
+ "\n" //
+ " (In reply to comment #12)\n" //
+ "other comment\n")));
assertEquals("some comment. other comment", TaskDiffUtil.cleanCommentText((" (In reply to comment #11)\n" //
+ "some comment. \n" //
+ "\n" //
+ " (In reply to comment #12)\n" //
+ "> loren ipsum\n" + "> loren ipsum\n" + "other comment\n")));
}
}
|