Test some corner case DOM Storage values.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


Testing sessionStorage
storage.clear()
PASS storage.length is 0

PASS typeof storage['foo'] is "undefined"
PASS storage['foo'] is undefined.
PASS typeof storage.foo is "undefined"
PASS storage.foo is undefined.
PASS typeof storage.getItem('foo') is "object"
PASS storage.getItem('foo') is null

storage.foo1 = null
PASS typeof storage['foo1'] is "string"
PASS storage['foo1'] is "null"
PASS typeof storage.foo1 is "string"
PASS storage.foo1 is "null"
PASS typeof storage.getItem('foo1') is "string"
PASS storage.getItem('foo1') is "null"
storage['foo2'] = null
PASS typeof storage['foo2'] is "string"
PASS storage['foo2'] is "null"
PASS typeof storage.foo2 is "string"
PASS storage.foo2 is "null"
PASS typeof storage.getItem('foo2') is "string"
PASS storage.getItem('foo2') is "null"
storage.setItem('foo3', null)
PASS typeof storage['foo3'] is "string"
PASS storage['foo3'] is "null"
PASS typeof storage.foo3 is "string"
PASS storage.foo3 is "null"
PASS typeof storage.getItem('foo3') is "string"
PASS storage.getItem('foo3') is "null"

storage.foo4 = undefined
PASS typeof storage['foo4'] is "string"
PASS storage['foo4'] is "undefined"
PASS typeof storage.foo4 is "string"
PASS storage.foo4 is "undefined"
PASS typeof storage.getItem('foo4') is "string"
PASS storage.getItem('foo4') is "undefined"
storage['foo5'] = undefined
PASS typeof storage['foo5'] is "string"
PASS storage['foo5'] is "undefined"
PASS typeof storage.foo5 is "string"
PASS storage.foo5 is "undefined"
PASS typeof storage.getItem('foo5') is "string"
PASS storage.getItem('foo5') is "undefined"
storage.setItem('foo6', undefined)
PASS typeof storage['foo6'] is "string"
PASS storage['foo6'] is "undefined"
PASS typeof storage.foo6 is "string"
PASS storage.foo6 is "undefined"
PASS typeof storage.getItem('foo6') is "string"
PASS storage.getItem('foo6') is "undefined"

storage.foo7 = 2
PASS typeof storage['foo7'] is "string"
PASS storage['foo7'] is "2"
PASS typeof storage.foo7 is "string"
PASS storage.foo7 is "2"
PASS typeof storage.getItem('foo7') is "string"
PASS storage.getItem('foo7') is "2"
storage['foo8'] = 2
PASS typeof storage['foo8'] is "string"
PASS storage['foo8'] is "2"
PASS typeof storage.foo8 is "string"
PASS storage.foo8 is "2"
PASS typeof storage.getItem('foo8') is "string"
PASS storage.getItem('foo8') is "2"
storage.setItem('foo9', 2)
PASS typeof storage['foo9'] is "string"
PASS storage['foo9'] is "2"
PASS typeof storage.foo9 is "string"
PASS storage.foo9 is "2"
PASS typeof storage.getItem('foo9') is "string"
PASS storage.getItem('foo9') is "2"

storage.foo10 = k
PASS typeof storage['foo10'] is "string"
PASS storage['foo10'] is "ÿ찡\0hello"
PASS typeof storage.foo10 is "string"
PASS storage.foo10 is "ÿ찡\0hello"
PASS typeof storage.getItem('foo10') is "string"
PASS storage.getItem('foo10') is "ÿ찡\0hello"
storage['foo11'] = k
PASS typeof storage['foo11'] is "string"
PASS storage['foo11'] is "ÿ찡\0hello"
PASS typeof storage.foo11 is "string"
PASS storage.foo11 is "ÿ찡\0hello"
PASS typeof storage.getItem('foo11') is "string"
PASS storage.getItem('foo11') is "ÿ찡\0hello"
storage.setItem('foo12', k)
PASS typeof storage['foo12'] is "string"
PASS storage['foo12'] is "ÿ찡\0hello"
PASS typeof storage.foo12 is "string"
PASS storage.foo12 is "ÿ찡\0hello"
PASS typeof storage.getItem('foo12') is "string"
PASS storage.getItem('foo12') is "ÿ찡\0hello"


Testing localStorage
storage.clear()
PASS storage.length is 0

PASS typeof storage['foo'] is "undefined"
PASS storage['foo'] is undefined.
PASS typeof storage.foo is "undefined"
PASS storage.foo is undefined.
PASS typeof storage.getItem('foo') is "object"
PASS storage.getItem('foo') is null

storage.foo1 = null
PASS typeof storage['foo1'] is "string"
PASS storage['foo1'] is "null"
PASS typeof storage.foo1 is "string"
PASS storage.foo1 is "null"
PASS typeof storage.getItem('foo1') is "string"
PASS storage.getItem('foo1') is "null"
storage['foo2'] = null
PASS typeof storage['foo2'] is "string"
PASS storage['foo2'] is "null"
PASS typeof storage.foo2 is "string"
PASS storage.foo2 is "null"
PASS typeof storage.getItem('foo2') is "string"
PASS storage.getItem('foo2') is "null"
storage.setItem('foo3', null)
PASS typeof storage['foo3'] is "string"
PASS storage['foo3'] is "null"
PASS typeof storage.foo3 is "string"
PASS storage.foo3 is "null"
PASS typeof storage.getItem('foo3') is "string"
PASS storage.getItem('foo3') is "null"

storage.foo4 = undefined
PASS typeof storage['foo4'] is "string"
PASS storage['foo4'] is "undefined"
PASS typeof storage.foo4 is "string"
PASS storage.foo4 is "undefined"
PASS typeof storage.getItem('foo4') is "string"
PASS storage.getItem('foo4') is "undefined"
storage['foo5'] = undefined
PASS typeof storage['foo5'] is "string"
PASS storage['foo5'] is "undefined"
PASS typeof storage.foo5 is "string"
PASS storage.foo5 is "undefined"
PASS typeof storage.getItem('foo5') is "string"
PASS storage.getItem('foo5') is "undefined"
storage.setItem('foo6', undefined)
PASS typeof storage['foo6'] is "string"
PASS storage['foo6'] is "undefined"
PASS typeof storage.foo6 is "string"
PASS storage.foo6 is "undefined"
PASS typeof storage.getItem('foo6') is "string"
PASS storage.getItem('foo6') is "undefined"

storage.foo7 = 2
PASS typeof storage['foo7'] is "string"
PASS storage['foo7'] is "2"
PASS typeof storage.foo7 is "string"
PASS storage.foo7 is "2"
PASS typeof storage.getItem('foo7') is "string"
PASS storage.getItem('foo7') is "2"
storage['foo8'] = 2
PASS typeof storage['foo8'] is "string"
PASS storage['foo8'] is "2"
PASS typeof storage.foo8 is "string"
PASS storage.foo8 is "2"
PASS typeof storage.getItem('foo8') is "string"
PASS storage.getItem('foo8') is "2"
storage.setItem('foo9', 2)
PASS typeof storage['foo9'] is "string"
PASS storage['foo9'] is "2"
PASS typeof storage.foo9 is "string"
PASS storage.foo9 is "2"
PASS typeof storage.getItem('foo9') is "string"
PASS storage.getItem('foo9') is "2"

storage.foo10 = k
PASS typeof storage['foo10'] is "string"
PASS storage['foo10'] is "ÿ찡\0hello"
PASS typeof storage.foo10 is "string"
PASS storage.foo10 is "ÿ찡\0hello"
PASS typeof storage.getItem('foo10') is "string"
PASS storage.getItem('foo10') is "ÿ찡\0hello"
storage['foo11'] = k
PASS typeof storage['foo11'] is "string"
PASS storage['foo11'] is "ÿ찡\0hello"
PASS typeof storage.foo11 is "string"
PASS storage.foo11 is "ÿ찡\0hello"
PASS typeof storage.getItem('foo11') is "string"
PASS storage.getItem('foo11') is "ÿ찡\0hello"
storage.setItem('foo12', k)
PASS typeof storage['foo12'] is "string"
PASS storage['foo12'] is "ÿ찡\0hello"
PASS typeof storage.foo12 is "string"
PASS storage.foo12 is "ÿ찡\0hello"
PASS typeof storage.getItem('foo12') is "string"
PASS storage.getItem('foo12') is "ÿ찡\0hello"
PASS successfullyParsed is true

TEST COMPLETE

