Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix program element printing in proof saver (#3073)
See #3071. This PR changes the saver to use a new printer method that omits the final `;`. Probably the behaviour was inadvertantly modified in #3034.
- Loading branch information
Showing
3 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
key.core/src/test/java/de/uka/ilkd/key/pp/PrettyPrinterTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package de.uka.ilkd.key.pp; | ||
|
||
import de.uka.ilkd.key.java.abstraction.KeYJavaType; | ||
import de.uka.ilkd.key.logic.ProgramElementName; | ||
import de.uka.ilkd.key.logic.op.LocationVariable; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
class PrettyPrinterTest { | ||
@Test | ||
void printLocationVariable() { | ||
// Test that the pretty printer does not add a ';' when using printFragment. | ||
// This is important for saving instantiations (see #3071) | ||
PrettyPrinter pp = PrettyPrinter.purePrinter(); | ||
ProgramElementName name = new ProgramElementName("x"); | ||
LocationVariable variable = new LocationVariable(name, KeYJavaType.VOID_TYPE); | ||
pp.printFragment(variable); | ||
Assertions.assertEquals("x", pp.result()); | ||
} | ||
} |