From 5c983b56b5cf24d2eef0380714429e4aa337c0b9 Mon Sep 17 00:00:00 2001 From: kennethloeffler Date: Fri, 5 Apr 2024 23:45:32 -0700 Subject: [PATCH] Remove global from state_module test --- tests/require/tests/state.luau | 14 ++++++-------- tests/require/tests/state_module.luau | 2 -- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/tests/require/tests/state.luau b/tests/require/tests/state.luau index b73dd90..fce92cb 100644 --- a/tests/require/tests/state.luau +++ b/tests/require/tests/state.luau @@ -1,16 +1,14 @@ --- the idea of this test is that state_module stores some state in one of its local variable --- we also set a global in the module to ensure the change we would have expected happens +-- the idea of this test is that state_module stores some state in one of its local +-- variable local state_module = require("./state_module") -- we confirm that without anything happening, the initial value is what we ecpect -assert(_state_test_global == 10) assert(state_module.state == 10) --- this second file also requires state_module and calls a function that changes both the local state and the global to 11 +-- this second file also requires state_module and calls a function that changes the local +-- state to 11 require("./state_second") --- if this also fails then there is either a problem with globals, or state_second is not doing what we expect it to -assert(_state_test_global == 11) --- with correct module caching, we should see the change done in state_secone reflected here +-- with correct module caching, we should see the change done in state_secone reflected +-- here assert(state_module.state == 11) - diff --git a/tests/require/tests/state_module.luau b/tests/require/tests/state_module.luau index c946008..9b6135e 100644 --- a/tests/require/tests/state_module.luau +++ b/tests/require/tests/state_module.luau @@ -1,11 +1,9 @@ local M = {} M.state = 10 -_state_test_global = 10 function M.set_state(n: number) M.state = n - _state_test_global = n end return M