mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 09:20:06 +02:00
Let Lexer.getNumber
treat a single minus sign as zero (bug 1753983)
This appears to be consistent with the behaviour in both Adobe Reader and PDFium (in Google Chrome); this is essentially the same approach as used for a single decimal point in PR 9827.
This commit is contained in:
parent
acc758c40c
commit
64f3dbeb48
5 changed files with 27 additions and 12 deletions
|
@ -151,10 +151,14 @@ describe("parser", function () {
|
|||
expect(plusLexer.getNumber()).toEqual(205.88);
|
||||
});
|
||||
|
||||
it("should treat a single decimal point as zero", function () {
|
||||
const input = new StringStream(".");
|
||||
const lexer = new Lexer(input);
|
||||
expect(lexer.getNumber()).toEqual(0);
|
||||
it("should treat a single decimal point, or minus sign, as zero", function () {
|
||||
const dotInput = new StringStream(".");
|
||||
const dotLexer = new Lexer(dotInput);
|
||||
expect(dotLexer.getNumber()).toEqual(0);
|
||||
|
||||
const minusInput = new StringStream("-");
|
||||
const minusLexer = new Lexer(minusInput);
|
||||
expect(minusLexer.getNumber()).toEqual(0);
|
||||
|
||||
const numbers = ["..", "-.", "+.", "-\r\n.", "+\r\n."];
|
||||
for (const number of numbers) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue