Permalink
Browse files

fix diff testing bug for source files, owerwritten by FileGenerationL…

…istener
  • Loading branch information...
1 parent 811ddc4 commit 5947ce6c24240d5e15fe819d62463e6c3c5cf9c1 @juliabeliaeva juliabeliaeva committed Jan 28, 2011
Showing with 9 additions and 2 deletions.
  1. +9 −2 core/kernel/source/jetbrains/mps/project/tester/DiffReporter.java
@@ -58,6 +58,9 @@ private static void addDiffReport(TestComparator comparator, List<String> report
continue;
}
files.addAll(Arrays.asList(dir.list()));
+
+ Map<String, String> generatedViaFileGenerationListener = genHandler.getFileGeneratorSources();
+
for (String outputRoot : genHandler.getRoots(outputModel)) {
String outputFileName = genHandler.getName(outputRoot, outputModel);
if (outputFileName == null) {
@@ -74,17 +77,21 @@ private static void addDiffReport(TestComparator comparator, List<String> report
}
String newContent = genHandler.getSourceByNode(outputRoot, outputModel);
+ String newContentGeneratedViaListener = generatedViaFileGenerationListener.get(outputFileName);
+ if (newContentGeneratedViaListener != null) {
+ newContent = newContentGeneratedViaListener;
+ }
if (addDiffReport(filePath, outputRoot, newContent, result)) {
files.remove(outputFileName);
}
}
- Map<String, String> sources = genHandler.getFileGeneratorSources();
+
for (String fileName : files) {
int dotPosition = fileName.indexOf(".");
if (dotPosition == 0 || dotPosition == -1) {
continue;
}
- String newContent = sources.get(fileName);
+ String newContent = generatedViaFileGenerationListener.get(fileName);
if (newContent != null) {
addDiffReport(getFilePath(genHandler, outputModel, fileName), fileName, newContent, result);

0 comments on commit 5947ce6

Please sign in to comment.