zjsunit: Handle duplicate overrides.

We want to undo overrides in reverse order,
which is important if you override the
same name more than once in the same
function.

Until today the code basically prevented
us from ever using the original implementation
of a name we stubbed, and most of them start
as undefined due to their parent modules
starting with `set_global`.

But I do want this proper, and I introduced
a tiny pitfall today.
This commit is contained in:
Steve Howell
2020-07-26 15:24:59 +00:00
committed by Steve Howell
parent 10bb60e13d
commit 0d68a23066

View File

@@ -102,6 +102,7 @@ exports.with_overrides = function (test_function) {
test_function(override);
restore_callbacks.reverse();
for (const restore_callback of restore_callbacks) {
restore_callback();
}