fix: Assert failure in gov.nasa.jpf.test.java.io.FileTest.testToURI (Windows 11/Java 11)#598
Open
gRid08 wants to merge 1 commit intojavapathfinder:masterfrom
Open
fix: Assert failure in gov.nasa.jpf.test.java.io.FileTest.testToURI (Windows 11/Java 11)#598gRid08 wants to merge 1 commit intojavapathfinder:masterfrom
gRid08 wants to merge 1 commit intojavapathfinder:masterfrom
Conversation
Author
|
@cyrille-artho Can you please review |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #597
Root Cause
In FileTest.java,test named testToURI the expected URI is created via:
expectedURI = new URI("file:" + file.getAbsolutePath());On Windows, file.getAbsolutePath() returns a path like C:\jpf-core\test.txt
new URI("file:" + ...) creates: file:C:\jpf-core\test.txtfile.toURI() (Actual) creates: file:/C:/jpf-core/test.txt(Note the leading slash required for the authority component).Because the manual string concatenation lacks the leading slash (and proper character escaping), the assertEquals fails.
Proposed Fix
The test should use the host JVM's standard way of generating a URI from a file object to ensure platform compatibility. I have modified the test to use:
expectedURI = file.getAbsoluteFile().toURI();