We can enhance shouldBe()/shouldNotBe() from js-test-pre.js and js-test.js to take anonymous function arguments (in addition to string arguments) to make it easier to capture local variables inside expressions. See also Bug 159232 for a similar change to shouldThrow()/shouldNotThrow().
<rdar://problem/31867686>
Created attachment 308416 [details] Patch v1
Created attachment 308432 [details] Patch v2
Comment on attachment 308432 [details] Patch v2 View in context: https://bugs.webkit.org/attachment.cgi?id=308432&action=review r=me These files seem to vary between 2 and 4 spaces indentation. You can fix if you want, or leave mixed but eliminate the 3s =) > LayoutTests/ChangeLog:43 > + to shoudlBe() into an anonymous function. Typo: "shoudlBe" > LayoutTests/http/tests/resources/js-test-pre.js:219 > + try { > + _av = eval(_a); > + } catch (e) { Style: indent is 3 instead of 2. How did this file come to have 2 space indent anyways. Weird. > LayoutTests/http/tests/resources/js-test-pre.js:647 > + return _av.then(function(result) { Style: whitespace is slightly off
(In reply to Joseph Pecoraro from comment #4) > Comment on attachment 308432 [details] > Patch v2 > > View in context: > https://bugs.webkit.org/attachment.cgi?id=308432&action=review > > r=me > > These files seem to vary between 2 and 4 spaces indentation. You can fix if > you want, or leave mixed but eliminate the 3s =) > > > LayoutTests/ChangeLog:43 > > + to shoudlBe() into an anonymous function. > > Typo: "shoudlBe" > > > LayoutTests/http/tests/resources/js-test-pre.js:219 > > + try { > > + _av = eval(_a); > > + } catch (e) { > > Style: indent is 3 instead of 2. > > How did this file come to have 2 space indent anyways. Weird. > > > LayoutTests/http/tests/resources/js-test-pre.js:647 > > + return _av.then(function(result) { > > Style: whitespace is slightly off Thanks! Will fix whitespace issues in a separate commit. (I want to test the new checker while making these changes as well.)
Committed r215894: <http://trac.webkit.org/changeset/215894>
(In reply to David Kilzer (:ddkilzer) from comment #5) > (In reply to Joseph Pecoraro from comment #4) > > Comment on attachment 308432 [details] > > Patch v2 > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=308432&action=review > > > > r=me > > > > These files seem to vary between 2 and 4 spaces indentation. You can fix if > > you want, or leave mixed but eliminate the 3s =) > > > > > LayoutTests/ChangeLog:43 > > > + to shoudlBe() into an anonymous function. > > > > Typo: "shoudlBe" > > > > > LayoutTests/http/tests/resources/js-test-pre.js:219 > > > + try { > > > + _av = eval(_a); > > > + } catch (e) { > > > > Style: indent is 3 instead of 2. > > > > How did this file come to have 2 space indent anyways. Weird. > > > > > LayoutTests/http/tests/resources/js-test-pre.js:647 > > > + return _av.then(function(result) { > > > > Style: whitespace is slightly off > > Thanks! Will fix whitespace issues in a separate commit. (I want to test > the new checker while making these changes as well.) Bug 171424: check-webkit-style should keep JavaScript test functions in sync