@@ -20,6 +20,7 @@ import (
20
20
"cmp"
21
21
"encoding/json"
22
22
"os/exec"
23
+ "regexp"
23
24
"slices"
24
25
"strings"
25
26
"testing"
@@ -956,6 +957,23 @@ func TestBuildCaching(t *testing.T) {
956
957
require .NoError (t , err )
957
958
require .NotEqual (t , coreStatBefore .ModTime (), coreStatAfterTouch .ModTime ())
958
959
})
960
+
961
+ t .Run ("LibraryCacheWithDifferentDirname" , func (t * testing.T ) {
962
+ _ , _ , err = cli .Run ("lib" , "install" , "Robot IR Remote" )
963
+ require .NoError (t , err )
964
+
965
+ // Run first compile
966
+ sketchPath , err := paths .New ("testdata" , "SketchUsingRobotIRRemote" ).Abs ()
967
+ require .NoError (t , err )
968
+ _ , _ , err = cli .Run ("compile" , "-b" , "arduino:avr:robotControl" , "-v" , sketchPath .String ())
969
+ require .NoError (t , err )
970
+
971
+ // Run second compile and check that previous build is re-used
972
+ out , _ , err := cli .Run ("compile" , "-b" , "arduino:avr:robotControl" , "-v" , sketchPath .String ())
973
+ require .NoError (t , err )
974
+ check := regexp .MustCompile (`(?m)^Using previously compiled file:.*IRremoteTools\.cpp\.o$` )
975
+ require .True (t , check .Match (out ))
976
+ })
959
977
}
960
978
961
979
func TestMergeSketchWithBootloader (t * testing.T ) {
0 commit comments