(t *testing.T)
| 165 | } |
| 166 | |
| 167 | func TestEnvExtendDisableDeclaration(t *testing.T) { |
| 168 | baseEnv, err := NewCustomEnv( |
| 169 | Function("foo", |
| 170 | Overload("foo_bool", []*Type{BoolType}, BoolType), |
| 171 | ), |
| 172 | ) |
| 173 | if err != nil { |
| 174 | t.Fatalf("NewCustomEnv() failed: %v", err) |
| 175 | } |
| 176 | _, iss := baseEnv.Compile("foo(true)") |
| 177 | if iss.Err() != nil { |
| 178 | t.Fatalf("baseEnv.Compile(foo(true)) failed: %v", iss.Err()) |
| 179 | } |
| 180 | |
| 181 | childEnv, err := baseEnv.Extend( |
| 182 | Function("foo", |
| 183 | DisableDeclaration(true), |
| 184 | Overload("foo_bool", []*Type{BoolType}, BoolType), |
| 185 | ), |
| 186 | ) |
| 187 | if err != nil { |
| 188 | t.Fatalf("baseEnv.Extend() failed: %v", err) |
| 189 | } |
| 190 | |
| 191 | _, iss = childEnv.Compile("foo(true)") |
| 192 | if iss.Err() == nil { |
| 193 | t.Errorf("childEnv.Compile(foo(true)) succeeded, wanted error") |
| 194 | } |
| 195 | } |
| 196 | |
| 197 | |
| 198 | func TestEnvCheckExtendRace(t *testing.T) { |
nothing calls this directly
no test coverage detected