Skip to content

Commit f30167e

Browse files
committed
tests seem to be working, run with strictMode = fale then true
1 parent 75e5a3d commit f30167e

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

build.gradle

+43
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,46 @@ publishing {
5353
tasks.withType(JavaCompile) {
5454
options.encoding = 'UTF-8'
5555
}
56+
57+
def originalFile = null;
58+
59+
task backupCode {
60+
def file = file('src/main/java/org/json/JSONParserConfiguration.java')
61+
originalFile = file.text
62+
}
63+
64+
task firstTest {
65+
66+
}
67+
68+
task modifyCode {
69+
doLast {
70+
// Add your code modification logic here
71+
def file = file('src/main/java/org/json/JSONParserConfiguration.java')
72+
def text = file.text
73+
text = text.replaceAll('oldCode', 'newCode')
74+
file.text = text
75+
}
76+
}
77+
78+
task compileModifiedCode(type: JavaCompile) {
79+
source = sourceSets.main.java.srcDirs
80+
classpath = sourceSets.main.compileClasspath
81+
destinationDirectory = sourceSets.main.java.outputDir
82+
}
83+
84+
task secondTest {
85+
86+
}
87+
88+
task restoreCode {
89+
def file = file('src/main/java/org/json/JSONParserConfiguration.java')
90+
file.text = originalFile
91+
}
92+
93+
// and then add it to the task list
94+
backupCode.finalizedBy firstTest
95+
firstTest.finalizedBy modifyCode
96+
modifyCode.finalizedBy compileModifiedCode
97+
compileModifiedCode.finalizedBy secondTest
98+
secondTest.finalizedBy restoreCode

src/main/java/org/json/JSONParserConfiguration.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class JSONParserConfiguration extends ParserConfiguration {
1515
public JSONParserConfiguration() {
1616
super();
1717
this.overwriteDuplicateKey = false;
18-
// this.strictMode = true;
18+
// this.strictMode = true;
1919
}
2020

2121
/**

0 commit comments

Comments
 (0)