grapherrors_test.go 691 B

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. * EliasDB
  3. *
  4. * Copyright 2016 Matthias Ladkau. All rights reserved.
  5. *
  6. * This Source Code Form is subject to the terms of the Mozilla Public
  7. * License, v. 2.0. If a copy of the MPL was not distributed with this
  8. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  9. */
  10. package util
  11. import (
  12. "errors"
  13. "testing"
  14. )
  15. func TestGraphError(t *testing.T) {
  16. err := GraphError{errors.New("TestError"), ""}
  17. if err.Error() != "GraphError: TestError" {
  18. t.Error("Unexpected result", err.Error())
  19. return
  20. }
  21. err = GraphError{errors.New("TestError"), "SomeDetail"}
  22. if err.Error() != "GraphError: TestError (SomeDetail)" {
  23. t.Error("Unexpected result", err.Error())
  24. return
  25. }
  26. }