mapserver/worldconfig/parse_test.go

26 lines
523 B
Go
Raw Normal View History

2019-01-09 08:56:39 +01:00
package worldconfig
2019-01-04 13:02:17 +01:00
import (
2019-01-05 17:21:24 +01:00
"fmt"
2019-01-13 16:37:03 +01:00
"testing"
2019-01-04 13:02:17 +01:00
)
func TestParseSqlite(t *testing.T) {
2019-01-09 08:56:39 +01:00
cfg := Parse("./testdata/world.mt.sqlite")
2019-02-08 14:57:36 +01:00
if cfg[CONFIG_BACKEND] != BACKEND_SQLITE3 {
2019-01-04 13:02:17 +01:00
t.Fatal("not sqlite3")
}
}
func TestParsePostgres(t *testing.T) {
2019-01-09 08:56:39 +01:00
cfg := Parse("./testdata/world.mt.postgres")
2019-01-05 17:21:24 +01:00
fmt.Println(cfg)
2019-02-08 14:57:36 +01:00
if cfg[CONFIG_BACKEND] != BACKEND_POSTGRES {
2019-01-04 13:02:17 +01:00
t.Fatal("not postgres")
}
2019-01-04 15:02:25 +01:00
2019-02-08 14:57:36 +01:00
if cfg[CONFIG_PSQL_CONNECTION] != "host=postgres port=5432 user=postgres password=enter dbname=postgres" {
2019-01-04 15:02:25 +01:00
t.Fatal("param err")
}
2019-01-04 13:02:17 +01:00
}