config_test.go 949 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Rufs - Remote Union File System
  3. *
  4. * Copyright 2017 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 config
  11. import (
  12. "strings"
  13. "testing"
  14. )
  15. func TestConfig(t *testing.T) {
  16. err := CheckBranchExportConfig(map[string]interface{}{})
  17. if err == nil || strings.HasPrefix(err.Error(), "Unexpected result: Missing") {
  18. t.Error("Unexpected result:", err)
  19. return
  20. }
  21. if err = CheckBranchExportConfig(DefaultBranchExportConfig); err != nil {
  22. t.Error(err)
  23. return
  24. }
  25. err = CheckTreeConfig(map[string]interface{}{})
  26. if err == nil || strings.HasPrefix(err.Error(), "Unexpected result: Missing") {
  27. t.Error("Unexpected result:", err)
  28. return
  29. }
  30. if err = CheckTreeConfig(DefaultTreeConfig); err != nil {
  31. t.Error(err)
  32. return
  33. }
  34. }