1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

Merge pull request #14543 from Snuffleupagus/bug-1753983

Let `Lexer.getNumber` treat a single minus sign as zero (bug 1753983)
This commit is contained in:
Brendan Dahl 2022-02-09 14:06:35 -08:00 committed by GitHub
commit f8b2a99ddc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 12 deletions

View file

@ -0,0 +1 @@
https://bugzilla.mozilla.org/attachment.cgi?id=9262646

View file

@ -219,6 +219,13 @@
"lastPage": 3,
"type": "eq"
},
{ "id": "bug1753983",
"file": "pdfs/bug1753983.pdf",
"md5": "432be86262e5071176c49713ce458031",
"rounds": 1,
"link": true,
"type": "eq"
},
{ "id": "bug921760",
"file": "pdfs/bug921760.pdf",
"md5": "1aa136d786a65b0d7cce7bdb3c58c6c3",

View file

@ -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) {