summaryrefslogtreecommitdiff
path: root/settings/settings_test.go
diff options
context:
space:
mode:
authorCarlos Martín Nieto <[email protected]>2014-06-07 18:33:09 +0200
committerCarlos Martín Nieto <[email protected]>2014-06-07 18:57:46 +0200
commit12a3a1e05c03fdc9767ef62e5ff9e0d677946525 (patch)
tree0bcdb684f1aa161dead4eb36cc1644554666fda3 /settings/settings_test.go
parentaabeb7f585da1cf966191886eab732db0020a41a (diff)
Move the settings into the main git2go
Diffstat (limited to 'settings/settings_test.go')
-rw-r--r--settings/settings_test.go66
1 files changed, 0 insertions, 66 deletions
diff --git a/settings/settings_test.go b/settings/settings_test.go
deleted file mode 100644
index 55b08c8..0000000
--- a/settings/settings_test.go
+++ /dev/null
@@ -1,66 +0,0 @@
-package settings
-
-import (
- "testing"
- "runtime"
- "github.com/libgit2/git2go"
-)
-
-type pathPair struct {
- Level git.ConfigLevel
- Path string
-}
-
-func TestSearchPath(t *testing.T) {
- paths := []pathPair{
- pathPair{git.ConfigLevelSystem, "/tmp/system"},
- pathPair{git.ConfigLevelGlobal, "/tmp/global"},
- pathPair{git.ConfigLevelXDG, "/tmp/xdg"},
- }
-
- for _, pair := range paths {
- err := SetSearchPath(pair.Level, pair.Path)
- checkFatal(t, err)
-
- actual, err := SearchPath(pair.Level)
- checkFatal(t, err)
-
- if pair.Path != actual {
- t.Fatal("Search paths don't match")
- }
- }
-}
-
-func TestMmapSizes(t *testing.T) {
- size := 42 * 1024
-
- err := SetMwindowSize(size)
- checkFatal(t, err)
-
- actual, err := MwindowSize()
- if size != actual {
- t.Fatal("Sizes don't match")
- }
-
- err = SetMwindowMappedLimit(size)
- checkFatal(t, err)
-
- actual, err = MwindowMappedLimit()
- if size != actual {
- t.Fatal("Sizes don't match")
- }
-}
-
-func checkFatal(t *testing.T, err error) {
- if err == nil {
- return
- }
-
- // The failure happens at wherever we were called, not here
- _, file, line, ok := runtime.Caller(1)
- if !ok {
- t.Fatal()
- }
-
- t.Fatalf("Fail at %v:%v; %v", file, line, err)
-}