зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1780076 - fix ordering of multiple setup tasks in xpcshell tests, r=nalexander
Differential Revision: https://phabricator.services.mozilla.com/D152119
This commit is contained in:
Родитель
b325722266
Коммит
813aa6c71e
|
@ -0,0 +1,13 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
let someVar = 0;
|
||||
|
||||
add_setup(() => (someVar = 1));
|
||||
add_setup(() => (someVar = 2));
|
||||
|
||||
add_task(async function test_setup_ordering() {
|
||||
Assert.equal(someVar, 2, "Setups should have run in order.");
|
||||
});
|
|
@ -0,0 +1,20 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
let someVar = 0;
|
||||
|
||||
add_task(async function test_first() {
|
||||
Assert.equal(someVar, 1, "I should run as the first test task.");
|
||||
someVar++;
|
||||
});
|
||||
|
||||
add_setup(function setup() {
|
||||
Assert.equal(someVar, 0, "Should run setup first.");
|
||||
someVar++;
|
||||
});
|
||||
|
||||
add_task(async function test_second() {
|
||||
Assert.equal(someVar, 2, "I should run as the second test task.");
|
||||
});
|
|
@ -30,6 +30,8 @@ skip-if = os == "win" && debug
|
|||
[test_load.js]
|
||||
[test_load_httpd_js.js]
|
||||
[test_location.js]
|
||||
[test_multiple_setups.js]
|
||||
[test_multiple_tasks.js]
|
||||
[test_prefs_no_defaults.js]
|
||||
[test_prefs_no_defaults_with_file.js]
|
||||
prefs = dummy.pref.from.test.file=1
|
||||
|
|
|
@ -1812,7 +1812,10 @@ function run_next_test() {
|
|||
|
||||
function frontLoadSetups() {
|
||||
_gTests.sort(([propsA, funcA], [propsB, funcB]) => {
|
||||
return propsB.isSetup ? 1 : 0;
|
||||
if (propsB.isSetup === propsA.isSetup) {
|
||||
return 0;
|
||||
}
|
||||
return propsB.isSetup ? 1 : -1;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче