@@ -33,15 +33,15 @@ func TestEnvironment_DeclareAndGet(t *testing.T) {
3333 }
3434
3535 // 测试获取变量
36- if value , ok := env .Get ("PI" ); ! ok || value != constValue {
36+ if value , ok := env .GetValue ("PI" ); ! ok || value != constValue {
3737 t .Errorf ("Failed to get const variable PI" )
3838 }
3939
40- if value , ok := env .Get ("message" ); ! ok || value != letValue {
40+ if value , ok := env .GetValue ("message" ); ! ok || value != letValue {
4141 t .Errorf ("Failed to get let variable message" )
4242 }
4343
44- if value , ok := env .Get ("flag" ); ! ok || value != varValue {
44+ if value , ok := env .GetValue ("flag" ); ! ok || value != varValue {
4545 t .Errorf ("Failed to get var variable flag" )
4646 }
4747
@@ -92,7 +92,7 @@ func TestEnvironment_Reassign(t *testing.T) {
9292 }
9393
9494 // 验证新值
95- if value , ok := env .Get ("x" ); ! ok || value != newValue {
95+ if value , ok := env .GetValue ("x" ); ! ok || value != newValue {
9696 t .Errorf ("Failed to get reassigned value" )
9797 }
9898}
@@ -117,7 +117,7 @@ func TestEnvironment_ConstReassign(t *testing.T) {
117117 }
118118
119119 // 验证原值未改变
120- if value , ok := env .Get ("PI" ); ! ok || value != constValue {
120+ if value , ok := env .GetValue ("PI" ); ! ok || value != constValue {
121121 t .Errorf ("Const variable value should not change" )
122122 }
123123}
@@ -142,7 +142,7 @@ func TestEnvironment_DuplicateDeclaration(t *testing.T) {
142142 }
143143
144144 // 验证原值未改变
145- if value , ok := env .Get ("x" ); ! ok || value != value1 {
145+ if value , ok := env .GetValue ("x" ); ! ok || value != value1 {
146146 t .Errorf ("Original variable value should not change" )
147147 }
148148}
@@ -159,7 +159,7 @@ func TestEnvironment_OuterScope(t *testing.T) {
159159 }
160160
161161 // 在内层获取变量
162- if value , ok := inner .Get ("x" ); ! ok || value != outerValue {
162+ if value , ok := inner .GetValue ("x" ); ! ok || value != outerValue {
163163 t .Errorf ("Failed to get variable from outer scope" )
164164 }
165165
@@ -171,12 +171,12 @@ func TestEnvironment_OuterScope(t *testing.T) {
171171 }
172172
173173 // 验证内层的新值
174- if value , ok := inner .Get ("x" ); ! ok || value != innerValue {
174+ if value , ok := inner .GetValue ("x" ); ! ok || value != innerValue {
175175 t .Errorf ("Failed to get reassigned value in inner scope" )
176176 }
177177
178178 // 验证外层值也改变了(因为内层修改了外层的变量)
179- if value , ok := outer .Get ("x" ); ! ok || value != innerValue {
179+ if value , ok := outer .GetValue ("x" ); ! ok || value != innerValue {
180180 t .Errorf ("Outer scope value should be updated when inner scope modifies it" )
181181 }
182182}
0 commit comments