Skip to content

Commit

Permalink
Merge pull request #15 from stephenmathieson/fix/config-script-path
Browse files Browse the repository at this point in the history
config: fix script path resolution
  • Loading branch information
tj committed Mar 30, 2016
2 parents eda1dd9 + 6b4aa9f commit 22f704a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ func New(file string) (*Config, error) {
return nil, err
}

c.File = file
return c, nil
}

Expand Down
20 changes: 20 additions & 0 deletions config/config_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package config_test

import (
"io/ioutil"
"os"
"testing"

"github.com/bmizerany/assert"
Expand Down Expand Up @@ -50,3 +52,21 @@ func TestNewString(t *testing.T) {

assert.Equal(t, `testing`, c.Templates.List)
}

func TestNew(t *testing.T) {
b := []byte(s)
f, err := ioutil.TempFile("", "")
assert.Equal(t, nil, err)

file := f.Name()
defer os.Remove(file)

_, err = f.Write(b)
assert.Equal(t, nil, err)

f.Close()

c, err := config.New(file)
assert.Equal(t, nil, err)
assert.Equal(t, file, c.File)
}

0 comments on commit 22f704a

Please sign in to comment.