eclipse-ee4j / jakartaee-tck-tools

Other
7 stars 15 forks source link

Truncate output files when using tck-rewrite overwriteExistingTests #105

Closed scottmarlow closed 4 weeks ago

scottmarlow commented 4 weeks ago

To reproduce, run once with the overwriteExistingTests option and then open one of the updated test sources, add a few lines of text at the end of file. Run again overwriteExistingTests and the extra few lines of text will still be at the end of the file.

I did ^ and added the following to jpa/platform-tests/src/main/java/ee/jakarta/tck/persistence/jpa22/repeatable/namedstoredprocedurequery/ClientStateless3Test.java:

Scott added extra text here

Will this be deleted when I run: mvn -DoverwriteExistingTests=true -Dtcksourcepath=platform-tests/src/main/java -Dts.home=/home/smarlow/tck/tck10/jakartaeetck org.openrewrite.maven:rewrite-maven-plugin:runNoFork

Indeed, the jpa/platform-tests/src/main/java/ee/jakarta/tck/persistence/jpa22/repeatable/namedstoredprocedurequery/ClientStateless3Test.java was updated (as per file timestamp) but the few lines I added to the end were still there.

This could cause problems if we ever reduce the tck-rewrite output. I'm not sure if we should delete/truncate the (existing) file contents in tck-rewrite or if this should be addressed in tck-rewrite-ant.