mirror of
https://github.com/stleary/JSON-java.git
synced 2025-08-03 11:25:30 -04:00
tests seem to be working, run with strictMode = fale then true
This commit is contained in:
parent
75e5a3d646
commit
f30167e7c0
43
build.gradle
43
build.gradle
@ -53,3 +53,46 @@ publishing {
|
|||||||
tasks.withType(JavaCompile) {
|
tasks.withType(JavaCompile) {
|
||||||
options.encoding = 'UTF-8'
|
options.encoding = 'UTF-8'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def originalFile = null;
|
||||||
|
|
||||||
|
task backupCode {
|
||||||
|
def file = file('src/main/java/org/json/JSONParserConfiguration.java')
|
||||||
|
originalFile = file.text
|
||||||
|
}
|
||||||
|
|
||||||
|
task firstTest {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
task modifyCode {
|
||||||
|
doLast {
|
||||||
|
// Add your code modification logic here
|
||||||
|
def file = file('src/main/java/org/json/JSONParserConfiguration.java')
|
||||||
|
def text = file.text
|
||||||
|
text = text.replaceAll('oldCode', 'newCode')
|
||||||
|
file.text = text
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task compileModifiedCode(type: JavaCompile) {
|
||||||
|
source = sourceSets.main.java.srcDirs
|
||||||
|
classpath = sourceSets.main.compileClasspath
|
||||||
|
destinationDirectory = sourceSets.main.java.outputDir
|
||||||
|
}
|
||||||
|
|
||||||
|
task secondTest {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
task restoreCode {
|
||||||
|
def file = file('src/main/java/org/json/JSONParserConfiguration.java')
|
||||||
|
file.text = originalFile
|
||||||
|
}
|
||||||
|
|
||||||
|
// and then add it to the task list
|
||||||
|
backupCode.finalizedBy firstTest
|
||||||
|
firstTest.finalizedBy modifyCode
|
||||||
|
modifyCode.finalizedBy compileModifiedCode
|
||||||
|
compileModifiedCode.finalizedBy secondTest
|
||||||
|
secondTest.finalizedBy restoreCode
|
@ -15,7 +15,7 @@ public class JSONParserConfiguration extends ParserConfiguration {
|
|||||||
public JSONParserConfiguration() {
|
public JSONParserConfiguration() {
|
||||||
super();
|
super();
|
||||||
this.overwriteDuplicateKey = false;
|
this.overwriteDuplicateKey = false;
|
||||||
// this.strictMode = true;
|
// this.strictMode = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user