Skip to content

Commit 3691c26

Browse files
committed
adding YulEqualColon and YulColonEqual to the format tests
1 parent e5a3cc5 commit 3691c26

3 files changed

Lines changed: 17 additions & 1 deletion

File tree

tests/config/run-format-test.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,13 @@ const unstableTests = new Map(
3333

3434
// Here we add files that will not have the same AST after being formatted.
3535
const unstableAstTests = new Map(
36-
[].map((fixture) => {
36+
[
37+
// `: =` and `= :` are syntactically the same as `:=` and `=:`, but the ast
38+
// changes from `YulColonAndEqual` and `YulEqualAndColon` to `ColonEqual`
39+
// and `EqualColon`, which is expected but the workaround to keep the test
40+
// stable is too much, so we just put it in this list.
41+
"AssemblyV0.4.26/Assembly.sol",
42+
].map((fixture) => {
3743
const [file, isAstUnstable = () => true] = Array.isArray(fixture)
3844
? fixture
3945
: [fixture];
@@ -73,6 +79,9 @@ const antlrMismatchTests = new Map(
7379
"IndexOf/IndexOf.sol",
7480
// Syntax for `pragma solidity 0.5.0 - 0.6.0;` not supported by ANTLR
7581
"Pragma/Pragma.sol",
82+
// ANTLR doesn't support assembly assignment operators separated by a space
83+
// like `: =` or `= :`
84+
"AssemblyV0.4.26/Assembly.sol",
7685
].map((fixture) => {
7786
const [file, compareBytecode = () => true] = Array.isArray(fixture)
7887
? fixture

tests/format/AssemblyV0.4.26/Assembly.sol

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ contract MultipleAssemblyAssignment {
3939
function foo() public pure {
4040
assembly {
4141
function bar() -> a, b {
42+
b : = 2
4243
a := 1
4344
b := 2
4445
}
@@ -52,6 +53,7 @@ contract AssemblyStackAssignment {
5253
function f() public {
5354
assembly {
5455
4 =: y
56+
4 = : y
5557
}
5658
}
5759
}

tests/format/AssemblyV0.4.26/__snapshots__/format.test.js.snap

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ contract MultipleAssemblyAssignment {
4747
function foo() public pure {
4848
assembly {
4949
function bar() -> a, b {
50+
b : = 2
5051
a := 1
5152
b := 2
5253
}
@@ -60,6 +61,7 @@ contract AssemblyStackAssignment {
6061
function f() public {
6162
assembly {
6263
4 =: y
64+
4 = : y
6365
}
6466
}
6567
}
@@ -108,6 +110,7 @@ contract MultipleAssemblyAssignment {
108110
function foo() public pure {
109111
assembly {
110112
function bar() -> a, b {
113+
b := 2
111114
a := 1
112115
b := 2
113116
}
@@ -122,6 +125,8 @@ contract AssemblyStackAssignment {
122125
assembly {
123126
4
124127
=: y
128+
4
129+
=: y
125130
}
126131
}
127132
}

0 commit comments

Comments
 (0)