RESOLVED FIXED 171362
Enhance shouldBe()/shouldNotBe() to accept anonymous function arguments
https://bugs.webkit.org/show_bug.cgi?id=171362
Summary Enhance shouldBe()/shouldNotBe() to accept anonymous function arguments
David Kilzer (:ddkilzer)
Reported 2017-04-26 19:18:54 PDT
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().
Attachments
Patch v1 (26.41 KB, patch)
2017-04-27 11:31 PDT, David Kilzer (:ddkilzer)
no flags
Patch v2 (31.25 KB, patch)
2017-04-27 12:55 PDT, David Kilzer (:ddkilzer)
joepeck: review+
Radar WebKit Bug Importer
Comment 1 2017-04-27 11:08:16 PDT
David Kilzer (:ddkilzer)
Comment 2 2017-04-27 11:31:11 PDT
Created attachment 308416 [details] Patch v1
David Kilzer (:ddkilzer)
Comment 3 2017-04-27 12:55:44 PDT
Created attachment 308432 [details] Patch v2
Joseph Pecoraro
Comment 4 2017-04-27 13:52:39 PDT
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
David Kilzer (:ddkilzer)
Comment 5 2017-04-27 14:30:09 PDT
(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.)
David Kilzer (:ddkilzer)
Comment 6 2017-04-27 14:30:26 PDT
David Kilzer (:ddkilzer)
Comment 7 2017-04-29 01:48:16 PDT
(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
Note You need to log in before you can comment on or make changes to this bug.