From: Jo-Philipp Wich Date: Sat, 12 Feb 2022 18:36:27 +0000 (+0100) Subject: tests: mocklib: fix infinite recursion in wrapped print() X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=87952960834445b23a6d5dc34e2a0439f1b9fa60;p=project%2Ffirewall4.git tests: mocklib: fix infinite recursion in wrapped print() Signed-off-by: Jo-Philipp Wich --- diff --git a/tests/lib/mocklib.uc b/tests/lib/mocklib.uc index 5441bfb..d47ebf3 100644 --- a/tests/lib/mocklib.uc +++ b/tests/lib/mocklib.uc @@ -180,6 +180,8 @@ if (type(MOCK_SEARCH_PATH) != 'array' || length(MOCK_SEARCH_PATH) == 0) MOCK_SEARCH_PATH = [ './mocks' ]; + let _print = global.print; + /* Register global mocklib namespace */ global.mocklib = { require: function(module) { @@ -232,7 +234,7 @@ if (length(args) == 1 && type(args[0]) in ["array", "object"]) printf("%s\n", format_json(args[0])); else - global.print(...args); + _print(...args); }; return global.mocklib;