dialyzePrepareFromSelection(true, SEL.PROJECT);
}
@Test
public void dialyzeMarkerOnFile() throws Exception {
IErlProject erlProject = null;
try {
// given
// an erlang module in an erlang project
final String projectName = "testproject";
erlProject = createTmpErlProject(projectName);
final String moduleName = "test.erl";
final IErlModule erlModule = createModule(erlProject, moduleName,
"-module(test).\n-export([f/0]).\n-f() ->\n atom_to_list(\"hej\").\n");
IMarker[] markers = erlProject.getWorkspaceProject().findMarkers(
DialyzerMarkerUtils.DIALYZE_WARNING_MARKER, true,
IResource.DEPTH_INFINITE);
assertEquals(0, markers.length);
// when
// putting a dialyzer warning on it
final int lineNumber = 3;
final String message = "test message";
final IErlElementLocator model = ErlangEngine.getInstance().getModel();
DialyzerMarkerUtils.addDialyzerWarningMarker(model, erlModule.getResource()
.getLocation().toPortableString(), lineNumber, message);
// then
// there should be a marker with proper file name and the proper
// line number
markers = erlProject.getWorkspaceProject().findMarkers(
DialyzerMarkerUtils.DIALYZE_WARNING_MARKER, true,
IResource.DEPTH_INFINITE);
assertEquals(1, markers.length);
final IMarker marker = markers[0];
assertEquals(moduleName, marker.getResource().getName());