diff --git a/org.eclipse.xtext.tests/src/org/eclipse/xtext/enumrules/MultiRuleEnumTest.xtend b/org.eclipse.xtext.tests/src/org/eclipse/xtext/enumrules/MultiRuleEnumTest.java similarity index 52% rename from org.eclipse.xtext.tests/src/org/eclipse/xtext/enumrules/MultiRuleEnumTest.xtend rename to org.eclipse.xtext.tests/src/org/eclipse/xtext/enumrules/MultiRuleEnumTest.java index 88814f93e..5a63cded7 100644 --- a/org.eclipse.xtext.tests/src/org/eclipse/xtext/enumrules/MultiRuleEnumTest.xtend +++ b/org.eclipse.xtext.tests/src/org/eclipse/xtext/enumrules/MultiRuleEnumTest.java @@ -1,31 +1,31 @@ /******************************************************************************* - * Copyright (c) 2013 itemis AG (http://www.itemis.eu) and others. + * Copyright (c) 2013, 2020 itemis AG (http://www.itemis.eu) and others. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0. * * SPDX-License-Identifier: EPL-2.0 *******************************************************************************/ -package org.eclipse.xtext.enumrules +package org.eclipse.xtext.enumrules; -import org.eclipse.xtext.enumrules.multiRuleenums.MyEnum -import org.junit.Test +import org.eclipse.xtext.enumrules.multiRuleenums.MyEnum; +import org.junit.Test; -import static org.junit.Assert.* +import static org.junit.Assert.*; /** * @author Sven Efftinge - Initial contribution and API */ -class MultiRuleEnumTest { +public class MultiRuleEnumTest { /** * see https://bugs.eclipse.org/bugs/show_bug.cgi?id=413395 */ - @Test def void testEnumOrder() { - assertEquals(0, MyEnum.A_VALUE) - assertEquals(1, MyEnum.B_VALUE) - assertEquals(2, MyEnum.C_VALUE) - assertEquals(3, MyEnum.D_VALUE) - assertEquals(4, MyEnum.E_VALUE) + @Test public void testEnumOrder() { + assertEquals(0, MyEnum.A_VALUE); + assertEquals(1, MyEnum.B_VALUE); + assertEquals(2, MyEnum.C_VALUE); + assertEquals(3, MyEnum.D_VALUE); + assertEquals(4, MyEnum.E_VALUE); } -} \ No newline at end of file +} diff --git a/org.eclipse.xtext.tests/src/org/eclipse/xtext/formatting2/debug/TextRegionsToStringTest.xtend b/org.eclipse.xtext.tests/src/org/eclipse/xtext/formatting2/debug/TextRegionsToStringTest.java similarity index 63% rename from org.eclipse.xtext.tests/src/org/eclipse/xtext/formatting2/debug/TextRegionsToStringTest.xtend rename to org.eclipse.xtext.tests/src/org/eclipse/xtext/formatting2/debug/TextRegionsToStringTest.java index b1ff77319..db092eabb 100644 --- a/org.eclipse.xtext.tests/src/org/eclipse/xtext/formatting2/debug/TextRegionsToStringTest.xtend +++ b/org.eclipse.xtext.tests/src/org/eclipse/xtext/formatting2/debug/TextRegionsToStringTest.java @@ -1,50 +1,50 @@ /******************************************************************************* - * Copyright (c) 2017 itemis AG (http://www.itemis.eu) and others. + * Copyright (c) 2017, 2020 itemis AG (http://www.itemis.eu) and others. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0. * * SPDX-License-Identifier: EPL-2.0 *******************************************************************************/ -package org.eclipse.xtext.formatting2.debug +package org.eclipse.xtext.formatting2.debug; -import org.junit.Before -import org.junit.Test +import org.junit.Before; +import org.junit.Test; import static org.junit.Assert.*; /** * @author Florian Stolte - Initial contribution and API */ -class TextRegionsToStringTest { +public class TextRegionsToStringTest { TextRegionsToString textRegionsToString; @Before - def void init() { - textRegionsToString = new TextRegionsToString - textRegionsToString.ignoreCarriageReturnInQuotes = true + public void init() { + textRegionsToString = new TextRegionsToString(); + textRegionsToString.setIgnoreCarriageReturnInQuotes(true); } @Test - def testQuote() { + public void testQuote() { // insert quotes - assertEquals("\"import some.thing\"", textRegionsToString.quote("import some.thing", 30)) - assertEquals("\"import some.thing\"", textRegionsToString.quote("import some.thing", 17)) + assertEquals("\"import some.thing\"", textRegionsToString.quote("import some.thing", 30)); + assertEquals("\"import some.thing\"", textRegionsToString.quote("import some.thing", 17)); // shorten result - assertEquals("\"import ...\"", textRegionsToString.quote("import some.thing", 10)) - assertEquals("\"import some.t...\"", textRegionsToString.quote("import some.thing", 16)) + assertEquals("\"import ...\"", textRegionsToString.quote("import some.thing", 10)); + assertEquals("\"import some.t...\"", textRegionsToString.quote("import some.thing", 16)); // remove windows line endings - assertEquals("\"\\nimport some.thing\\n\"", textRegionsToString.quote("\r\nimport some.thing\r\n", 30)) - assertEquals("\"\\nimport some.thing\\n\"", textRegionsToString.quote("\r\nimport some.thing\r\n", 19)) + assertEquals("\"\\nimport some.thing\\n\"", textRegionsToString.quote("\r\nimport some.thing\r\n", 30)); + assertEquals("\"\\nimport some.thing\\n\"", textRegionsToString.quote("\r\nimport some.thing\r\n", 19)); // remove windows line endings and shorten - assertEquals("\"\\nimport...\"", textRegionsToString.quote("\r\nimport some.thing\r\n", 10)) - assertEquals("\"\\nimport some.th...\"", textRegionsToString.quote("\r\nimport some.thing\r\n", 18)) + assertEquals("\"\\nimport...\"", textRegionsToString.quote("\r\nimport some.thing\r\n", 10)); + assertEquals("\"\\nimport some.th...\"", textRegionsToString.quote("\r\nimport some.thing\r\n", 18)); // keep windows line endings - textRegionsToString.ignoreCarriageReturnInQuotes = false - assertEquals("\"\\r\\nimport some.thing\\r\\n\"", textRegionsToString.quote("\r\nimport some.thing\r\n", 30)) + textRegionsToString.setIgnoreCarriageReturnInQuotes(false); + assertEquals("\"\\r\\nimport some.thing\\r\\n\"", textRegionsToString.quote("\r\nimport some.thing\r\n", 30)); } -} \ No newline at end of file +} diff --git a/org.eclipse.xtext.tests/src/org/eclipse/xtext/index/IndexTestLanguageInjectorProvider.java b/org.eclipse.xtext.tests/src/org/eclipse/xtext/index/IndexTestLanguageInjectorProvider.java new file mode 100644 index 000000000..d4e37a3ee --- /dev/null +++ b/org.eclipse.xtext.tests/src/org/eclipse/xtext/index/IndexTestLanguageInjectorProvider.java @@ -0,0 +1,55 @@ +/** + * Copyright (c) 2015, 2020 itemis AG (http://www.itemis.eu) and others. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.eclipse.xtext.index; + +import org.eclipse.xtext.testing.GlobalRegistries; +import org.eclipse.xtext.testing.IInjectorProvider; +import org.eclipse.xtext.testing.IRegistryConfigurator; + +import com.google.inject.Injector; + +/** + * @author Sven Efftinge - Initial contribution and API + */ +public class IndexTestLanguageInjectorProvider implements IInjectorProvider, IRegistryConfigurator { + protected GlobalRegistries.GlobalStateMemento stateBeforeInjectorCreation; + + protected GlobalRegistries.GlobalStateMemento stateAfterInjectorCreation; + + protected Injector injector; + + public IndexTestLanguageInjectorProvider() { + GlobalRegistries.initializeDefaults(); + } + + @Override + public Injector getInjector() { + if (injector == null) { + stateBeforeInjectorCreation = GlobalRegistries.makeCopyOfGlobalState(); + injector = internalCreateInjector(); + stateAfterInjectorCreation = GlobalRegistries.makeCopyOfGlobalState(); + } + return this.injector; + } + + protected Injector internalCreateInjector() { + return new IndexTestLanguageStandaloneSetup().createInjectorAndDoEMFRegistration(); + } + + @Override + public void restoreRegistry() { + stateBeforeInjectorCreation.restoreGlobalState(); + } + + @Override + public void setupRegistry() { + getInjector(); + stateAfterInjectorCreation.restoreGlobalState(); + } +} diff --git a/org.eclipse.xtext.tests/src/org/eclipse/xtext/index/IndexTestLanguageInjectorProvider.xtend b/org.eclipse.xtext.tests/src/org/eclipse/xtext/index/IndexTestLanguageInjectorProvider.xtend deleted file mode 100644 index 0b30e72ad..000000000 --- a/org.eclipse.xtext.tests/src/org/eclipse/xtext/index/IndexTestLanguageInjectorProvider.xtend +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 itemis AG (http://www.itemis.eu) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.xtext.index - -import com.google.inject.Injector -import org.eclipse.xtext.testing.GlobalRegistries -import org.eclipse.xtext.testing.GlobalRegistries.GlobalStateMemento -import org.eclipse.xtext.testing.IInjectorProvider -import org.eclipse.xtext.testing.IRegistryConfigurator - -/** - * @author Sven Efftinge - Initial contribution and API - */ -class IndexTestLanguageInjectorProvider implements IInjectorProvider, IRegistryConfigurator { - - protected GlobalStateMemento stateBeforeInjectorCreation - protected GlobalStateMemento stateAfterInjectorCreation - protected Injector injector - - new() { - GlobalRegistries.initializeDefaults() - } - - override Injector getInjector() { - if (injector === null) { - stateBeforeInjectorCreation = GlobalRegistries.makeCopyOfGlobalState() - this.injector = internalCreateInjector() - stateAfterInjectorCreation = GlobalRegistries.makeCopyOfGlobalState() - } - return injector - } - - def protected Injector internalCreateInjector() { - new IndexTestLanguageStandaloneSetup().createInjectorAndDoEMFRegistration() - } - - override void restoreRegistry() { - stateBeforeInjectorCreation.restoreGlobalState() - } - - override void setupRegistry() { - getInjector() - stateAfterInjectorCreation.restoreGlobalState() - } - -} \ No newline at end of file diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/parser/indentation/IndentationAwareLanguageSuite.java b/org.eclipse.xtext.tests/src/org/eclipse/xtext/parser/indentation/IndentationAwareLanguageSuite.java similarity index 69% rename from org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/parser/indentation/IndentationAwareLanguageSuite.java rename to org.eclipse.xtext.tests/src/org/eclipse/xtext/parser/indentation/IndentationAwareLanguageSuite.java index 27b04c0c8..a33216b53 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/parser/indentation/IndentationAwareLanguageSuite.java +++ b/org.eclipse.xtext.tests/src/org/eclipse/xtext/parser/indentation/IndentationAwareLanguageSuite.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2015, 2017 itemis AG (http://www.itemis.eu) and others. + * Copyright (c) 2015, 2020 itemis AG (http://www.itemis.eu) and others. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0. @@ -8,13 +8,10 @@ */ package org.eclipse.xtext.parser.indentation; -import org.eclipse.xtext.parser.indentation.IndentationAwareLanguageTest; -import org.eclipse.xtext.parser.indentation.NodeModelTest; import org.junit.runner.RunWith; import org.junit.runners.Suite; @RunWith(Suite.class) @Suite.SuiteClasses({ IndentationAwareLanguageTest.class, NodeModelTest.class }) -@SuppressWarnings("all") public class IndentationAwareLanguageSuite { } diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/parser/indentation/IndentationAwarePartialParsingTests.java b/org.eclipse.xtext.tests/src/org/eclipse/xtext/parser/indentation/IndentationAwarePartialParsingTests.java similarity index 90% rename from org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/parser/indentation/IndentationAwarePartialParsingTests.java rename to org.eclipse.xtext.tests/src/org/eclipse/xtext/parser/indentation/IndentationAwarePartialParsingTests.java index d0f964cd0..d258a17f0 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/parser/indentation/IndentationAwarePartialParsingTests.java +++ b/org.eclipse.xtext.tests/src/org/eclipse/xtext/parser/indentation/IndentationAwarePartialParsingTests.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2015, 2017 itemis AG (http://www.itemis.eu) and others. + * Copyright (c) 2015, 2020 itemis AG (http://www.itemis.eu) and others. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0. @@ -19,6 +19,5 @@ import org.junit.runner.RunWith; */ @RunWith(XtextSmokeTestRunner.class) @ProcessedBy(value = PartialParsingProcessor.class, processInParallel = true) -@SuppressWarnings("all") public class IndentationAwarePartialParsingTests extends IndentationAwareLanguageSuite { } diff --git a/org.eclipse.xtext.tests/src/org/eclipse/xtext/parser/indentation/IndentationAwarePartialParsingTests.xtend b/org.eclipse.xtext.tests/src/org/eclipse/xtext/parser/indentation/IndentationAwarePartialParsingTests.xtend deleted file mode 100644 index f4ab8aa10..000000000 --- a/org.eclipse.xtext.tests/src/org/eclipse/xtext/parser/indentation/IndentationAwarePartialParsingTests.xtend +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015, 2017 itemis AG (http://www.itemis.eu) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.xtext.parser.indentation - -import org.eclipse.xtext.testing.smoketest.ProcessedBy -import org.eclipse.xtext.testing.smoketest.XtextSmokeTestRunner -import org.eclipse.xtext.testing.smoketest.processors.PartialParsingProcessor -import org.junit.runner.RunWith -import org.junit.runners.Suite.SuiteClasses -import org.junit.runners.Suite - -/** - * @author Sebastian Zarnekow - Initial contribution and API - */ -@RunWith(XtextSmokeTestRunner) -@ProcessedBy(value = PartialParsingProcessor, processInParallel = true) -class IndentationAwarePartialParsingTests extends IndentationAwareLanguageSuite { -} - -@RunWith(Suite) -@SuiteClasses(IndentationAwareLanguageTest, NodeModelTest) -class IndentationAwareLanguageSuite { -} diff --git a/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/UriUtilTest.java b/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/UriUtilTest.java new file mode 100644 index 000000000..6a6f6c202 --- /dev/null +++ b/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/UriUtilTest.java @@ -0,0 +1,53 @@ +/******************************************************************************* + * Copyright (c) 2015, 2020 itemis AG (http://www.itemis.eu) and others. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + *******************************************************************************/ +package org.eclipse.xtext.util; + +import java.io.File; +import org.eclipse.emf.common.util.URI; +import org.junit.Test; + +import static org.junit.Assert.*; + +public class UriUtilTest { + @Test + public void testPrefix() { + URI prefix = URI.createURI("file:/foo/"); + URI uri = URI.createURI("file:/foo/bar"); + assertTrue(UriUtil.isPrefixOf(prefix, uri)); + } + + @Test + public void testPrefixRequiresSameScheme() { + URI prefix = URI.createURI("platform:/foo/"); + URI uri = URI.createURI("file:/foo/bar"); + assertFalse(UriUtil.isPrefixOf(prefix, uri)); + } + + @Test + public void testPrefixRequiresTrailingSeparator() { + URI prefix = URI.createURI("file:/foo"); + URI uri = URI.createURI("file:/foo/bar"); + assertFalse(UriUtil.isPrefixOf(prefix, uri)); + } + + @Test + public void testPrefixRequiresSegmentsToMatch() { + URI prefix = URI.createURI("file:/foo"); + URI uri = URI.createURI("file:/buzz/bar"); + assertFalse(UriUtil.isPrefixOf(prefix, uri)); + } + + @Test + public void testFolderUriHasTrailingSeparator() { + File folder = new File("."); + URI uri = UriUtil.createFolderURI(folder); + assertTrue(uri.hasTrailingPathSeparator()); + assertEquals(".", uri.segment(uri.segmentCount() - 2)); + } +} diff --git a/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/UriUtilTest.xtend b/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/UriUtilTest.xtend deleted file mode 100644 index f895ab866..000000000 --- a/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/UriUtilTest.xtend +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 itemis AG (http://www.itemis.eu) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.xtext.util - -import java.io.File -import org.eclipse.emf.common.util.URI -import org.junit.Test - -import static org.junit.Assert.* - -import static extension org.eclipse.xtext.util.UriUtil.* - -class UriUtilTest { - @Test - def void testPrefix() { - val prefix = URI.createURI("file:/foo/") - val uri = URI.createURI("file:/foo/bar") - assertTrue(prefix.isPrefixOf(uri)) - } - - @Test - def void testPrefixRequiresSameScheme() { - val prefix = URI.createURI("platform:/foo/") - val uri = URI.createURI("file:/foo/bar") - assertFalse(prefix.isPrefixOf(uri)) - } - - @Test - def void testPrefixRequiresTrailingSeparator() { - val prefix = URI.createURI("file:/foo") - val uri = URI.createURI("file:/foo/bar") - assertFalse(prefix.isPrefixOf(uri)) - } - - @Test - def void testPrefixRequiresSegmentsToMatch() { - val prefix = URI.createURI("file:/foo") - val uri = URI.createURI("file:/buzz/bar") - assertFalse(prefix.isPrefixOf(uri)) - } - - @Test - def void testFolderUriHasTrailingSeparator() { - val folder = new File(".") - val uri = folder.createFolderURI - assertTrue(uri.hasTrailingPathSeparator) - assertEquals(".", uri.segment(uri.segmentCount - 2)) - } -} \ No newline at end of file diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/enumrules/MultiRuleEnumTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/enumrules/MultiRuleEnumTest.java deleted file mode 100644 index d367b2e9d..000000000 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/enumrules/MultiRuleEnumTest.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) 2013 itemis AG (http://www.itemis.eu) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.xtext.enumrules; - -import org.eclipse.xtext.enumrules.multiRuleenums.MyEnum; -import org.junit.Assert; -import org.junit.Test; - -/** - * @author Sven Efftinge - Initial contribution and API - */ -@SuppressWarnings("all") -public class MultiRuleEnumTest { - /** - * see https://bugs.eclipse.org/bugs/show_bug.cgi?id=413395 - */ - @Test - public void testEnumOrder() { - Assert.assertEquals(0, MyEnum.A_VALUE); - Assert.assertEquals(1, MyEnum.B_VALUE); - Assert.assertEquals(2, MyEnum.C_VALUE); - Assert.assertEquals(3, MyEnum.D_VALUE); - Assert.assertEquals(4, MyEnum.E_VALUE); - } -} diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/formatting2/debug/TextRegionsToStringTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/formatting2/debug/TextRegionsToStringTest.java deleted file mode 100644 index c92cd3820..000000000 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/formatting2/debug/TextRegionsToStringTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright (c) 2017 itemis AG (http://www.itemis.eu) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.xtext.formatting2.debug; - -import org.eclipse.xtext.formatting2.debug.TextRegionsToString; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -/** - * @author Florian Stolte - Initial contribution and API - */ -@SuppressWarnings("all") -public class TextRegionsToStringTest { - private TextRegionsToString textRegionsToString; - - @Before - public void init() { - TextRegionsToString _textRegionsToString = new TextRegionsToString(); - this.textRegionsToString = _textRegionsToString; - this.textRegionsToString.setIgnoreCarriageReturnInQuotes(true); - } - - @Test - public void testQuote() { - Assert.assertEquals("\"import some.thing\"", this.textRegionsToString.quote("import some.thing", 30)); - Assert.assertEquals("\"import some.thing\"", this.textRegionsToString.quote("import some.thing", 17)); - Assert.assertEquals("\"import ...\"", this.textRegionsToString.quote("import some.thing", 10)); - Assert.assertEquals("\"import some.t...\"", this.textRegionsToString.quote("import some.thing", 16)); - Assert.assertEquals("\"\\nimport some.thing\\n\"", this.textRegionsToString.quote("\r\nimport some.thing\r\n", 30)); - Assert.assertEquals("\"\\nimport some.thing\\n\"", this.textRegionsToString.quote("\r\nimport some.thing\r\n", 19)); - Assert.assertEquals("\"\\nimport...\"", this.textRegionsToString.quote("\r\nimport some.thing\r\n", 10)); - Assert.assertEquals("\"\\nimport some.th...\"", this.textRegionsToString.quote("\r\nimport some.thing\r\n", 18)); - this.textRegionsToString.setIgnoreCarriageReturnInQuotes(false); - Assert.assertEquals("\"\\r\\nimport some.thing\\r\\n\"", this.textRegionsToString.quote("\r\nimport some.thing\r\n", 30)); - } -} diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/index/IndexTestLanguageInjectorProvider.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/index/IndexTestLanguageInjectorProvider.java deleted file mode 100644 index fab894411..000000000 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/index/IndexTestLanguageInjectorProvider.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Copyright (c) 2015 itemis AG (http://www.itemis.eu) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.xtext.index; - -import com.google.inject.Injector; -import org.eclipse.xtext.index.IndexTestLanguageStandaloneSetup; -import org.eclipse.xtext.testing.GlobalRegistries; -import org.eclipse.xtext.testing.IInjectorProvider; -import org.eclipse.xtext.testing.IRegistryConfigurator; - -/** - * @author Sven Efftinge - Initial contribution and API - */ -@SuppressWarnings("all") -public class IndexTestLanguageInjectorProvider implements IInjectorProvider, IRegistryConfigurator { - protected GlobalRegistries.GlobalStateMemento stateBeforeInjectorCreation; - - protected GlobalRegistries.GlobalStateMemento stateAfterInjectorCreation; - - protected Injector injector; - - public IndexTestLanguageInjectorProvider() { - GlobalRegistries.initializeDefaults(); - } - - @Override - public Injector getInjector() { - if ((this.injector == null)) { - this.stateBeforeInjectorCreation = GlobalRegistries.makeCopyOfGlobalState(); - this.injector = this.internalCreateInjector(); - this.stateAfterInjectorCreation = GlobalRegistries.makeCopyOfGlobalState(); - } - return this.injector; - } - - protected Injector internalCreateInjector() { - return new IndexTestLanguageStandaloneSetup().createInjectorAndDoEMFRegistration(); - } - - @Override - public void restoreRegistry() { - this.stateBeforeInjectorCreation.restoreGlobalState(); - } - - @Override - public void setupRegistry() { - this.getInjector(); - this.stateAfterInjectorCreation.restoreGlobalState(); - } -} diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/util/UriUtilTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/util/UriUtilTest.java deleted file mode 100644 index 477633a24..000000000 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/util/UriUtilTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Copyright (c) 2015 itemis AG (http://www.itemis.eu) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.xtext.util; - -import java.io.File; -import org.eclipse.emf.common.util.URI; -import org.eclipse.xtext.util.UriUtil; -import org.junit.Assert; -import org.junit.Test; - -@SuppressWarnings("all") -public class UriUtilTest { - @Test - public void testPrefix() { - final URI prefix = URI.createURI("file:/foo/"); - final URI uri = URI.createURI("file:/foo/bar"); - Assert.assertTrue(UriUtil.isPrefixOf(prefix, uri)); - } - - @Test - public void testPrefixRequiresSameScheme() { - final URI prefix = URI.createURI("platform:/foo/"); - final URI uri = URI.createURI("file:/foo/bar"); - Assert.assertFalse(UriUtil.isPrefixOf(prefix, uri)); - } - - @Test - public void testPrefixRequiresTrailingSeparator() { - final URI prefix = URI.createURI("file:/foo"); - final URI uri = URI.createURI("file:/foo/bar"); - Assert.assertFalse(UriUtil.isPrefixOf(prefix, uri)); - } - - @Test - public void testPrefixRequiresSegmentsToMatch() { - final URI prefix = URI.createURI("file:/foo"); - final URI uri = URI.createURI("file:/buzz/bar"); - Assert.assertFalse(UriUtil.isPrefixOf(prefix, uri)); - } - - @Test - public void testFolderUriHasTrailingSeparator() { - final File folder = new File("."); - final URI uri = UriUtil.createFolderURI(folder); - Assert.assertTrue(uri.hasTrailingPathSeparator()); - int _segmentCount = uri.segmentCount(); - int _minus = (_segmentCount - 2); - Assert.assertEquals(".", uri.segment(_minus)); - } -}