@@ -31,6 +31,12 @@ const testContracts = [
31
31
'contracts/test/Storage.sol:StorageUpgrade_CustomGap_V2_Ok_Switched_Gaps' ,
32
32
'contracts/test/Storage.sol:StorageUpgrade_CustomGap_V2_Bad_Switched_Gaps' ,
33
33
'contracts/test/Storage.sol:StorageUpgrade_CustomGap_V2_Bad_Changed_Gap_Name' ,
34
+ 'contracts/test/Storage.sol:StorageUpgrade_ConsumeAndAddGap_V1' ,
35
+ 'contracts/test/Storage.sol:StorageUpgrade_ConsumeAndAddGap_V2' ,
36
+ 'contracts/test/Storage.sol:StorageUpgrade_ConsumeAndAddGap_V3' ,
37
+ 'contracts/test/Storage.sol:StorageUpgrade_ConsumeAndAddGap_V3b' ,
38
+ 'contracts/test/Storage.sol:StorageUpgrade_ConsumeAndAddGap_Storage_V1' ,
39
+ 'contracts/test/Storage.sol:StorageUpgrade_ConsumeAndAddGap_Storage_V2' ,
34
40
] ;
35
41
36
42
test . before ( async t => {
@@ -172,3 +178,29 @@ test('custom gap - insert var, did not shrink gaps, changed first gap name', t =
172
178
t . false ( report . ok ) ;
173
179
t . snapshot ( report . explain ( ) ) ;
174
180
} ) ;
181
+
182
+ test ( 'consume entire gap and add new gap of different size' , t => {
183
+ const v1 = t . context . extractStorageLayout ( 'StorageUpgrade_ConsumeAndAddGap_V1' ) ;
184
+ const v2 = t . context . extractStorageLayout ( 'StorageUpgrade_ConsumeAndAddGap_V2' ) ;
185
+ const v3 = t . context . extractStorageLayout ( 'StorageUpgrade_ConsumeAndAddGap_V3' ) ;
186
+
187
+ t . true ( getReport ( v1 , v2 ) . ok ) ;
188
+ t . true ( getReport ( v2 , v3 ) . ok ) ;
189
+ t . true ( getReport ( v1 , v3 ) . ok ) ;
190
+ } ) ;
191
+
192
+ test ( 'consume entire gap and add new gap of same size' , t => {
193
+ const v1 = t . context . extractStorageLayout ( 'StorageUpgrade_ConsumeAndAddGap_V1' ) ;
194
+ const v2 = t . context . extractStorageLayout ( 'StorageUpgrade_ConsumeAndAddGap_V2' ) ;
195
+ const v3b = t . context . extractStorageLayout ( 'StorageUpgrade_ConsumeAndAddGap_V3b' ) ;
196
+
197
+ t . true ( getReport ( v2 , v3b ) . ok ) ;
198
+ t . true ( getReport ( v1 , v3b ) . ok ) ;
199
+ } ) ;
200
+
201
+ test ( 'consume partial gap and add new gap, storage contract pattern' , t => {
202
+ const v1 = t . context . extractStorageLayout ( 'StorageUpgrade_ConsumeAndAddGap_Storage_V1' ) ;
203
+ const v2 = t . context . extractStorageLayout ( 'StorageUpgrade_ConsumeAndAddGap_Storage_V2' ) ;
204
+
205
+ t . true ( getReport ( v1 , v2 ) . ok ) ;
206
+ } ) ;
0 commit comments