From 652bd5f333145c39b2e14eee49c654d9501beebf Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Thu, 14 Jan 2016 12:24:50 -0800 Subject: Merge to XFA: Additional test cases for bug_361 Original Review URL: https://codereview.chromium.org/1582383002 . (cherry picked from commit 1a82d5c28be2ebdb7524a7249e43026546d0ebf0) TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1590053002 . --- testing/resources/javascript/bug_361.in | 20 +++++++++++++++++++- testing/resources/javascript/bug_361_expected.txt | 20 +++++++++++++++++++- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/testing/resources/javascript/bug_361.in b/testing/resources/javascript/bug_361.in index 34fde70fe2..f98ef829f2 100644 --- a/testing/resources/javascript/bug_361.in +++ b/testing/resources/javascript/bug_361.in @@ -50,11 +50,13 @@ function testField(x) { var y = field.value; app.alert("Answer for \"" + x + "\" is: " + typeof(y) + " " + y); } +testField(""); testField("goats"); testField("b4"); testField("b4.5"); testField("4x"); testField("4.5x"); +testField(4); testField("4"); testField(" 4"); testField("4 "); @@ -63,15 +65,25 @@ testField("4 3 2 1"); testField("-4"); testField("23.00000001"); testField("23.00000000000000001"); +testField(40000000000000000000000000); +testField("40000000000000000000000000"); testField("25,5"); testField("1e+5"); testField("1e5"); testField("1e-5"); testField("-1e-5"); testField("1.2e5"); -testField("NAN"); +testField(Infinity); +testField("Infinity"); +testField("INFINITY"); testField("INF"); +testField(NaN); +testField("NaN"); +testField("NAN"); testField("0x100"); +testField("0x100.1"); +testField("0x100,1"); +testField("0x100x1"); testField("123x6"); testField("123xy6"); testField("123.y6"); @@ -81,6 +93,12 @@ testField("1-3"); testField("1+3"); testField("1.-3"); testField("1.+3"); +testField([1, 2, 3, 4]); +testField("[1, 2, 3, 4]"); +testField({a: 1, b: 2}); +testField("{a: 1, b: 2}"); +testField(function(x) { return x+1; }); +testField("function(x) { return x+1; }"); endstream endobj {{xref}} diff --git a/testing/resources/javascript/bug_361_expected.txt b/testing/resources/javascript/bug_361_expected.txt index a7fd795477..f7f7a562bb 100644 --- a/testing/resources/javascript/bug_361_expected.txt +++ b/testing/resources/javascript/bug_361_expected.txt @@ -1,9 +1,11 @@ +Alert: Answer for "" is: string Alert: Answer for "goats" is: string goats Alert: Answer for "b4" is: string b4 Alert: Answer for "b4.5" is: string b4.5 Alert: Answer for "4x" is: string 4x Alert: Answer for "4.5x" is: string 4.5x Alert: Answer for "4" is: number 4 +Alert: Answer for "4" is: number 4 Alert: Answer for " 4" is: number 4 Alert: Answer for "4 " is: number 4 Alert: Answer for " 4 " is: number 4 @@ -11,15 +13,25 @@ Alert: Answer for "4 3 2 1" is: string 4 3 2 1 Alert: Answer for "-4" is: number -4 Alert: Answer for "23.00000001" is: number 23.00000001 Alert: Answer for "23.00000000000000001" is: number 0 +Alert: Answer for "4e+25" is: number 4e+25 +Alert: Answer for "40000000000000000000000000" is: number 0 Alert: Answer for "25,5" is: number 25.5 Alert: Answer for "1e+5" is: number 100000 Alert: Answer for "1e5" is: number 1 Alert: Answer for "1e-5" is: number 0.00001 Alert: Answer for "-1e-5" is: number -0.00001 Alert: Answer for "1.2e5" is: number 1.2 -Alert: Answer for "NAN" is: string NAN +Alert: Answer for "Infinity" is: string Infinity +Alert: Answer for "Infinity" is: string Infinity +Alert: Answer for "INFINITY" is: string INFINITY Alert: Answer for "INF" is: string INF +Alert: Answer for "NaN" is: string NaN +Alert: Answer for "NaN" is: string NaN +Alert: Answer for "NAN" is: string NAN Alert: Answer for "0x100" is: string 0x100 +Alert: Answer for "0x100.1" is: string 0x100.1 +Alert: Answer for "0x100,1" is: string 0x100,1 +Alert: Answer for "0x100x1" is: string 0x100x1 Alert: Answer for "123x6" is: string 123x6 Alert: Answer for "123xy6" is: string 123xy6 Alert: Answer for "123.y6" is: string 123.y6 @@ -29,3 +41,9 @@ Alert: Answer for "1-3" is: string 1-3 Alert: Answer for "1+3" is: string 1+3 Alert: Answer for "1.-3" is: string 1.-3 Alert: Answer for "1.+3" is: string 1.+3 +Alert: Answer for "1,2,3,4" is: number 1 +Alert: Answer for "[1, 2, 3, 4]" is: string [1, 2, 3, 4] +Alert: Answer for "[object Object]" is: string [object Object] +Alert: Answer for "{a: 1, b: 2}" is: string {a: 1, b: 2} +Alert: Answer for "function (x) { return x+1; }" is: string function (x) { return x+1; } +Alert: Answer for "function(x) { return x+1; }" is: string function(x) { return x+1; } -- cgit v1.2.3