@@ -70,3 +70,39 @@ func TestRewriteHardwareKeys(t *testing.T) {
70
70
71
71
require .Equal (t , "{runtime.tools.avr-gcc.path}/bin/" , platform .Properties [constants .BUILD_PROPERTIES_COMPILER_PATH ])
72
72
}
73
+
74
+ func TestRewriteHardwareKeysWithRewritingDisabled (t * testing.T ) {
75
+ context := make (map [string ]interface {})
76
+
77
+ hardware := make (map [string ]* types.Package )
78
+ aPackage := & types.Package {PackageId : "dummy" }
79
+ hardware ["dummy" ] = aPackage
80
+ aPackage .Platforms = make (map [string ]* types.Platform )
81
+
82
+ platform := & types.Platform {PlatformId : "dummy" }
83
+ aPackage .Platforms ["dummy" ] = platform
84
+ platform .Properties = make (map [string ]string )
85
+ platform .Properties [constants .PLATFORM_NAME ] = "A test platform"
86
+ platform .Properties [constants .BUILD_PROPERTIES_COMPILER_PATH ] = "{runtime.ide.path}/hardware/tools/avr/bin/"
87
+ platform .Properties [constants .REWRITING ] = constants .REWRITING_DISABLED
88
+
89
+ context [constants .CTX_HARDWARE ] = hardware
90
+
91
+ rewrite := types.PlatforKeyRewrite {Key : constants .BUILD_PROPERTIES_COMPILER_PATH , OldValue : "{runtime.ide.path}/hardware/tools/avr/bin/" , NewValue : "{runtime.tools.avr-gcc.path}/bin/" }
92
+ platformKeysRewrite := types.PlatforKeysRewrite {Rewrites : []types.PlatforKeyRewrite {rewrite }}
93
+
94
+ context [constants .CTX_PLATFORM_KEYS_REWRITE ] = platformKeysRewrite
95
+
96
+ commands := []types.Command {
97
+ & builder.SetupHumanLoggerIfMissing {},
98
+ & builder.AddAdditionalEntriesToContext {},
99
+ & builder.RewriteHardwareKeys {},
100
+ }
101
+
102
+ for _ , command := range commands {
103
+ err := command .Run (context )
104
+ NoError (t , err )
105
+ }
106
+
107
+ require .Equal (t , "{runtime.ide.path}/hardware/tools/avr/bin/" , platform .Properties [constants .BUILD_PROPERTIES_COMPILER_PATH ])
108
+ }
0 commit comments