[Test] Fix handling of symbolic links in tests

Summary:
Some tests were failing when infer repo was in fact symbolic link.
Fix it by resolving symbolic links when comparing results
master
Andrzej Kotulski 9 years ago
parent 256fcbc0e9
commit 99e9d11902

@ -10,6 +10,7 @@
package utils; package utils;
import java.nio.file.Path; import java.nio.file.Path;
import java.io.IOException;
public class InferError { public class InferError {
@ -22,7 +23,11 @@ public class InferError {
this.errorType = errorType; this.errorType = errorType;
this.errorMethod = errorMethod; this.errorMethod = errorMethod;
this.errorLine = errorLine; this.errorLine = errorLine;
this.errorFile = errorFile; try {
this.errorFile = errorFile.toRealPath();
} catch (IOException e) {
this.errorFile = errorFile;
}
} }
public InferError(String errorType, Path errorFile, String errorMethod) { public InferError(String errorType, Path errorFile, String errorMethod) {
@ -75,7 +80,13 @@ public class InferError {
} }
public boolean matchFile(Path file) { public boolean matchFile(Path file) {
return this.errorFile.equals(file); Path realFile;
try {
realFile = file.toRealPath();
} catch (IOException e) {
realFile = file;
}
return this.errorFile.equals(realFile);
} }
public boolean matchMethod(String method) { public boolean matchMethod(String method) {

Loading…
Cancel
Save