Commit 9c740866 authored by Massimiliano Pippi's avatar Massimiliano Pippi

store sketch location in the sketch struct

parent 34474dc5
......@@ -55,6 +55,7 @@ func TestLoadSketchFolder(t *testing.T) {
assert.Nil(t, err)
assert.NotNil(t, s)
assert.Equal(t, mainFilePath, s.MainFile.Path)
assert.Equal(t, sketchPath, s.LocationPath)
assert.Len(t, s.OtherSketchFiles, 2)
assert.Equal(t, "old.pde", filepath.Base(s.OtherSketchFiles[0].Path))
assert.Equal(t, "other.ino", filepath.Base(s.OtherSketchFiles[1].Path))
......
......@@ -54,6 +54,7 @@ func (ibn ItemByPath) Less(i, j int) bool { return ibn[i].Path < ibn[j].Path }
// Sketch holds all the files composing a sketch
type Sketch struct {
MainFile *Item
LocationPath string
OtherSketchFiles []*Item
AdditionalFiles []*Item
}
......@@ -108,6 +109,7 @@ func New(sketchFolderPath, mainFilePath, buildPath string, allFilesPaths []strin
return &Sketch{
MainFile: mainFile,
LocationPath: sketchFolderPath,
OtherSketchFiles: otherSketchFiles,
AdditionalFiles: additionalFiles,
}, nil
......
......@@ -62,6 +62,7 @@ func TestNew(t *testing.T) {
sketch, err := sketch.New(sketchFolderPath, mainFilePath, "", allFilesPaths)
assert.Nil(t, err)
assert.Equal(t, mainFilePath, sketch.MainFile.Path)
assert.Equal(t, sketchFolderPath, sketch.LocationPath)
assert.Len(t, sketch.OtherSketchFiles, 0)
assert.Len(t, sketch.AdditionalFiles, 1)
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment