2013-07-05 12:50:52 +02:00
|
|
|
// Copyright 2013 The Chihaya Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by the BSD 2-Clause license,
|
|
|
|
// which can be found in the LICENSE file.
|
|
|
|
|
|
|
|
package config
|
|
|
|
|
|
|
|
import (
|
2013-08-29 05:44:45 +02:00
|
|
|
"bytes"
|
|
|
|
"io/ioutil"
|
2013-07-17 05:37:03 +02:00
|
|
|
"os"
|
2013-07-05 12:50:52 +02:00
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
2013-08-29 05:44:45 +02:00
|
|
|
func TestOpenConfig(t *testing.T) {
|
2013-08-29 06:47:37 +02:00
|
|
|
if _, err := Open(os.Getenv("TESTCONFIGPATH")); err != nil {
|
2013-07-05 12:50:52 +02:00
|
|
|
t.Error(err)
|
|
|
|
}
|
|
|
|
}
|
2013-07-17 05:37:03 +02:00
|
|
|
|
2013-08-29 05:44:45 +02:00
|
|
|
func TestNewConfig(t *testing.T) {
|
2013-08-29 06:47:37 +02:00
|
|
|
contents, err := ioutil.ReadFile(os.Getenv("TESTCONFIGPATH"))
|
2013-07-17 05:37:03 +02:00
|
|
|
if err != nil {
|
2013-08-29 05:44:45 +02:00
|
|
|
t.Error(err)
|
2013-07-17 05:37:03 +02:00
|
|
|
}
|
2013-08-29 05:44:45 +02:00
|
|
|
buff := bytes.NewBuffer(contents)
|
|
|
|
if _, err := newConfig(buff); err != nil {
|
|
|
|
t.Error(err)
|
2013-07-17 05:37:03 +02:00
|
|
|
}
|
|
|
|
}
|