48 lines
1.6 KiB
Java
48 lines
1.6 KiB
Java
|
/**
|
||
|
* generated by Xtext 2.23.0
|
||
|
*/
|
||
|
package xtext.tests;
|
||
|
|
||
|
import com.google.inject.Inject;
|
||
|
import org.eclipse.emf.common.util.EList;
|
||
|
import org.eclipse.emf.ecore.resource.Resource;
|
||
|
import org.eclipse.xtend2.lib.StringConcatenation;
|
||
|
import org.eclipse.xtext.testing.InjectWith;
|
||
|
import org.eclipse.xtext.testing.extensions.InjectionExtension;
|
||
|
import org.eclipse.xtext.testing.util.ParseHelper;
|
||
|
import org.eclipse.xtext.xbase.lib.Exceptions;
|
||
|
import org.eclipse.xtext.xbase.lib.IterableExtensions;
|
||
|
import org.junit.jupiter.api.Assertions;
|
||
|
import org.junit.jupiter.api.Test;
|
||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||
|
import xtext.game.Jeu;
|
||
|
import xtext.tests.GameInjectorProvider;
|
||
|
|
||
|
@ExtendWith(InjectionExtension.class)
|
||
|
@InjectWith(GameInjectorProvider.class)
|
||
|
@SuppressWarnings("all")
|
||
|
public class GameParsingTest {
|
||
|
@Inject
|
||
|
private ParseHelper<Jeu> parseHelper;
|
||
|
|
||
|
@Test
|
||
|
public void loadModel() {
|
||
|
try {
|
||
|
StringConcatenation _builder = new StringConcatenation();
|
||
|
_builder.append("Hello Xtext!");
|
||
|
_builder.newLine();
|
||
|
final Jeu result = this.parseHelper.parse(_builder);
|
||
|
Assertions.assertNotNull(result);
|
||
|
final EList<Resource.Diagnostic> errors = result.eResource().getErrors();
|
||
|
boolean _isEmpty = errors.isEmpty();
|
||
|
StringConcatenation _builder_1 = new StringConcatenation();
|
||
|
_builder_1.append("Unexpected errors: ");
|
||
|
String _join = IterableExtensions.join(errors, ", ");
|
||
|
_builder_1.append(_join);
|
||
|
Assertions.assertTrue(_isEmpty, _builder_1.toString());
|
||
|
} catch (Throwable _e) {
|
||
|
throw Exceptions.sneakyThrow(_e);
|
||
|
}
|
||
|
}
|
||
|
}
|