Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Unified Diff: test/webkit/fast/js/kde/scope.js

Issue 21070002: Migrate more tests from blink repository. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/webkit/fast/js/kde/prototype_proto-expected.txt ('k') | test/webkit/fast/js/kde/scope-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/webkit/fast/js/kde/scope.js
diff --git a/test/webkit/do-while-semicolon.js b/test/webkit/fast/js/kde/scope.js
similarity index 66%
copy from test/webkit/do-while-semicolon.js
copy to test/webkit/fast/js/kde/scope.js
index cd7cf4c1028ce794b17dbb326b77804aec0d5ac1..cead049be8e79df27c4f19a70274096eaea19f65 100644
--- a/test/webkit/do-while-semicolon.js
+++ b/test/webkit/fast/js/kde/scope.js
@@ -21,47 +21,38 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-description(
-"This test checks that toString() round-trip on a function that has do..while in JavaScript does not insert extra semicolon."
-);
+description("KDE JS Test");
+var b = new Boolean();
+b.x = 11;
-function f1() {
- do {} while(0);
+with (b) {
+ f = function(a) { return a*x; } // remember scope chain
}
-function f2() {
- do {} while(0)
-}
+shouldBe("f(2)", "22");
-function f3() {
- do {} while(0) ;
+var OBJECT = new MyObject( "hello" );
+function MyObject(value) {
+ this.value = value;
+ this.toString = new Function( "return this.value+''" );
+ return this;
}
-
-function f4() {
- do {} while(0) /*empty*/ ;
+shouldBe("OBJECT.toString()", "'hello'");
+var s;
+with (OBJECT) {
+ s = toString();
}
+shouldBe("s", "'hello'");
+// Make sure that for ... in reevaluates the scoping every time!
+P = { foo : 1, bar : 2, baz : 3 }
-if (typeof uneval == "undefined")
- uneval = function(x) { return '(' + x.toString()+ ')'; }
-
-
-uf1 = uneval(f1);
-ueuf1 = uneval(eval(uneval(f1)));
-
-uf2 = uneval(f2);
-ueuf2 = uneval(eval(uneval(f2)));
-
-uf3 = uneval(f3);
-ueuf3 = uneval(eval(uneval(f3)));
-
-uf4 = uneval(f4);
-ueuf4 = uneval(eval(uneval(f4)));
-
-
+function testForIn() {
+ for (g in P) {
+ eval("var g;") //Change the scope of g half-ways through the loop
+ }
+}
-shouldBe("ueuf1", "uf1");
-shouldBe("ueuf2", "uf2");
-shouldBe("ueuf3", "uf3");
-shouldBe("ueuf4", "uf4");
+testForIn();
+shouldBe("g", "'foo'"); //Before the eval, g was in outer scope, but not after!
« no previous file with comments | « test/webkit/fast/js/kde/prototype_proto-expected.txt ('k') | test/webkit/fast/js/kde/scope-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698