Skip to content

Commit 73c3c86

Browse files
author
jantje
committed
#1476 removed the code as it seems it is incompatible with gitbuild
Wel the build fails as the original code is not available and having the original code makes no sense So it was or adding non sensical code or removing the testing code I opted to remove the code
1 parent c4b54b1 commit 73c3c86

File tree

1 file changed

+12
-50
lines changed

1 file changed

+12
-50
lines changed

io.sloeber.tests/src/io/sloeber/junit/TxtWorkAroundRegression.java

+12-50
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
import java.io.File;
99
import java.nio.charset.Charset;
10-
import java.time.LocalDate;
11-
import java.time.format.DateTimeFormatter;
1210
import java.util.Collection;
1311
import java.util.LinkedList;
1412

@@ -26,19 +24,6 @@ public class TxtWorkAroundRegression {
2624
final static private String ROOTFOLDER = "E:\\arduinoTxt-Backup-2021-08-19";
2725
private Path myPath;
2826

29-
//this value should only be true for on, github
30-
//you can set it to false to test differences in outcome of you code changes
31-
//to do so make a copy of the original code od io.sloeber.core.txt.WorkAround
32-
// and name it io.sloeber.core.txt.WorkAroundOrg (do not check it in)
33-
//modify io.sloeber.core.txt.WorkAround
34-
//running the test will provide the differences between the 2 code sets
35-
// for all platform.txt files provided
36-
private boolean comparePlarformFiles = true;
37-
//following variables are only used when comparePlarformFiles is false
38-
private Path myOutputPath = new Path(
39-
"E:\\test\\workaround\\" + LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-DD")));
40-
static private int differenceCount = 0;
41-
4227
public TxtWorkAroundRegression(String pathName) {
4328
myPath = new Path(pathName);
4429

@@ -125,43 +110,20 @@ public void platformTxt() throws Exception {
125110
String currentWorkAround = platformApplyWorkArounds(input, inputFile);
126111
String cleanedCurrentWorkAround = clean(currentWorkAround);
127112

128-
if (comparePlarformFiles) {
129-
//compare the Sloeber generated workaround file content to the content of the file on disk
130-
if (!expectedFile.exists()) {
131-
System.out.println("file does not exists " + expectedFile);
132-
assumeFalse(true);// skip the test
133-
}
113+
//compare the Sloeber generated workaround file content to the content of the file on disk
114+
if (!expectedFile.exists()) {
115+
System.out.println("file does not exists " + expectedFile);
116+
assumeFalse(true);// skip the test
117+
}
134118

135-
String expected = FileUtils.readFileToString(expectedFile, Charset.defaultCharset());
136-
String cleanedExpected = clean(expected);
119+
String expected = FileUtils.readFileToString(expectedFile, Charset.defaultCharset());
120+
String cleanedExpected = clean(expected);
137121

138-
String difference = StringUtils.difference(cleanedExpected, cleanedCurrentWorkAround);
139-
if (!cleanedExpected.equals(cleanedCurrentWorkAround)) {
140-
System.err.println("ERROR for " + inputFile);
141-
System.err.println(difference);
142-
fail(difference.substring(0, 20));
143-
}
144-
} else {
145-
//compare the Sloeber generated workaround file content to the content generated by other code
146-
//the idea is to compare the current code to the old code
147-
//this because it is hard to update the files on disk
148-
String oldWorkAround = io.sloeber.core.txt.WorkAroundOrg.platformApplyWorkArounds(input, inputFile);
149-
String cleanedOldWorkAround = clean(oldWorkAround);
150-
151-
if (!cleanedOldWorkAround.equals(cleanedCurrentWorkAround)) {
152-
differenceCount += 1;
153-
@SuppressWarnings("boxing")
154-
String prefix = String.format("%04d", differenceCount) + "_";
155-
System.err.println("ERROR for " + inputFile);
156-
String difference = StringUtils.difference(cleanedCurrentWorkAround, cleanedOldWorkAround);
157-
System.err.println(difference);
158-
File current = myOutputPath.append(prefix + "CurrentWorkAround.txt").toFile();
159-
File old = myOutputPath.append(prefix + "OldWorkAround.txt").toFile();
160-
FileUtils.writeStringToFile(current, cleanedCurrentWorkAround, Charset.defaultCharset());
161-
FileUtils.writeStringToFile(old, cleanedOldWorkAround, Charset.defaultCharset());
162-
163-
fail(difference.substring(0, 20));
164-
}
122+
String difference = StringUtils.difference(cleanedExpected, cleanedCurrentWorkAround);
123+
if (!cleanedExpected.equals(cleanedCurrentWorkAround)) {
124+
System.err.println("ERROR for " + inputFile);
125+
System.err.println(difference);
126+
fail(difference.substring(0, 20));
165127
}
166128

167129
}

0 commit comments

Comments
 (0)