final IErlModule moduleB = createModule(project1, "bx.erl",
"-module(bx).\n-type concat_thing() :: atom() | integer() | float() | string().\n");
// final IErlModule moduleC =
// createErlModule(projects[1],
// "c.erl", "-module(c).\n-type cc() :: b:concat_thing().\n");
final ScannerService scanner = moduleB.getScanner();
try {
moduleB.open(null);
project1.open(null);
// moduleC.open(null);
// when
// looking for it
// within project
final IErlElementLocator model = ErlangEngine.getInstance().getModel();
final IErlElement element1 = modelFindService.findTypeDef(model, project1,
moduleB, "bx", "concat_thing", moduleB.getResource().getLocation()
.toPortableString(), IErlElementLocator.Scope.PROJECT_ONLY);
// in other project but path given
final IErlElement element2 = modelFindService.findTypeDef(model, project2,
moduleB, "bx", "concat_thing", moduleB.getResource().getLocation()
.toPortableString(), IErlElementLocator.Scope.PROJECT_ONLY);
// in other project no path given, search all projects true
final IErlElement element3 = modelFindService.findTypeDef(model, project2,
moduleB, "bx", "concat_thing", null,
IErlElementLocator.Scope.ALL_PROJECTS);
// in other project no path given, search all projects false, ->
// null
final IErlElement element4 = modelFindService.findTypeDef(model, project2,
moduleB, "bx", "concat_thing", null,
IErlElementLocator.Scope.PROJECT_ONLY);
// then
// it should be returned if found
assertTrue(element1 instanceof IErlTypespec);
assertNull(element2);
assertTrue(element3 instanceof IErlTypespec);
assertNull(element4);
} finally {
scanner.dispose();
}
}