-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure byte-for-byte results when reading and then writing a file.
When reading a DiffX file using the DOM and then writing it back out, the contents of the file would change. Since DiffX files are intended to be a mutable format, we don't want to make any unwanted changes. There were a few problems leading to this: 1) When reading into a file into a `DiffX` object, default options would be preserved. This is really a problem for the main `encoding` option, which would default to UTF-8 if missing in the DiffX file content, and would then be written back out. Now, options are cleared out before they're set. 2) Similarly, if an explicit main `encoding` value wasn't provided, the default in `DiffXWriter` would be used. We now explicitly pull out the `encoding` option, defaulting to `None` if not found in the file, and pass it in to `DiffXWriter`. 2) `DiffXWriter` was hard-coding the version being set, and the DOM therefore wasn't setting a version when writing. Now it will accept a provided version. While not important right now, this will be important for compatibility with future spec versions. It's up to the caller to ensure the version being provided is valid. Unit tests were added to ensure that we now get byte-for-byte results. Testing Done: Unit tests pass. Reviewed at https://reviews.reviewboard.org/r/11763/
- Loading branch information
Showing
8 changed files
with
213 additions
and
14 deletions.
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
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
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
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