Use a RWMutex for server config locking instead of routing config gets and sets through Server#handler.

This commit is contained in:
Mikkel Krautz 2011-05-13 15:32:42 +02:00
parent 41f6af2334
commit c785c45166
5 changed files with 62 additions and 61 deletions

View file

@ -9,7 +9,7 @@ import (
)
func TestIntValue(t *testing.T) {
cfg := make(Config)
cfg := New(nil)
cfg.Set("Test", "13")
if cfg.IntValue("Test") != 13 {
t.Errorf("Expected 13")
@ -17,7 +17,7 @@ func TestIntValue(t *testing.T) {
}
func TestFloatAsInt(t *testing.T) {
cfg := make(Config)
cfg := New(nil)
cfg.Set("Test", "13.4")
if cfg.IntValue("Test") != 0 {
t.Errorf("Expected 0")
@ -25,14 +25,14 @@ func TestFloatAsInt(t *testing.T) {
}
func TestDefaultValue(t *testing.T) {
cfg := make(Config)
cfg := New(nil)
if cfg.IntValue("MaxBandwidth") != 72000 {
t.Errorf("Expected 72000")
}
}
func TestBoolValue(t *testing.T) {
cfg := make(Config)
cfg := New(nil)
cfg.Set("DoStuffOnStartup", "true")
if cfg.BoolValue("DoStuffOnStartup") != true {
t.Errorf("Expected true")