Permalink
Browse files

Expand FBTest for 4233 to accommodate issue 5534

  • Loading branch information...
1 parent d6a56c5 commit 017f745ea25931f1a10c15b901cf652b843fe6c0 @simonlindholm committed Jun 9, 2012
@@ -38,13 +38,16 @@
<li><code style="color:green">id(1)/i</code></li>
<li><code style="color:green">(1)/i</code></li>
<li><code style="color:green">/a/.t</code></li>
- <li><code style="color:green">(1)/i</code></li>
<li><code style="color:green">var a = i</code></li>
<li><code style="color:green">if(1){i</code></li>
<li><code style="color:green">a=0;{i</code></li>
+ <li><code style="color:green">a=0;try{i</code></li>
+ <li><code style="color:green">if(0) ; else { i</code></li>
+ <li><code style="color:green">throw f(i</code></li>
<li><code style="color:green">({a: i</code></li>
<li><code style="color:green">{i</code></li>
<li><code style="color:green">{a: window, i</code></li>
+ <li><code style="color:green">id.get+(i</code></li>
<li><code style="color:green">date().g</code></li>
<li><code style="color:green">mk4().c</code></li>
<li><code style="color:green">mk4().chain().c</code></li>
@@ -57,7 +60,7 @@
and doesn't appear for:
<ul>
<li><code style="color:green">if(1)/i</code></li>
- <li><code style="color:green">if(1)/i</code></li>
+ <li><code style="color:green">if(0);else/i</code></li>
<li><code style="color:green">(function()/i</code></li>
<li><code style="color:green">/[/; i</code></li>
<li><code style="color:green">1+/i</code></li>
@@ -66,13 +69,16 @@
<li><code style="color:green">var i</code></li>
<li><code style="color:green">var a = 0, i</code></li>
<li><code style="color:green">var a, i</code></li>
+ <li><code style="color:green">throw {i</code></li>
<li><code style="color:green">({ i</code></li>
<li><code style="color:green">({a: window, i</code></li>
<li><code style="color:green">function(i</code></li>
+ <li><code style="color:green">function &nbsp;(i</code></li>
<li><code style="color:green">function f(i</code></li>
<li><code style="color:green">f=function(i</code></li>
<li><code style="color:green">function i</code></li>
<li><code style="color:green">function([i</code></li>
+ <li><code style="color:green">[{set a([i</code></li>
<li><code style="color:green">id(eval('window')).i</code></li>
<li><code style="color:green">(window).i</code></li>
<li><code style="color:green">q='';q.s</code></li>
@@ -6,7 +6,26 @@ function runTest()
FBTest.openFirebug();
FBTest.enableConsolePanel(function(win)
{
- var panel = FW.Firebug.chrome.selectPanel("console");
+ FW.Firebug.chrome.selectPanel("console");
+ var doc = FW.Firebug.chrome.window.document;
+ var cmdLine = doc.getElementById("fbCommandLine");
+ var completionBox = doc.getElementById("fbCommandLineCompletion");
+
+ // xxxHonza: This should be polished and moved into FBTest namespace.
+ function testExpression(callback, expr, shouldComplete)
+ {
+ // To save on time, only send the last character as a key press.
+ cmdLine.focus();
+ cmdLine.value = expr.slice(0, -1);
+ FBTest.synthesizeKey(expr.slice(-1), null, win);
+
+ var hasCompletion = (completionBox.value.length > cmdLine.value.length);
+ FBTest.compare(shouldComplete, hasCompletion,
+ "Completions should " + (shouldComplete ? "" : "not ") +
+ "appear for: " + expr);
+
+ callback();
+ }
var tests = [
["i", true],
@@ -29,9 +48,8 @@ function runTest()
["id(1)/i", true],
["(1)/i", true],
["/a/.t", true],
- ["(1)/i", true],
- ["if(1)/i", false],
["if(1)/i", false],
+ ["if(0);else/i", false],
["(function()/i", false],
["/[/; i", false],
["1+/i", false],
@@ -44,16 +62,23 @@ function runTest()
["var a, i", false],
["if(1){i", true],
["a=0;{i", true],
+ ["a=0; try {i", true],
+ ["if(0) ; else { i", true],
+ ["throw {i", false],
+ ["throw f(i", true],
["({a: i", true],
["({ i", false],
["({a: window, i", false],
["{i", true],
["{a: window, i", true],
["function(i", false],
+ ["function (i", false],
["function f(i", false],
["f=function(i", false],
["function i", false],
["function([i", false],
+ ["[{set a([i", false],
+ ["id.get+(i", true],
["date().g", true],
["mk4().c", true],
@@ -72,37 +97,14 @@ function runTest()
var tasks = new FBTest.TaskList();
for (var i = 0; i < tests.length; ++i) {
var test = tests[i];
- tasks.push(testExpression, win, test[0], test[1]);
+ tasks.push(testExpression, test[0], test[1]);
}
tasks.run(function()
{
- var doc = FW.Firebug.chrome.window.document;
- var cmdLine = doc.getElementById("fbCommandLine");
cmdLine.value = "";
-
FBTest.testDone("issue4233.DONE");
- });
+ }, 0);
});
});
}
-
-// ************************************************************************************************
-// xxxHonza: This should be polished and moved into FBTest namespace.
-
-function testExpression(callback, win, expr, shouldComplete)
-{
- var doc = FW.Firebug.chrome.window.document;
- var cmdLine = doc.getElementById("fbCommandLine");
-
- cmdLine.value = "";
- FBTest.typeCommand(expr);
- FBTest.synthesizeKey("VK_TAB", null, win);
-
- var changed = (cmdLine.value !== expr);
- FBTest.compare(shouldComplete, changed,
- "Completions should " + (shouldComplete ? "" : "not ") +
- "appear for: " + expr);
-
- setTimeout(callback);
-}

0 comments on commit 017f745

Please sign in to comment.