restore globals after running tests

[?]
Jan 23, 2023, 7:45 AM
FFFJ54GJ3A2HNKZEHO7RHUZ2YWT67EK4B3Y2YJVYCEUANGY6BQQAC

Dependencies

  • [2] K7YGVRXH generalize the protocol to return errors, etc.
  • [3] 3BRGOF7N return failing tests with every code change
  • [*] LRDM35CE app running again

Change contents

  • edit in live.lua at line 281
    [3.30]
    [3.30]
    -- run all tests
    local globals = live.shallow_copy_all_globals()
  • edit in live.lua at line 285
    [3.100]
    [3.100]
    live.restore_all_globals(globals)
  • edit in live.lua at line 291
    [2.39]
    [5.8032]
    end
    end
    function live.shallow_copy_all_globals()
    local result = {}
    for k,v in pairs(_G) do
    result[k] = v
    end
    return result
    end
    function live.restore_all_globals(x)
    -- delete extra bindings
    for k,v in pairs(_G) do
    if x[k] == nil then
    _G[k] = nil
    end
    end
    -- restore previous bindings
    for k,v in pairs(x) do
    _G[k] = v