rt_general_test.go 855 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * ECAL
  3. *
  4. * Copyright 2020 Matthias Ladkau. All rights reserved.
  5. *
  6. * This Source Code Form is subject to the terms of the MIT
  7. * License, If a copy of the MIT License was not distributed with this
  8. * file, You can obtain one at https://opensource.org/licenses/MIT.
  9. */
  10. package interpreter
  11. import (
  12. "testing"
  13. "devt.de/krotik/ecal/parser"
  14. )
  15. func TestGeneralErrorCases(t *testing.T) {
  16. n, _ := parser.Parse("a", "a")
  17. inv := &invalidRuntime{newBaseRuntime(NewECALRuntimeProvider("a"), n)}
  18. if err := inv.Validate().Error(); err != "ECAL error in a: Invalid construct (Unknown node: identifier) (Line:1 Pos:1)" {
  19. t.Error("Unexpected result:", err)
  20. return
  21. }
  22. if _, err := inv.Eval(nil, nil); err.Error() != "ECAL error in a: Invalid construct (Unknown node: identifier) (Line:1 Pos:1)" {
  23. t.Error("Unexpected result:", err)
  24. return
  25. }
  26. }