Skip to content

Commit

Permalink
Fixed test.
Browse files Browse the repository at this point in the history
Better return error.
Upgrade to go 1.6.2.
  • Loading branch information
ryanfox1985 committed Jun 21, 2016
1 parent 3c65ae9 commit e6fb67d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions .goxc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"go-fmt",
"go-install",
"go-clean",
"xc",
"publish-github"
],
"TaskSettings": {
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: go
sudo: required
go:
- 1.5.1
- 1.6.2
- tip

env:
Expand Down
6 changes: 5 additions & 1 deletion lib/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ func InitSettings(configFile string, settings *SettingsShare) error {
log.Info("New config file: %s\n", configFile)
*settings = NewSettings()

CreateConfigFile(configFile, *settings)
err := CreateConfigFile(configFile, *settings)

if err != nil {
return err
}
} else {
log.Info("Loading config file: %s\n", configFile)
if _, err := toml.DecodeFile(configFile, &settings); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions lib/settings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ func TempFilename(prefix string, extension string) string {
}

func TestCreateConfigFile(t *testing.T) {
test_settings = NewSettings()
var test_settings SettingsShare

configFile := TempFilename("config_", ".toml")
err := CreateConfigFile(configFile, test_settings)
assert.Nil(t, err)

_, err2 := os.Stat(test_settings.Daemon.DatabaseFilePath)
_, err2 := os.Stat(configFile)
assert.False(t, os.IsNotExist(err2), "The config file: %s doesn't exists!", configFile)
}

Expand Down

0 comments on commit e6fb67d

Please sign in to comment.