Search in sources :

Example 1 with TextRegionAccessToString

use of org.eclipse.xtext.formatting2.debug.TextRegionAccessToString in project xtext-core by eclipse.

the class ChangeSerializerTestHelper method operator_tripleEquals.

public void operator_tripleEquals(final ITextRegionAccess actual, final CharSequence expected) {
    final String actualString = new TextRegionAccessToString().withRegionAccess(actual).hideColumnExplanation().toString();
    Assert.assertEquals(Strings.toPlatformLineSeparator(expected).trim(), Strings.toPlatformLineSeparator(actualString).trim());
}
Also used : TextRegionAccessToString(org.eclipse.xtext.formatting2.debug.TextRegionAccessToString) TextDocumentChangeToString(org.eclipse.xtext.ide.serializer.debug.TextDocumentChangeToString) TextRegionAccessToString(org.eclipse.xtext.formatting2.debug.TextRegionAccessToString)

Example 2 with TextRegionAccessToString

use of org.eclipse.xtext.formatting2.debug.TextRegionAccessToString in project xtext-core by eclipse.

the class ImportTestHelper method operator_tripleEquals.

public void operator_tripleEquals(final ITextRegionAccess actual, final CharSequence expected) {
    final String actualString = new TextRegionAccessToString().withRegionAccess(actual).hideColumnExplanation().toString();
    Assert.assertEquals(expected.toString().trim(), actualString.trim());
}
Also used : TextRegionAccessToString(org.eclipse.xtext.formatting2.debug.TextRegionAccessToString) TextDocumentChangeToString(org.eclipse.xtext.ide.serializer.debug.TextDocumentChangeToString) TextRegionAccessToString(org.eclipse.xtext.formatting2.debug.TextRegionAccessToString)

Example 3 with TextRegionAccessToString

use of org.eclipse.xtext.formatting2.debug.TextRegionAccessToString in project xtext-core by eclipse.

the class RegionAccessBuilderTest method operator_tripleEquals.

private void operator_tripleEquals(final CharSequence file, final CharSequence expectation) {
    try {
        final String exp = expectation.toString();
        final Root obj = this.parseHelper.parse(file);
        this.validationTestHelper.assertNoErrors(obj);
        final ITextRegionAccess access1 = this.createFromNodeModel(obj);
        final ITextRegionAccess access2 = this.serializer.serializeToRegions(obj);
        this.assertToStringDoesNotCrash(access1);
        this.assertToStringDoesNotCrash(access2);
        this.assertLinesAreConsistent(access1);
        this.assertLinesAreConsistent(access2);
        TextRegionAccessToString _cfg = this.cfg(new TextRegionAccessToString().withRegionAccess(access1));
        final String tra1 = (_cfg + "\n");
        TextRegionAccessToString _cfg_1 = this.cfg(new TextRegionAccessToString().withRegionAccess(access2));
        final String tra2 = (_cfg_1 + "\n");
        Assert.assertEquals(Strings.toPlatformLineSeparator(exp), Strings.toPlatformLineSeparator(tra1));
        Assert.assertEquals(Strings.toPlatformLineSeparator(exp), Strings.toPlatformLineSeparator(tra2));
    } catch (Throwable _e) {
        throw Exceptions.sneakyThrow(_e);
    }
}
Also used : ITextRegionAccess(org.eclipse.xtext.formatting2.regionaccess.ITextRegionAccess) Root(org.eclipse.xtext.formatting2.regionaccess.internal.regionaccesstestlanguage.Root) TextRegionAccessToString(org.eclipse.xtext.formatting2.debug.TextRegionAccessToString) TextRegionAccessToString(org.eclipse.xtext.formatting2.debug.TextRegionAccessToString)

Example 4 with TextRegionAccessToString

use of org.eclipse.xtext.formatting2.debug.TextRegionAccessToString in project xtext-core by eclipse.

the class RegionAccessTestHelper method operator_tripleEquals.

public void operator_tripleEquals(final ITextRegionAccess access, final CharSequence expectation) {
    if ((access instanceof ITextRegionAccessDiff)) {
        this.assertDiffs(((ITextRegionAccessDiff) access));
    }
    TextRegionAccessToString _cfg = this.cfg(new TextRegionAccessToString().withRegionAccess(access));
    final String tra1 = (_cfg + "\n");
    Assert.assertEquals(Strings.toPlatformLineSeparator(expectation), Strings.toPlatformLineSeparator(tra1));
}
Also used : ITextRegionAccessDiff(org.eclipse.xtext.formatting2.regionaccess.ITextRegionAccessDiff) TextRegionAccessToString(org.eclipse.xtext.formatting2.debug.TextRegionAccessToString) TextRegionAccessToString(org.eclipse.xtext.formatting2.debug.TextRegionAccessToString)

Aggregations

TextRegionAccessToString (org.eclipse.xtext.formatting2.debug.TextRegionAccessToString)4 TextDocumentChangeToString (org.eclipse.xtext.ide.serializer.debug.TextDocumentChangeToString)2 ITextRegionAccess (org.eclipse.xtext.formatting2.regionaccess.ITextRegionAccess)1 ITextRegionAccessDiff (org.eclipse.xtext.formatting2.regionaccess.ITextRegionAccessDiff)1 Root (org.eclipse.xtext.formatting2.regionaccess.internal.regionaccesstestlanguage.Root)1