From e36c5ac22ce48c386bf76690be38c9d6a939e5da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Galland?= Date: Thu, 6 Apr 2017 18:32:30 +0200 Subject: [PATCH] [ui] Add test on auto-completion after new keyword. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit see #637 Signed-off-by: Stéphane Galland --- .../io/sarl/lang/ui/tests/bugs/Bug637.java | 69 +++++++++++++++++++ .../AbstractContentAssistTest.java | 2 +- 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 tests/io.sarl.lang.ui.tests/src/io/sarl/lang/ui/tests/bugs/Bug637.java diff --git a/tests/io.sarl.lang.ui.tests/src/io/sarl/lang/ui/tests/bugs/Bug637.java b/tests/io.sarl.lang.ui.tests/src/io/sarl/lang/ui/tests/bugs/Bug637.java new file mode 100644 index 0000000000..d94b07bb44 --- /dev/null +++ b/tests/io.sarl.lang.ui.tests/src/io/sarl/lang/ui/tests/bugs/Bug637.java @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2014-2017 the original authors or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.sarl.lang.ui.tests.bugs; + +import org.junit.Test; + +import io.sarl.lang.ui.tests.contentassist.AbstractContentAssistTest; + +/** Issue: Product Panic when auto-completing. + * + * @author $Author: sgalland$ + * @version $FullVersion$ + * @mavengroupid $GroupId$ + * @mavenartifactid $ArtifactId$ + * @see "https://github.com/sarl/sarl/issues/637" + */ +@SuppressWarnings("all") +public class Bug637 extends AbstractContentAssistTest { + + @Override + protected String getPrefix() { + return multilineString( + "package fr.utbm.info.ia51.labwork2.environment", + "", + "import java.lang.ref.WeakReference", + "import fr.utbm.info.ia51.framework.math.Rectangle2f", + "", + "/**", + "* @author apette", + "*", + "*/", + "class TreeNode {", + "", + "val parent : WeakReference", + "", + "var children : TreeNode[]", + "", + "new (parent : TreeNode, box : Rectangle2f)", + "{", + "this.parent = new "); + } + + @Override + protected String getSuffix() { + return multilineString( + "", + "}", + "}" + ); + } + @Test + public void completionAfterNewKeyword() throws Exception { + assertTextInsideProposals(newBuilder(), "TreeNode"); + } + +} diff --git a/tests/io.sarl.lang.ui.tests/src/io/sarl/lang/ui/tests/contentassist/AbstractContentAssistTest.java b/tests/io.sarl.lang.ui.tests/src/io/sarl/lang/ui/tests/contentassist/AbstractContentAssistTest.java index 225f0f865e..f08878417a 100644 --- a/tests/io.sarl.lang.ui.tests/src/io/sarl/lang/ui/tests/contentassist/AbstractContentAssistTest.java +++ b/tests/io.sarl.lang.ui.tests/src/io/sarl/lang/ui/tests/contentassist/AbstractContentAssistTest.java @@ -186,7 +186,7 @@ protected static ContentAssistProcessorTestBuilder assertNoText(ContentAssistPro return builder; } - /** Assert that all the given texts are not in the proposal. + /** Assert that all the given texts are in the proposal. * *

In opposite to {@link ContentAssistProcessorTestBuilder#assertText(String...)}, this function * is not failing if the more text than the given ones are proposed.