(t *testing.T)
| 421 | } |
| 422 | |
| 423 | func TestLocIsCorrectOnFuncCall(t *testing.T) { |
| 424 | l := NewState() |
| 425 | if err := l.Load(strings.NewReader(` |
| 426 | function barf() |
| 427 | a = 3 + 2 |
| 428 | isNotDefined("Boom!", a) -- line 4; is the source of the error |
| 429 | end |
| 430 | barf() -- line 6 |
| 431 | `), "test", ""); err != nil { |
| 432 | t.Errorf("Unexpected error! Got %v", err) |
| 433 | } |
| 434 | err := l.ProtectedCall(0, 0, 0) |
| 435 | if err == nil { |
| 436 | t.Errorf("Expected error! Got none... :(") |
| 437 | } else { |
| 438 | if err.Error() != "runtime error: [string \"test\"]:4: attempt to call a nil value" { |
| 439 | t.Errorf("Wrong error reported: %v", err) |
| 440 | } |
| 441 | } |
| 442 | } |
| 443 | |
| 444 | func TestLocIsCorrectOnError(t *testing.T) { |
| 445 | l := NewState() |
nothing calls this directly
no test coverage detected