use of org.eclipse.emf.ecore.ENamedElement in project xtext-core by eclipse.
the class NamesAreUniqueValidationHelperTest method testManyManyDup.
@SuppressWarnings("deprecation")
@Test
public void testManyManyDup() {
List<ENamedElement> elements = new ArrayList<>();
for (int i = 0, j = 0; i < MANY; i++) {
if (i % 100 == 0) {
j++;
}
EClass c = createEClass();
c.setName("i" + j);
elements.add(c);
}
maxCallCount = 0;
expected.addAll(elements);
helper.checkUniqueNames(Scopes.scopedElementsFor(elements), this, this);
}
use of org.eclipse.emf.ecore.ENamedElement in project xtext-core by eclipse.
the class NamesAreUniqueValidationHelperTest method testManyOneDup_context.
@Test
public void testManyOneDup_context() {
List<ENamedElement> elements = new ArrayList<>();
for (int i = 0; i < MANY; i++) {
EClass c = createEClass();
if (i == MANY - 1) {
c.setName("i1234");
} else {
c.setName("i" + i);
}
elements.add(c);
}
maxCallCount = 0;
expected.add(elements.get(1_234));
expected.add(elements.get(MANY - 1));
helper.checkUniqueNames(new LocalUniqueNameContext(elements, this), this);
}
use of org.eclipse.emf.ecore.ENamedElement in project xtext-core by eclipse.
the class NamesAreUniqueValidationHelperTest method testCreatedErrors_04_context.
@Test
public void testCreatedErrors_04_context() {
maxCallCount = 0;
ImmutableList<ENamedElement> elements = ImmutableList.of(createEClass(), createEDataType(), createEPackage(), createEPackage());
for (ENamedElement classifier : elements) {
classifier.setName("Same");
}
expected.addAll(elements);
helper.checkUniqueNames(new LocalUniqueNameContext(elements, this), this);
assertEquals(elements.size(), callCount);
assertTrue(expected.isEmpty());
}
use of org.eclipse.emf.ecore.ENamedElement in project xtext-core by eclipse.
the class NamesAreUniqueValidationHelperTest method testCreatedErrors_05.
@SuppressWarnings("deprecation")
@Test
public void testCreatedErrors_05() {
maxCallCount = 0;
ImmutableList<ENamedElement> elements = ImmutableList.of(createEPackage(), createEDataType(), createEPackage());
for (ENamedElement classifier : elements) {
classifier.setName("Same");
}
expected.add(elements.get(0));
expected.add(elements.get(2));
helper.checkUniqueNames(Scopes.scopedElementsFor(elements), this, this);
assertEquals(elements.size(), callCount);
assertTrue(expected.isEmpty());
}
use of org.eclipse.emf.ecore.ENamedElement in project xtext-core by eclipse.
the class NamesAreUniqueValidationHelperTest method testCreatedErrors_07_context.
@Test
public void testCreatedErrors_07_context() {
maxCallCount = 0;
ImmutableList<ENamedElement> elements = ImmutableList.of(createEPackage(), createEDataType(), EcoreFactory.eINSTANCE.createEEnumLiteral());
for (ENamedElement classifier : elements) {
classifier.setName("Same");
}
expected.add(elements.get(0));
expected.add(elements.get(2));
helper.checkUniqueNames(new LocalUniqueNameContext(elements, this), this);
assertEquals(elements.size(), callCount);
assertTrue(expected.isEmpty());
}
Aggregations