tests: mocklib: fix infinite recursion in wrapped print()
authorJo-Philipp Wich <jo@mein.io>
Sat, 12 Feb 2022 18:36:27 +0000 (19:36 +0100)
committerJo-Philipp Wich <jo@mein.io>
Sat, 12 Feb 2022 19:36:57 +0000 (20:36 +0100)
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
tests/lib/mocklib.uc

index 5441bfbffe824644afb08cf8942292f544e140b3..d47ebf300ecd15a657bfdfcb8ac1d81a5e2fd301 100644 (file)
        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) {
                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;