Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

Commit

Permalink
[eclipse-xtext/xtext#1952] converting test code to java
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Dietrich <[email protected]>
  • Loading branch information
cdietrich committed Apr 16, 2021
1 parent 92c99ef commit 05f080a
Show file tree
Hide file tree
Showing 8 changed files with 1,234 additions and 4,750 deletions.
7 changes: 0 additions & 7 deletions org.eclipse.xtext.xbase.tests/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry including="**/*.java|**/*.xtend" kind="src" output="bin/test" path="xtend-gen">
<attributes>
<attribute name="gradle_scope" value="test"/>
<attribute name="gradle_used_by_scope" value="test,longrunning,suites"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="bin/longrunning" path="longrunning/src">
<attributes>
<attribute name="gradle_scope" value="longrunning"/>
Expand Down
1 change: 0 additions & 1 deletion org.eclipse.xtext.xbase.tests/build.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
source.. = src/,\
xtend-gen/,\
longrunning/src/,\
suites/,\
smoke-suites/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/**
* Copyright (c) 2012, 2021 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.xbase.tests.formatting;

import org.eclipse.xtext.testing.InjectWith;
import org.eclipse.xtext.testing.XtextRunner;
import org.eclipse.xtext.testing.formatter.FormatterTestRequest;
import org.eclipse.xtext.util.Strings;
import org.junit.Test;
import org.junit.runner.RunWith;

import com.google.inject.Inject;

@RunWith(XtextRunner.class)
@InjectWith(XbaseFormatterTestInjectorProvider.class)
public class XbaseCommentFormatterTest {
@Inject
private XbaseFormatterTester xbaseFormatterTester;

@Test
public void commentInIfExpression() {
xbaseFormatterTester.assertFormattedExpression((FormatterTestRequest it) -> {
String model =
"if (true)\n" +
" println(\"foo\")\n" +
"else // if (true)\n" +
" println(\"bar\")\n" +
"println(\"end\")\n";
it.setToBeFormatted(Strings.toPlatformLineSeparator(model));
});
}

@Test
public void commentAfterForExpression1() {
xbaseFormatterTester.assertFormattedExpression((FormatterTestRequest it) -> {
String model =
"for (f : #[])\n" +
" if (1 < 2) {\n" +
" }\n" +
"\n" +
"// foo\n" +
"var lastOffset = \"\"\n";
it.setToBeFormatted(Strings.toPlatformLineSeparator(model));
});
}

@Test
public void commentAfterForExpression3() {
xbaseFormatterTester.assertFormattedExpression((FormatterTestRequest it) -> {
String model = "val ll = #[].map(e|e.toString) // error here\n";
it.setToBeFormatted(Strings.toPlatformLineSeparator(model));
});
}
}

This file was deleted.

Loading

0 comments on commit 05f080a

Please sign in to comment.