1935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.org// Copyright 2013 the V8 project authors. All rights reserved.
2935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.org// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.org//
4935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.org// Redistribution and use in source and binary forms, with or without
5935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.org// modification, are permitted provided that the following conditions
6935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.org// are met:
7935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.org// 1.  Redistributions of source code must retain the above copyright
8935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.org//     notice, this list of conditions and the following disclaimer.
9935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.org// 2.  Redistributions in binary form must reproduce the above copyright
10935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.org//     notice, this list of conditions and the following disclaimer in the
11935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.org//     documentation and/or other materials provided with the distribution.
12935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.org//
13935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.org// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
14935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.org// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.org// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.org// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
17935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.org// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.org// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.org// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.org// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.org// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.org// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.org
24935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.orgdescription("KDE JS Test");
25935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.orgvar i = 1;
26935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.org
27935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.orgfunction foo() {
28935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.org  i = 2;
29935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.org  return;
30935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.org  i = 3;
31935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.org}
32935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.org
33935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.orgshouldBe("foo(), i", "2");
34935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.org
35935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.orgvar caught = false;
36935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.orgtry { eval("return;"); } catch(e) { caught = true; }
37935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.orgshouldBeTrue("caught");
38935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.org
39935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.org// value completions take precedence
40935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.orgvar val = eval("11; { }");
41935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.orgshouldBe("val", "11");
42935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.orgval = eval("12; ;");
43935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.orgshouldBe("val", "12");
44935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.orgval = eval("13; if(false);");
45935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.orgshouldBe("val", "13");
46935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.orgval = eval("14; function f() {}");
47935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.orgshouldBe("val", "14");
48935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.orgval = eval("15; var v = 0");
49935781b3604caa053bf75ce6b1079d79a225e63fdanno@chromium.orgshouldBe("val", "15");