Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit833d393

Browse files
author
Federico Fissore
committed
Testing that AdditionalSketchFilesCopier doesn't copy unchanged files. See#77
Signed-off-by: Federico Fissore <f.fissore@arduino.cc>
1 parent0329b1c commit833d393

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

‎src/arduino.cc/builder/test/additional_sketch_files_copier_test.go‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import (
3939
"path/filepath"
4040
"sort"
4141
"testing"
42+
"time"
4243
)
4344

4445
typeByFileInfoName []os.FileInfo
@@ -90,3 +91,43 @@ func TestCopyOtherFiles(t *testing.T) {
9091
require.Equal(t,1,len(files))
9192
require.Equal(t,"helper.h",files[0].Name())
9293
}
94+
95+
funcTestCopyOtherFilesOnlyIfChanged(t*testing.T) {
96+
context:=make(map[string]interface{})
97+
98+
buildPath:=SetupBuildPath(t,context)
99+
deferos.RemoveAll(buildPath)
100+
101+
context[constants.CTX_SKETCH_LOCATION]=filepath.Join("sketch1","sketch.ino")
102+
103+
commands:= []types.Command{
104+
&builder.SetupHumanLoggerIfMissing{},
105+
&builder.AddAdditionalEntriesToContext{},
106+
&builder.SketchLoader{},
107+
&builder.AdditionalSketchFilesCopier{},
108+
}
109+
110+
for_,command:=rangecommands {
111+
err:=command.Run(context)
112+
NoError(t,err)
113+
}
114+
115+
headerStatBefore,err:=os.Stat(filepath.Join(buildPath,constants.FOLDER_SKETCH,"header.h"))
116+
NoError(t,err)
117+
118+
time.Sleep(2*time.Second)
119+
120+
context=make(map[string]interface{})
121+
context[constants.CTX_BUILD_PATH]=buildPath
122+
context[constants.CTX_SKETCH_LOCATION]=filepath.Join("sketch1","sketch.ino")
123+
124+
for_,command:=rangecommands {
125+
err:=command.Run(context)
126+
NoError(t,err)
127+
}
128+
129+
headerStatAfter,err:=os.Stat(filepath.Join(buildPath,constants.FOLDER_SKETCH,"header.h"))
130+
NoError(t,err)
131+
132+
require.Equal(t,headerStatBefore.ModTime().Unix(),headerStatAfter.ModTime().Unix())
133+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp