tizen beta release
[profile/ivi/webkit-efl.git] / LayoutTests / fast / js / script-tests / eval-var-decl.js
1 description(
2 "This test case checks whether variables cause properties to be defined even before reaching the declaration statement in various cases."
3 );
4
5 shouldBeTrue('this.hasOwnProperty("foo")');
6 var foo = 3;
7
8 delete bar;
9 shouldBeTrue('this.hasOwnProperty("bar")');
10 var bar = 3;
11
12 var firstEvalResult = eval('var result = this.hasOwnProperty("y"); var y = 3; result');
13 shouldBeTrue("firstEvalResult");
14
15 var secondEvalResult = eval('delete x; var result = this.hasOwnProperty("x"); var x = 3; result');
16 shouldBeFalse("secondEvalResult");
17
18 var thirdEvalResult = false;
19 try {
20     thirdEvalResult = (function(){ var x=false; try { throw ""; } catch (e) { eval("var x = true;"); } return x; })();
21 } catch (e) {
22     thirdEvalResult = "Threw exception!";
23 }
24 shouldBeTrue("thirdEvalResult");