-
-
Notifications
You must be signed in to change notification settings - Fork 647
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix xref trailer Size bug * Remove comments between indirect objects * Update trimArrayAndRemoveComments tests * Handle comments in PDFArrays * Handle comments when parsing PDFBooleans * Handle comments when parsing PDFDictionaries * Handle comments when parsing PDFHexStrings * Handle comments when parsing PDFIndirectObjects * Handle carriage returns EOL markers in comments * Handle comments when parsing PDFIndirectReference objects * Handle comments when parsing PDFName objects * Handle comments when parsing PDFNull objects * Handle comments when parsing PDFNumber objects * Handle comments when parsing PDFStream and PDFObjectStream objects * Handle comments when parsing PDFString objects * Handle comments when parsing PDFTrailer objects * Add more PDF comments to parseDict and parseArray tests * Run linter * Reset accidental changes to integration tests
- Loading branch information
Showing
28 changed files
with
360 additions
and
49 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { | ||
arrayToString, | ||
trimArrayAndRemoveComments, | ||
typedArrayFor, | ||
} from 'utils'; | ||
|
||
describe(`trimArrayAndRemoveComments`, () => { | ||
it(`removes leading PDF comments from its input`, () => { | ||
const input = typedArrayFor( | ||
'% I am a comment!\n%I am a comment too!\nThis is not a comment. \n ', | ||
); | ||
const res = trimArrayAndRemoveComments(input); | ||
expect(res).toEqual(typedArrayFor('This is not a comment. \n ')); | ||
}); | ||
|
||
it(`removes leading whitespace and PDF comments from its input`, () => { | ||
const input = typedArrayFor( | ||
' \n %I am a comment too!\nThis is not a comment. \n ', | ||
); | ||
const res = trimArrayAndRemoveComments(input); | ||
expect(res).toEqual(typedArrayFor('This is not a comment. \n ')); | ||
}); | ||
|
||
it(`removes leading whitespace from its input`, () => { | ||
const input = typedArrayFor(' \n \nThis is not a comment. \n '); | ||
const res = trimArrayAndRemoveComments(input); | ||
expect(res).toEqual(typedArrayFor('This is not a comment. \n ')); | ||
}); | ||
|
||
it(`returns its input when there are no leading PDF comments or whitespace`, () => { | ||
const input = typedArrayFor('This is not a comment. \n '); | ||
const res = trimArrayAndRemoveComments(input); | ||
expect(res).toEqual(typedArrayFor('This is not a comment. \n ')); | ||
}); | ||
|
||
it(`returns its input when the comment's newline is missing`, () => { | ||
const input = typedArrayFor('% This is not a complete comment'); | ||
const res = trimArrayAndRemoveComments(input); | ||
expect(res).toEqual(typedArrayFor('% This is not a complete comment')); | ||
}); | ||
|
||
it(`handles "\\n" and "\\r" EOL markers`, () => { | ||
const input = typedArrayFor('% First\n%Second\r% Third\r\nFoo'); | ||
const res = trimArrayAndRemoveComments(input); | ||
expect(res).toEqual(typedArrayFor('Foo')); | ||
}); | ||
}); |
Oops, something went wrong.