summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Aubry2012-07-23 12:18:53 (EDT)
committer sbernard2012-07-24 08:41:01 (EDT)
commitcdf80b0ed60f508f39c29b91dca12ea82fc54dbf (patch)
tree51f906ad27484fffc8abad9143590f5a2131a2db
parentbc1be7045c5a4cde38a1dfd24ee0fbb1b9e2f676 (diff)
downloadorg.eclipse.koneki.ldt-cdf80b0ed60f508f39c29b91dca12ea82fc54dbf.zip
org.eclipse.koneki.ldt-cdf80b0ed60f508f39c29b91dca12ea82fc54dbf.tar.gz
org.eclipse.koneki.ldt-cdf80b0ed60f508f39c29b91dca12ea82fc54dbf.tar.bz2
Adding a test for autoedit feature
-rw-r--r--tests/org.eclipse.koneki.ldt.ui.tests/src/org/eclipse/koneki/ldt/ui/tests/internal/autoedit/LuaDocumentorCommentAutoEditStrategyTest.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/org.eclipse.koneki.ldt.ui.tests/src/org/eclipse/koneki/ldt/ui/tests/internal/autoedit/LuaDocumentorCommentAutoEditStrategyTest.java b/tests/org.eclipse.koneki.ldt.ui.tests/src/org/eclipse/koneki/ldt/ui/tests/internal/autoedit/LuaDocumentorCommentAutoEditStrategyTest.java
index 2719a99..90c9d5c 100644
--- a/tests/org.eclipse.koneki.ldt.ui.tests/src/org/eclipse/koneki/ldt/ui/tests/internal/autoedit/LuaDocumentorCommentAutoEditStrategyTest.java
+++ b/tests/org.eclipse.koneki.ldt.ui.tests/src/org/eclipse/koneki/ldt/ui/tests/internal/autoedit/LuaDocumentorCommentAutoEditStrategyTest.java
@@ -171,6 +171,19 @@ public class LuaDocumentorCommentAutoEditStrategyTest extends TestCase {
assertEquals(expected.toString(), document.get());
}
+ public void testNotOverwrittingComment() throws BadLocationException {
+ StringBuffer code = new StringBuffer();
+ code.append("--" + ENTER); //$NON-NLS-1$
+ code.append("local v = 123"); //$NON-NLS-1$
+ final IDocument document = createDocument(code.toString());
+ execute(document, createCommand(ENTER, getEndOfLineOffset(document, 0)));
+ StringBuffer expected = new StringBuffer();
+ expected.append("--" + ENTER); //$NON-NLS-1$
+ expected.append("--" + ENTER); //$NON-NLS-1$
+ expected.append("local v = 123"); //$NON-NLS-1$
+ assertEquals(expected.toString(), document.get());
+ }
+
private static int getEndOfLineOffset(IDocument d, int line) throws BadLocationException {
IRegion line1 = d.getLineInformation(line);
return line1.getOffset() + line1.getLength();