blob: 4e2f723447e90a71a33478678b1516cc0852182a [file] [log] [blame]
@setup
operation setup() {
modelManager.unloadAllModels();
}
@test
operation warnWhenUsingAnUnqualifiedReferenceToATypeThatIsAvailableInMoreThanOneModel() {
modelManager.createInMemoryEmfModel("First", "http://www.eclipse.org/emf/2002/Ecore");
modelManager.createInMemoryEmfModel("Second", "ecoreLite");
// EClass is a valid type for both First and Second, so issue a warning
var x = EClass;
assertWarning("The type 'EClass' is ambiguous and could refer to any of the following: 'First!EClass' 'Second!EClass'. The type 'First!EClass' has been assumed.");
}
@test
operation noWarningsWhenUsingAnUnqualifiedReferenceToATypeThatIsAvailableInOnlyTheFirstModel() {
modelManager.createInMemoryEmfModel("First", "http://www.eclipse.org/emf/2002/Ecore");
modelManager.createInMemoryEmfModel("Second", "ecoreLite");
// EPackage is a valid type only for Ecore (First) => no warning
var x = EPackage;
assertNoWarnings();
}
@test
operation noWarningsWhenUsingAQualifiedReferenceToATypeThatIsAvailableInMoreThanOneModel() {
modelManager.createInMemoryEmfModel("First", "http://www.eclipse.org/emf/2002/Ecore");
modelManager.createInMemoryEmfModel("Second", "ecoreLite");
// Qualified references => no warning
var x = First!EClass;
var x = Second!EClass;
assertNoWarnings();
}
@test
operation warningListsAllModelsThatHaveTheAmbiguousType() {
modelManager.createInMemoryEmfModel("Premier", "http://www.eclipse.org/emf/2002/Ecore");
modelManager.createInMemoryEmfModel("Deuxieme", "ecoreLite");
modelManager.createInMemoryEmfModel("Troisieme", "fruits");
modelManager.createInMemoryEmfModel("Quatrieme", "http://www.eclipse.org/emf/2002/Ecore");
// EClass is a valid type for First, Second and Fourth, so issue a warning
var x = EClass;
assertWarning("The type 'EClass' is ambiguous and could refer to any of the following: 'Premier!EClass' 'Deuxieme!EClass' 'Quatrieme!EClass'. The type 'Premier!EClass' has been assumed.");
}