20 lines
417 B
Go
20 lines
417 B
Go
// Copyright (c) 2024 Celestino Amoroso (celestino.amoroso@gmail.com).
|
|
// All rights reserved.
|
|
|
|
// t_simple-store_test.go
|
|
package expr
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestGetVar(t *testing.T) {
|
|
ctx := NewSimpleStoreWithoutGlobalContext()
|
|
ctx.SetVar("x", 10)
|
|
if value, exists := ctx.GetVar("x"); !exists {
|
|
t.Errorf("missing variable 'x'")
|
|
} else if value != int64(10) {
|
|
t.Errorf("expcted 10, got %v", value)
|
|
}
|
|
}
|