use of org.eclipse.xtext.testing.serializer.DebugSequenceAcceptor in project xtext-core by eclipse.
the class AbstractSemanticSequencerTest method testSequence.
private EObject testSequence(String stringModel) throws Exception {
DebugSequenceAcceptor genericActual = new DebugSequenceAcceptor();
DebugSequenceAcceptor generatedActual = new DebugSequenceAcceptor();
DebugSequenceAcceptor expected = new DebugSequenceAcceptor();
ISemanticSequencer generatedSequencer = generatedSequencerProvider.get();
ISemanticSequencer genericSequencer = getGenericSemanticSequencer();
assertTrue(generatedSequencer instanceof SequencerTestLanguageSemanticSequencer);
generatedSequencer.init(generatedActual, ISerializationDiagnostic.STDERR_ACCEPTOR);
genericSequencer.init(genericActual, ISerializationDiagnostic.STDERR_ACCEPTOR);
nmSequencer.init(expected, ISerializationDiagnostic.STDERR_ACCEPTOR);
EObject model = getModel(stringModel).eContents().get(0);
ISerializationContext context = nmSequencer.findContexts(model, true, null).iterator().next();
generatedSequencer.createSequence(context, model);
genericSequencer.createSequence(context, model);
nmSequencer.createSequence(context, model);
assertEquals(expected.toString(), genericActual.toString());
assertEquals(expected.toString(), generatedActual.toString());
return model;
}
use of org.eclipse.xtext.testing.serializer.DebugSequenceAcceptor in project xtext-core by eclipse.
the class HiddenTokenSequencerTest method testSequence.
private void testSequence(String stringModel) throws Exception {
EObject model = getModel(stringModel);
ISerializationContext context = nmSequencer.findContexts(model, true, null).iterator().next();
DebugSequenceAcceptor actual = new NoEnterNodesDebugSequenceAcceptor(false);
ISemanticSequencer semanticSequencer = semanticSequencerProvider.get();
ISyntacticSequencer syntacticSequencer = syntacticSequencerProvider.get();
IHiddenTokenSequencer hiddenTokenSequencer = hiddenTokenSequencerProvider.get();
semanticSequencer.init((ISemanticSequenceAcceptor) syntacticSequencer, ISerializationDiagnostic.STDERR_ACCEPTOR);
syntacticSequencer.init(context, model, (ISyntacticSequenceAcceptor) hiddenTokenSequencer, ISerializationDiagnostic.STDERR_ACCEPTOR);
hiddenTokenSequencer.init(context, model, actual, ISerializationDiagnostic.STDERR_ACCEPTOR);
semanticSequencer.createSequence(context, model);
// System.out.println(actual);
// System.out.println(NodeModelUtils.compactDump(NodeModelUtils.findActualNodeFor(model), true));
assertEquals(Joiner.on("\n").join(getNodeSequence(model)), Joiner.on("\n").join(actual.getColumn(4)));
}
Aggregations