Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / js / script-tests / cyclic-ref-toString.js
blob0e002ddbcaa5bd265827578dbb2196fc344ea3c8
1 description(
2 "This will test Array.toString with circular references. If an element contains a reference to itself or one of its children (at any depth) contains a reference to it, it will be skipped. This can result in either a trailing ',' (if the self reference is at the end of the array) or ',,' if the self reference is contained at some mid point in the array."
3 );
5 var ary1=[1,2];
6 ary1.push(ary1);
7 shouldBe("ary1.toString()", "'1,2,'");
9 ary1=[1,2];
10 var ary2=[3,4];
11 ary1.push(ary2);
12 ary2.push(ary1);
13 shouldBe("ary1.toString()", "'1,2,3,4,'");
15 ary1.push(5);
16 shouldBe("ary1.toString()", "'1,2,3,4,,5'");