Skip to content

Commit 19882cf

Browse files
committed
adding tests
1 parent d0e8e6d commit 19882cf

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

tests/format/Comments/Comments.sol

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pragma solidity ^0.4.24;
1+
pragma solidity ^0.4.29;
22

33

44
contract Comments1 {
@@ -10,7 +10,7 @@ bytes32 private _CACHED_DOMAIN_SEPARATOR;
1010
/* solhint-enable var-name-mixedcase */
1111

1212

13-
function() {
13+
function hello() {
1414
// solhint-disable-previous-line no-empty-blocks
1515
}
1616

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ parsers: ["slang-solidity"]
66
printWidth: 80
77
| printWidth
88
=====================================input======================================
9-
pragma solidity ^0.4.24;
9+
pragma solidity ^0.4.29;
1010
1111
1212
contract Comments1 {
@@ -18,7 +18,7 @@ bytes32 private _CACHED_DOMAIN_SEPARATOR;
1818
/* solhint-enable var-name-mixedcase */
1919
2020
21-
function() {
21+
function hello() {
2222
// solhint-disable-previous-line no-empty-blocks
2323
}
2424
@@ -178,7 +178,7 @@ contract Comments13 {
178178
}
179179
}
180180
=====================================output=====================================
181-
pragma solidity ^0.4.24;
181+
pragma solidity ^0.4.29;
182182
183183
contract Comments1 {
184184
/* solhint-disable var-name-mixedcase */
@@ -187,7 +187,7 @@ contract Comments1 {
187187
188188
/* solhint-enable var-name-mixedcase */
189189
190-
function() {
190+
function hello() {
191191
// solhint-disable-previous-line no-empty-blocks
192192
}
193193
@@ -276,7 +276,7 @@ contract Comments4c
276276
// solhint-disable-previous-line no-empty-blocks
277277
}
278278
279-
/*why the name \`Comments6\`*/ contract Comments6 is
279+
contract Comments6 /*why the name \`Comments6\`*/ is
280280
Interface1 /*why we used Interface1*/,
281281
Interface2 /*why we used Interface2*/,
282282
Interface3,

tests/unit/slang-utils/create-parser.test.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,15 @@ describe('inferLanguage', function () {
8484
}
8585

8686
test('should use the latest successful version if the source has no pragmas', function () {
87-
createParser(`pragma solidity 0.8.28;`, options);
87+
// This is to create in memory the latest parser and review the behaviour
88+
createParser(`pragma solidity ${latestSupportedVersion};`, options);
8889
let [parser] = createParser(`contract Foo {}`, options);
89-
expect(parser.languageVersion).toEqual('0.8.28');
90+
expect(parser.languageVersion).toEqual(latestSupportedVersion);
9091

92+
// This is to create in memory an old parser and review the behaviour
9193
createParser(`pragma solidity 0.8.2;`, options);
9294
[parser] = createParser(`contract Foo {}`, options);
93-
expect(parser.languageVersion).toEqual('0.8.28');
95+
expect(parser.languageVersion).toEqual(latestSupportedVersion);
9496

9597
[parser] = createParser(`contract Foo {byte bar;}`, options);
9698
expect(parser.languageVersion).toEqual('0.7.6');

0 commit comments

Comments
 (0)