(t *testing.T)
| 310 | } |
| 311 | |
| 312 | func TestAddDeclFn(t *testing.T) { |
| 313 | eval, err := NewEvaluator() |
| 314 | if err != nil { |
| 315 | t.Fatalf("NewEvaluator() failed with: %v", err) |
| 316 | } |
| 317 | |
| 318 | err = eval.AddDeclFn("fn", []letFunctionParam{ |
| 319 | {identifier: "x", typeHint: mustParseType(t, "int")}, |
| 320 | {identifier: "y", typeHint: mustParseType(t, "int")}}, |
| 321 | mustParseType(t, "int")) |
| 322 | |
| 323 | if err != nil { |
| 324 | t.Errorf("eval.AddDeclFn('fn(x:int, y:int): int') got error %v wanted nil", err) |
| 325 | } |
| 326 | |
| 327 | err = eval.AddLetVar("z", "fn(1, 2)", nil) |
| 328 | |
| 329 | if err != nil { |
| 330 | t.Errorf("eval.AddLetVar('z = fn(1, 2)') got error %v wanted nil", err) |
| 331 | } |
| 332 | } |
| 333 | |
| 334 | func TestAddDeclFnError(t *testing.T) { |
| 335 | eval, err := NewEvaluator() |
nothing calls this directly
no test coverage detected