⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 117806 in webkit


Ignore:
Timestamp:
May 21, 2012, 12:20:14 PM (14 years ago)
Author:
jsbell@chromium.org
Message:

LayoutTests: fast/js/resources/js-test-pre.js - shouldBeEqualToString fails on "
https://bugs.webkit.org/show_bug.cgi?id=86931

Implementations of shouldBeEqualToString() function were not correctly escaping
double quote ('"') characters. Switch to using JSON.stringify() which does
correct escaping, and updated one test that couldn't previously use the function.

Reviewed by Ojan Vafai.

  • fast/js/resources/js-test-pre.js:

(shouldBeEqualToString):

  • fast/js/resources/standalone-pre.js:

(shouldBeEqualToString):

  • storage/indexeddb/cursor-advance-expected.txt:
  • storage/indexeddb/resources/cursor-advance.js:

(runTest):

Location:
trunk/LayoutTests
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r117804 r117806  
     12012-05-21  Joshua Bell  <jsbell@chromium.org>
     2
     3        LayoutTests: fast/js/resources/js-test-pre.js - shouldBeEqualToString fails on "
     4        https://bugs.webkit.org/show_bug.cgi?id=86931
     5
     6        Implementations of shouldBeEqualToString() function were not correctly escaping
     7        double quote ('"') characters. Switch to using JSON.stringify() which does
     8        correct escaping, and updated one test that couldn't previously use the function.
     9
     10        Reviewed by Ojan Vafai.
     11
     12        * fast/js/resources/js-test-pre.js:
     13        (shouldBeEqualToString):
     14        * fast/js/resources/standalone-pre.js:
     15        (shouldBeEqualToString):
     16        * storage/indexeddb/cursor-advance-expected.txt:
     17        * storage/indexeddb/resources/cursor-advance.js:
     18        (runTest):
     19
    1202012-05-21  Sudarsana Nagineni  <sudarsana.nagineni@linux.intel.com>
    221
  • trunk/LayoutTests/fast/dom/HTMLElement/class-list-expected.txt

    r96827 r117806  
    2525Testing add in presence of trailing white spaces.
    2626PASS element.className is "x y"
    27 PASS element.className is "x    y"
     27PASS element.className is "x\t y"
    2828PASS element.className is " y"
    2929Test invalid tokens
  • trunk/LayoutTests/fast/dom/HTMLElement/class-list-quirks-expected.txt

    r96827 r117806  
    2525Testing add in presence of trailing white spaces.
    2626PASS element.className is "x y"
    27 PASS element.className is "x    y"
     27PASS element.className is "x\t y"
    2828PASS element.className is " y"
    2929Test invalid tokens
  • trunk/LayoutTests/fast/dom/HTMLOutputElement/dom-settable-token-list-expected.txt

    r71373 r117806  
    2727- Testing add in presence of trailing white spaces.
    2828PASS element.htmlFor.toString() is "x y"
    29 PASS element.htmlFor.toString() is "x    y"
     29PASS element.htmlFor.toString() is "x\t y"
    3030PASS element.htmlFor.toString() is " y"
    3131- Test invalid tokens
  • trunk/LayoutTests/fast/js/resources/js-test-pre.js

    r116511 r117806  
    6969        (document.head || document.documentElement).appendChild(styleElement);
    7070    }
    71    
     71
    7272    if (!isWorker())
    7373        insertStyleSheet();
     
    259259function shouldBeEqualToString(a, b)
    260260{
    261   var unevaledString = '"' + b.replace(/\\/g, "\\\\").replace(/"/g, "\"").replace(/\n/g, "\\n").replace(/\r/g, "\\r") + '"';
     261  if (typeof a !== "string" || typeof b !== "string")
     262    debug("WARN: shouldBeEqualToString() expects string arguments");
     263  var unevaledString = JSON.stringify(b);
    262264  shouldBe(a, unevaledString);
    263265}
  • trunk/LayoutTests/fast/js/resources/standalone-pre.js

    r107997 r117806  
    9999function shouldBeEqualToString(a, b)
    100100{
    101   var unevaledString = '"' + b.replace(/\\/g, "\\\\").replace(/"/g, "\"").replace(/\n/g, "\\n").replace(/\r/g, "\\r") + '"';
     101  if (typeof a !== "string" || typeof b !== "string")
     102    debug("WARN: shouldBeEqualToString() expects string arguments");
     103  var unevaledString = JSON.stringify(b);
    102104  shouldBe(a, unevaledString);
    103105}
  • trunk/LayoutTests/storage/domstorage/complex-values-expected.txt

    r64796 r117806  
    8383storage.foo10 = k
    8484PASS typeof storage['foo10'] is "string"
    85 PASS storage['foo10'] is "ÿ찡\0hello"
     85PASS storage['foo10'] is "ÿ찡\u0000hello"
    8686PASS typeof storage.foo10 is "string"
    87 PASS storage.foo10 is "ÿ찡\0hello"
     87PASS storage.foo10 is "ÿ찡\u0000hello"
    8888PASS typeof storage.getItem('foo10') is "string"
    89 PASS storage.getItem('foo10') is "ÿ찡\0hello"
     89PASS storage.getItem('foo10') is "ÿ찡\u0000hello"
    9090storage['foo11'] = k
    9191PASS typeof storage['foo11'] is "string"
    92 PASS storage['foo11'] is "ÿ찡\0hello"
     92PASS storage['foo11'] is "ÿ찡\u0000hello"
    9393PASS typeof storage.foo11 is "string"
    94 PASS storage.foo11 is "ÿ찡\0hello"
     94PASS storage.foo11 is "ÿ찡\u0000hello"
    9595PASS typeof storage.getItem('foo11') is "string"
    96 PASS storage.getItem('foo11') is "ÿ찡\0hello"
     96PASS storage.getItem('foo11') is "ÿ찡\u0000hello"
    9797storage.setItem('foo12', k)
    9898PASS typeof storage['foo12'] is "string"
    99 PASS storage['foo12'] is "ÿ찡\0hello"
     99PASS storage['foo12'] is "ÿ찡\u0000hello"
    100100PASS typeof storage.foo12 is "string"
    101 PASS storage.foo12 is "ÿ찡\0hello"
     101PASS storage.foo12 is "ÿ찡\u0000hello"
    102102PASS typeof storage.getItem('foo12') is "string"
    103 PASS storage.getItem('foo12') is "ÿ찡\0hello"
     103PASS storage.getItem('foo12') is "ÿ찡\u0000hello"
    104104
    105105
     
    183183storage.foo10 = k
    184184PASS typeof storage['foo10'] is "string"
    185 PASS storage['foo10'] is "ÿ찡\0hello"
     185PASS storage['foo10'] is "ÿ찡\u0000hello"
    186186PASS typeof storage.foo10 is "string"
    187 PASS storage.foo10 is "ÿ찡\0hello"
     187PASS storage.foo10 is "ÿ찡\u0000hello"
    188188PASS typeof storage.getItem('foo10') is "string"
    189 PASS storage.getItem('foo10') is "ÿ찡\0hello"
     189PASS storage.getItem('foo10') is "ÿ찡\u0000hello"
    190190storage['foo11'] = k
    191191PASS typeof storage['foo11'] is "string"
    192 PASS storage['foo11'] is "ÿ찡\0hello"
     192PASS storage['foo11'] is "ÿ찡\u0000hello"
    193193PASS typeof storage.foo11 is "string"
    194 PASS storage.foo11 is "ÿ찡\0hello"
     194PASS storage.foo11 is "ÿ찡\u0000hello"
    195195PASS typeof storage.getItem('foo11') is "string"
    196 PASS storage.getItem('foo11') is "ÿ찡\0hello"
     196PASS storage.getItem('foo11') is "ÿ찡\u0000hello"
    197197storage.setItem('foo12', k)
    198198PASS typeof storage['foo12'] is "string"
    199 PASS storage['foo12'] is "ÿ찡\0hello"
     199PASS storage['foo12'] is "ÿ찡\u0000hello"
    200200PASS typeof storage.foo12 is "string"
    201 PASS storage.foo12 is "ÿ찡\0hello"
     201PASS storage.foo12 is "ÿ찡\u0000hello"
    202202PASS typeof storage.getItem('foo12') is "string"
    203 PASS storage.getItem('foo12') is "ÿ찡\0hello"
     203PASS storage.getItem('foo12') is "ÿ찡\u0000hello"
    204204PASS successfullyParsed is true
    205205
  • trunk/LayoutTests/storage/indexeddb/cursor-advance-expected.txt

    r116337 r117806  
    3636request = store.openCursor()
    3737cursor.advance(1)
    38 PASS expected is '{"key":"237-23-7733","value":{"name":"Ann","height":52,"weight":110},"primaryKey":"237-23-7733"}'
     38PASS expected is "{\"key\":\"237-23-7733\",\"value\":{\"name\":\"Ann\",\"height\":52,\"weight\":110},\"primaryKey\":\"237-23-7733\"}"
    3939testContinueThenAdvance()
    4040trans = db.transaction(objectStoreName)
     
    4545cursor.continue();
    4646cursor.advance(1)
    47 PASS expected is '{"key":"237-23-7736","value":{"name":"Joe","height":65,"weight":150},"primaryKey":"237-23-7736"}'
     47PASS expected is "{\"key\":\"237-23-7736\",\"value\":{\"name\":\"Joe\",\"height\":65,\"weight\":150},\"primaryKey\":\"237-23-7736\"}"
    4848testAdvanceMultiple()
    4949trans = db.transaction(objectStoreName)
     
    5151request = store.openCursor()
    5252cursor.advance(3)
    53 PASS expected is '{"key":"237-23-7735","value":{"name":"Sue","height":58,"weight":130},"primaryKey":"237-23-7735"}'
     53PASS expected is "{\"key\":\"237-23-7735\",\"value\":{\"name\":\"Sue\",\"height\":58,\"weight\":130},\"primaryKey\":\"237-23-7735\"}"
    5454testAdvanceIndex()
    5555trans = db.transaction(objectStoreName)
     
    5757request = store.openCursor()
    5858cursor.advance(3)
    59 PASS expected is '{"key":"Jef","value":{"name":"Jef","height":65,"weight":120},"primaryKey":"237-23-7739"}'
     59PASS expected is "{\"key\":\"Jef\",\"value\":{\"name\":\"Jef\",\"height\":65,\"weight\":120},\"primaryKey\":\"237-23-7739\"}"
    6060testAdvanceIndexNoDupe()
    6161trans = db.transaction(objectStoreName)
     
    6363request = store.openCursor(null, 'nextunique')
    6464cursor.advance(3)
    65 PASS expected is '{"key":130,"value":{"name":"Sue","height":58,"weight":130},"primaryKey":"237-23-7735"}'
     65PASS expected is "{\"key\":130,\"value\":{\"name\":\"Sue\",\"height\":58,\"weight\":130},\"primaryKey\":\"237-23-7735\"}"
    6666testAdvanceIndexPrev()
    6767trans = db.transaction(objectStoreName)
     
    6969request = store.openCursor(null, 'prev')
    7070cursor.advance(3)
    71 PASS expected is '{"key":150,"value":{"name":"Joe","height":65,"weight":150},"primaryKey":"237-23-7736"}'
     71PASS expected is "{\"key\":150,\"value\":{\"name\":\"Joe\",\"height\":65,\"weight\":150},\"primaryKey\":\"237-23-7736\"}"
    7272testAdvanceIndexPrevNoDupe()
    7373trans = db.transaction(objectStoreName)
     
    7575request = store.openCursor(null, 'prevunique')
    7676cursor.advance(3)
    77 PASS expected is '{"key":120,"value":{"name":"Bob","height":60,"weight":120},"primaryKey":"237-23-7732"}'
     77PASS expected is "{\"key\":120,\"value\":{\"name\":\"Bob\",\"height\":60,\"weight\":120},\"primaryKey\":\"237-23-7732\"}"
    7878testAdvanceToEnd()
    7979trans = db.transaction(objectStoreName)
     
    8181request = store.openCursor()
    8282cursor.advance(100)
    83 PASS expected is 'null'
     83PASS expected is "null"
    8484testPrefetchInRange()
    8585trans = db.transaction(objectStoreName)
    8686objectStore = trans.objectStore(objectStoreName)
    8787request = objectStore.openCursor()
    88 PASS expected is '{"key":"237-23-7732","value":{"name":"Bob","height":60,"weight":120},"primaryKey":"237-23-7732"}'
     88PASS expected is "{\"key\":\"237-23-7732\",\"value\":{\"name\":\"Bob\",\"height\":60,\"weight\":120},\"primaryKey\":\"237-23-7732\"}"
    8989cursor.continue()
    90 PASS expected is '{"key":"237-23-7733","value":{"name":"Ann","height":52,"weight":110},"primaryKey":"237-23-7733"}'
     90PASS expected is "{\"key\":\"237-23-7733\",\"value\":{\"name\":\"Ann\",\"height\":52,\"weight\":110},\"primaryKey\":\"237-23-7733\"}"
    9191cursor.continue()
    92 PASS expected is '{"key":"237-23-7734","value":{"name":"Ron","height":73,"weight":180},"primaryKey":"237-23-7734"}'
     92PASS expected is "{\"key\":\"237-23-7734\",\"value\":{\"name\":\"Ron\",\"height\":73,\"weight\":180},\"primaryKey\":\"237-23-7734\"}"
    9393cursor.continue()
    94 PASS expected is '{"key":"237-23-7735","value":{"name":"Sue","height":58,"weight":130},"primaryKey":"237-23-7735"}'
     94PASS expected is "{\"key\":\"237-23-7735\",\"value\":{\"name\":\"Sue\",\"height\":58,\"weight\":130},\"primaryKey\":\"237-23-7735\"}"
    9595cursor.advance(2)
    96 PASS expected is '{"key":"237-23-7737","value":{"name":"Pat","height":65,"weight":100},"primaryKey":"237-23-7737"}'
     96PASS expected is "{\"key\":\"237-23-7737\",\"value\":{\"name\":\"Pat\",\"height\":65,\"weight\":100},\"primaryKey\":\"237-23-7737\"}"
    9797cursor.continue()
    98 PASS expected is '{"key":"237-23-7738","value":{"name":"Leo","height":65,"weight":180},"primaryKey":"237-23-7738"}'
     98PASS expected is "{\"key\":\"237-23-7738\",\"value\":{\"name\":\"Leo\",\"height\":65,\"weight\":180},\"primaryKey\":\"237-23-7738\"}"
    9999cursor.continue()
    100 PASS expected is '{"key":"237-23-7739","value":{"name":"Jef","height":65,"weight":120},"primaryKey":"237-23-7739"}'
     100PASS expected is "{\"key\":\"237-23-7739\",\"value\":{\"name\":\"Jef\",\"height\":65,\"weight\":120},\"primaryKey\":\"237-23-7739\"}"
    101101cursor.continue()
    102 PASS expected is '{"key":"237-23-7740","value":{"name":"Sam","height":71,"weight":110},"primaryKey":"237-23-7740"}'
     102PASS expected is "{\"key\":\"237-23-7740\",\"value\":{\"name\":\"Sam\",\"height\":71,\"weight\":110},\"primaryKey\":\"237-23-7740\"}"
    103103cursor.continue()
    104 PASS expected is '{"key":"237-23-7741","value":{"name":"Bug","height":63,"weight":100},"primaryKey":"237-23-7741"}'
     104PASS expected is "{\"key\":\"237-23-7741\",\"value\":{\"name\":\"Bug\",\"height\":63,\"weight\":100},\"primaryKey\":\"237-23-7741\"}"
    105105cursor.continue()
    106 PASS expected is '{"key":"237-23-7742","value":{"name":"Tub","height":69,"weight":180},"primaryKey":"237-23-7742"}'
     106PASS expected is "{\"key\":\"237-23-7742\",\"value\":{\"name\":\"Tub\",\"height\":69,\"weight\":180},\"primaryKey\":\"237-23-7742\"}"
    107107cursor.continue()
    108 PASS expected is '{"key":"237-23-7743","value":{"name":"Rug","height":77,"weight":120},"primaryKey":"237-23-7743"}'
     108PASS expected is "{\"key\":\"237-23-7743\",\"value\":{\"name\":\"Rug\",\"height\":77,\"weight\":120},\"primaryKey\":\"237-23-7743\"}"
    109109cursor.continue()
    110 PASS expected is '{"key":"237-23-7744","value":{"name":"Pug","height":66,"weight":110},"primaryKey":"237-23-7744"}'
     110PASS expected is "{\"key\":\"237-23-7744\",\"value\":{\"name\":\"Pug\",\"height\":66,\"weight\":110},\"primaryKey\":\"237-23-7744\"}"
    111111cursor.continue()
    112112testPrefetchOutOfRange()
     
    114114objectStore = trans.objectStore(objectStoreName)
    115115request = objectStore.openCursor()
    116 PASS expected is '{"key":"237-23-7732","value":{"name":"Bob","height":60,"weight":120},"primaryKey":"237-23-7732"}'
     116PASS expected is "{\"key\":\"237-23-7732\",\"value\":{\"name\":\"Bob\",\"height\":60,\"weight\":120},\"primaryKey\":\"237-23-7732\"}"
    117117cursor.continue()
    118 PASS expected is '{"key":"237-23-7733","value":{"name":"Ann","height":52,"weight":110},"primaryKey":"237-23-7733"}'
     118PASS expected is "{\"key\":\"237-23-7733\",\"value\":{\"name\":\"Ann\",\"height\":52,\"weight\":110},\"primaryKey\":\"237-23-7733\"}"
    119119cursor.continue()
    120 PASS expected is '{"key":"237-23-7734","value":{"name":"Ron","height":73,"weight":180},"primaryKey":"237-23-7734"}'
     120PASS expected is "{\"key\":\"237-23-7734\",\"value\":{\"name\":\"Ron\",\"height\":73,\"weight\":180},\"primaryKey\":\"237-23-7734\"}"
    121121cursor.continue()
    122 PASS expected is '{"key":"237-23-7735","value":{"name":"Sue","height":58,"weight":130},"primaryKey":"237-23-7735"}'
     122PASS expected is "{\"key\":\"237-23-7735\",\"value\":{\"name\":\"Sue\",\"height\":58,\"weight\":130},\"primaryKey\":\"237-23-7735\"}"
    123123cursor.advance(7)
    124 PASS expected is '{"key":"237-23-7742","value":{"name":"Tub","height":69,"weight":180},"primaryKey":"237-23-7742"}'
     124PASS expected is "{\"key\":\"237-23-7742\",\"value\":{\"name\":\"Tub\",\"height\":69,\"weight\":180},\"primaryKey\":\"237-23-7742\"}"
    125125cursor.continue()
    126 PASS expected is '{"key":"237-23-7743","value":{"name":"Rug","height":77,"weight":120},"primaryKey":"237-23-7743"}'
     126PASS expected is "{\"key\":\"237-23-7743\",\"value\":{\"name\":\"Rug\",\"height\":77,\"weight\":120},\"primaryKey\":\"237-23-7743\"}"
    127127cursor.continue()
    128 PASS expected is '{"key":"237-23-7744","value":{"name":"Pug","height":66,"weight":110},"primaryKey":"237-23-7744"}'
     128PASS expected is "{\"key\":\"237-23-7744\",\"value\":{\"name\":\"Pug\",\"height\":66,\"weight\":110},\"primaryKey\":\"237-23-7744\"}"
    129129cursor.continue()
    130130testBadAdvance()
     
    139139objectStore = trans.objectStore(objectStoreName)
    140140request = objectStore.openCursor()
    141 PASS expected is '{"key":"237-23-7732","value":{"name":"Bob","height":60,"weight":120},"primaryKey":"237-23-7732"}'
     141PASS expected is "{\"key\":\"237-23-7732\",\"value\":{\"name\":\"Bob\",\"height\":60,\"weight\":120},\"primaryKey\":\"237-23-7732\"}"
    142142cursor.advance(1)
    143 PASS expected is '{"key":"237-23-7733","value":{"name":"Ann","height":52,"weight":110},"primaryKey":"237-23-7733"}'
     143PASS expected is "{\"key\":\"237-23-7733\",\"value\":{\"name\":\"Ann\",\"height\":52,\"weight\":110},\"primaryKey\":\"237-23-7733\"}"
    144144cursor.advance(1)
    145 PASS expected is '{"key":"237-23-7734","value":{"name":"Ron","height":73,"weight":180},"primaryKey":"237-23-7734"}'
     145PASS expected is "{\"key\":\"237-23-7734\",\"value\":{\"name\":\"Ron\",\"height\":73,\"weight\":180},\"primaryKey\":\"237-23-7734\"}"
    146146cursor.delete()
    147 PASS expected is '{"key":"237-23-7738","value":{"name":"Leo","height":65,"weight":180},"primaryKey":"237-23-7738"}'
     147PASS expected is "{\"key\":\"237-23-7738\",\"value\":{\"name\":\"Leo\",\"height\":65,\"weight\":180},\"primaryKey\":\"237-23-7738\"}"
    148148cursor.advance(1)
    149 PASS expected is '{"key":"237-23-7739","value":{"name":"Jef","height":65,"weight":120},"primaryKey":"237-23-7739"}'
     149PASS expected is "{\"key\":\"237-23-7739\",\"value\":{\"name\":\"Jef\",\"height\":65,\"weight\":120},\"primaryKey\":\"237-23-7739\"}"
    150150cursor.advance(1)
    151 PASS expected is '{"key":"237-23-7740","value":{"name":"Sam","height":71,"weight":110},"primaryKey":"237-23-7740"}'
     151PASS expected is "{\"key\":\"237-23-7740\",\"value\":{\"name\":\"Sam\",\"height\":71,\"weight\":110},\"primaryKey\":\"237-23-7740\"}"
    152152cursor.advance(1)
    153 PASS expected is '{"key":"237-23-7741","value":{"name":"Bug","height":63,"weight":100},"primaryKey":"237-23-7741"}'
     153PASS expected is "{\"key\":\"237-23-7741\",\"value\":{\"name\":\"Bug\",\"height\":63,\"weight\":100},\"primaryKey\":\"237-23-7741\"}"
    154154cursor.advance(1)
    155 PASS expected is '{"key":"237-23-7742","value":{"name":"Tub","height":69,"weight":180},"primaryKey":"237-23-7742"}'
     155PASS expected is "{\"key\":\"237-23-7742\",\"value\":{\"name\":\"Tub\",\"height\":69,\"weight\":180},\"primaryKey\":\"237-23-7742\"}"
    156156cursor.advance(1)
    157 PASS expected is '{"key":"237-23-7743","value":{"name":"Rug","height":77,"weight":120},"primaryKey":"237-23-7743"}'
     157PASS expected is "{\"key\":\"237-23-7743\",\"value\":{\"name\":\"Rug\",\"height\":77,\"weight\":120},\"primaryKey\":\"237-23-7743\"}"
    158158cursor.advance(1)
    159 PASS expected is '{"key":"237-23-7744","value":{"name":"Pug","height":66,"weight":110},"primaryKey":"237-23-7744"}'
     159PASS expected is "{\"key\":\"237-23-7744\",\"value\":{\"name\":\"Pug\",\"height\":66,\"weight\":110},\"primaryKey\":\"237-23-7744\"}"
    160160cursor.advance(1)
    161161PASS successfullyParsed is true
  • trunk/LayoutTests/storage/indexeddb/resources/cursor-advance.js

    r116337 r117806  
    138138{
    139139    expected = JSON.stringify(expectedValue);
    140     shouldBe("expected", "'" + JSON.stringify(simplifyCursor(cursor)) + "'");
     140    shouldBeEqualToString("expected", JSON.stringify(simplifyCursor(cursor)));
    141141}
    142142
Note: See TracChangeset for help on using the changeset viewer.