1
0
forked from MTSR/mapserver
mapserver/worldconfig/parse_test.go
2019-01-04 15:02:25 +01:00

40 lines
797 B
Go

package worldconfig_test
import (
"testing"
worldconfig "mapserver/worldconfig"
)
func TestParseSqlite(t *testing.T) {
cfg := worldconfig.Parse("./testdata/world.mt.sqlite")
if cfg.Backend != worldconfig.BACKEND_SQLITE3 {
t.Fatal("not sqlite3")
}
if cfg.PlayerBackend != worldconfig.BACKEND_FILES {
t.Fatal("not files")
}
}
func TestParsePostgres(t *testing.T) {
cfg := worldconfig.Parse("./testdata/world.mt.postgres")
if cfg.Backend != worldconfig.BACKEND_POSTGRES {
t.Fatal("not postgres")
}
if cfg.PlayerBackend != worldconfig.BACKEND_POSTGRES {
t.Fatal("not postgres")
}
if cfg.PsqlConnection == nil {
t.Fatal("no connection")
}
if cfg.PsqlPlayerConnection == nil {
t.Fatal("no connection")
}
if cfg.PsqlConnection[""] != "x" {
t.Fatal("param err")
}
}