Skip to content

Commit 231e62e

Browse files
committed
updating the code coverage on more niche syntaxes
1 parent 47f3639 commit 231e62e

25 files changed

Lines changed: 85 additions & 33 deletions

File tree

tests/format/AllSolidityFeatures/AllSolidityFeatures.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ contract assemblyLocalBinding {
181181
let x := 0x00
182182
let y := x
183183
let z := "hello"
184+
let t := hex"0123456789abcdef"
184185
}
185186
}
186187
}

tests/format/AllSolidityFeatures/__snapshots__/format.test.js.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ contract assemblyLocalBinding {
189189
let x := 0x00
190190
let y := x
191191
let z := "hello"
192+
let t := hex"0123456789abcdef"
192193
}
193194
}
194195
}
@@ -545,6 +546,7 @@ contract assemblyLocalBinding {
545546
let x := 0x00
546547
let y := x
547548
let z := "hello"
549+
let t := hex"0123456789abcdef"
548550
}
549551
}
550552
}

tests/format/Assembly/Assembly.sol

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
contract Assembly {
22
function ifAssembly() {
33
assembly {
4+
{
5+
success := 1
6+
}
47
if
58
returndatasize {
69
success := 0
@@ -51,6 +54,7 @@ for { let i := 0 } lt(i, x) { i := add(i, 1) } { y := mul(2, y) }
5154
-> result {
5255
result := add(x,
5356
1)
57+
leave
5458
}
5559
}
5660
}
@@ -61,6 +65,7 @@ for { let i := 0 } lt(i, x) { i := add(i, 1) } { y := mul(2, y) }
6165
-> result {
6266
result := add(a,
6367
add(b, c))
68+
leave
6469
}
6570
}
6671
}
@@ -70,6 +75,7 @@ for { let i := 0 } lt(i, x) { i := add(i, 1) } { y := mul(2, y) }
7075
function sum (thisIs, aFunctionWithVery, veryLongParameterNames, andItAlsoHasALotOfParameters, soItShouldBeSplitInMultipleLines)
7176
-> result {
7277
result := 0
78+
leave
7379
}
7480
}
7581
}
@@ -83,6 +89,7 @@ for { let i := 0 } lt(i, x) { i := add(i, 1) } { y := mul(2, y) }
8389
veryLongParameterNames := 0
8490
andItAlsoHasALotOfParameters := 0
8591
soItShouldBeSplitInMultipleLines := 0
92+
leave
8693
}
8794
}
8895
}

tests/format/Assembly/__snapshots__/format.test.js.snap

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ printWidth: 80
99
contract Assembly {
1010
function ifAssembly() {
1111
assembly {
12+
{
13+
success := 1
14+
}
1215
if
1316
returndatasize {
1417
success := 0
@@ -59,6 +62,7 @@ for { let i := 0 } lt(i, x) { i := add(i, 1) } { y := mul(2, y) }
5962
-> result {
6063
result := add(x,
6164
1)
65+
leave
6266
}
6367
}
6468
}
@@ -69,6 +73,7 @@ for { let i := 0 } lt(i, x) { i := add(i, 1) } { y := mul(2, y) }
6973
-> result {
7074
result := add(a,
7175
add(b, c))
76+
leave
7277
}
7378
}
7479
}
@@ -78,6 +83,7 @@ for { let i := 0 } lt(i, x) { i := add(i, 1) } { y := mul(2, y) }
7883
function sum (thisIs, aFunctionWithVery, veryLongParameterNames, andItAlsoHasALotOfParameters, soItShouldBeSplitInMultipleLines)
7984
-> result {
8085
result := 0
86+
leave
8187
}
8288
}
8389
}
@@ -91,6 +97,7 @@ for { let i := 0 } lt(i, x) { i := add(i, 1) } { y := mul(2, y) }
9197
veryLongParameterNames := 0
9298
andItAlsoHasALotOfParameters := 0
9399
soItShouldBeSplitInMultipleLines := 0
100+
leave
94101
}
95102
}
96103
}
@@ -191,6 +198,9 @@ contract BooleanLiteralsInAssembly {
191198
contract Assembly {
192199
function ifAssembly() {
193200
assembly {
201+
{
202+
success := 1
203+
}
194204
if returndatasize {
195205
success := 0
196206
}
@@ -249,6 +259,7 @@ contract Assembly {
249259
assembly {
250260
function inc(x) -> result {
251261
result := add(x, 1)
262+
leave
252263
}
253264
}
254265
}
@@ -257,6 +268,7 @@ contract Assembly {
257268
assembly {
258269
function sum(a, b, c) -> result {
259270
result := add(a, add(b, c))
271+
leave
260272
}
261273
}
262274
}
@@ -271,6 +283,7 @@ contract Assembly {
271283
soItShouldBeSplitInMultipleLines
272284
) -> result {
273285
result := 0
286+
leave
274287
}
275288
}
276289
}
@@ -290,6 +303,7 @@ contract Assembly {
290303
veryLongParameterNames := 0
291304
andItAlsoHasALotOfParameters := 0
292305
soItShouldBeSplitInMultipleLines := 0
306+
leave
293307
}
294308
}
295309
}

tests/format/BinaryOperationHierarchy/Group.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: MIT
2-
pragma solidity 0.8.28;
2+
pragma solidity "0.8.28";
33

44
contract Group {
55
uint256 veryVeryVeryLongUint256A;

tests/format/BinaryOperationHierarchy/__snapshots__/format.test.js.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ printWidth: 80
77
| printWidth
88
=====================================input======================================
99
// SPDX-License-Identifier: MIT
10-
pragma solidity 0.8.28;
10+
pragma solidity "0.8.28";
1111
1212
contract Group {
1313
uint256 veryVeryVeryLongUint256A;
@@ -361,7 +361,7 @@ contract Group {
361361
}
362362
=====================================output=====================================
363363
// SPDX-License-Identifier: MIT
364-
pragma solidity 0.8.28;
364+
pragma solidity "0.8.28";
365365
366366
contract Group {
367367
uint256 veryVeryVeryLongUint256A;

tests/format/ForStatements/ForStatements.sol

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ contract ForStatements {
44
function hi() public {
55
uint a;
66

7+
for ((uint i, uint j) = getIndexes(); i < 100; i++) a++;
8+
79
for (uint i; i < 100; i++) a++;
810

911
for (i = 0; i < 100; i++) a = a.add(LONG_VARIABLE).add(LONG_VARIABLE).add(LONG_VARIABLE);

tests/format/ForStatements/__snapshots__/format.test.js.snap

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ contract ForStatements {
1212
function hi() public {
1313
uint a;
1414
15+
for ((uint i, uint j) = getIndexes(); i < 100; i++) a++;
16+
1517
for (uint i; i < 100; i++) a++;
1618
1719
for (i = 0; i < 100; i++) a = a.add(LONG_VARIABLE).add(LONG_VARIABLE).add(LONG_VARIABLE);
@@ -57,6 +59,8 @@ contract ForStatements {
5759
function hi() public {
5860
uint a;
5961
62+
for ((uint i, uint j) = getIndexes(); i < 100; i++) a++;
63+
6064
for (uint i; i < 100; i++) a++;
6165
6266
for (i = 0; i < 100; i++)

tests/format/FunctionDefinitions/FunctionDefinitions.sol

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,15 @@ contract FunctionDefinitions {
4545
fallback () external {}
4646
fallback () {}
4747
fallback () external payable {}
48+
fallback() modify(123) override(Foo) {}
49+
fallback() returns(uint) {}
50+
fallback() external modify() payable override(Foo) virtual returns(uint) {}
4851
fallback() external payable virtual {}
4952
fallback(bytes calldata _input) external {}
5053

54+
55+
receive () modify(123) override(Foo) {}
56+
receive () external modify() payable override(Foo) virtual {}
5157
receive () external payable {}
5258
receive() external payable virtual {}
5359

tests/format/FunctionDefinitions/__snapshots__/format.test.js.snap

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,15 @@ contract FunctionDefinitions {
5353
fallback () external {}
5454
fallback () {}
5555
fallback () external payable {}
56+
fallback() modify(123) override(Foo) {}
57+
fallback() returns(uint) {}
58+
fallback() external modify() payable override(Foo) virtual returns(uint) {}
5659
fallback() external payable virtual {}
5760
fallback(bytes calldata _input) external {}
5861
62+
63+
receive () modify(123) override(Foo) {}
64+
receive () external modify() payable override(Foo) virtual {}
5965
receive () external payable {}
6066
receive() external payable virtual {}
6167
@@ -415,9 +421,14 @@ contract FunctionDefinitions {
415421
fallback() external {}
416422
fallback() {}
417423
fallback() external payable {}
424+
fallback() override(Foo) modify(123) {}
425+
fallback() returns (uint) {}
426+
fallback() external payable virtual override(Foo) modify returns (uint) {}
418427
fallback() external payable virtual {}
419428
fallback(bytes calldata _input) external {}
420429
430+
receive() override(Foo) modify(123) {}
431+
receive() external payable virtual override(Foo) modify {}
421432
receive() external payable {}
422433
receive() external payable virtual {}
423434

0 commit comments

Comments
 (0)