@@ -90,38 +90,34 @@ describe('inferLanguage', function () {
9090
9191 for ( const { description, source, version, skip } of fixtures ) {
9292 ( skip ? test . skip : test ) ( description , function ( ) {
93- const [ parser ] = createParser ( source , options ) ;
93+ const { parser } = createParser ( source , options ) ;
9494 expect ( parser . languageVersion ) . toEqual ( version ) ;
9595 } ) ;
9696 }
9797
9898 test ( 'should use the latest successful version if the source has no pragmas' , function ( ) {
99- // This is to create in memory the latest parser and review the behaviour
100- createParser ( `pragma solidity ${ latestSupportedVersion } ;` , options ) ;
101- let [ parser ] = createParser ( `contract Foo {}` , options ) ;
99+ let { parser } = createParser ( `contract Foo {}` , options ) ;
102100 expect ( parser . languageVersion ) . toEqual ( latestSupportedVersion ) ;
103101
104- // This is to create in memory an old parser and review the behaviour
105- createParser ( `pragma solidity 0.8.2;` , options ) ;
106- [ parser ] = createParser ( `contract Foo {}` , options ) ;
102+ ( { parser } = createParser ( `contract Foo {}` , options ) ) ;
107103 expect ( parser . languageVersion ) . toEqual ( latestSupportedVersion ) ;
108104
109- [ parser ] = createParser ( `contract Foo {byte bar;}` , options ) ;
105+ ( { parser } = createParser ( `contract Foo {byte bar;}` , options ) ) ;
110106 expect ( parser . languageVersion ) . toEqual ( '0.7.6' ) ;
111107 } ) ;
112108
113109 test ( 'should use compiler option if given' , function ( ) {
114- let [ parser ] = createParser ( `pragma solidity ^0.8.0;` , {
110+ let { parser } = createParser ( `pragma solidity ^0.8.0;` , {
115111 compiler : '0.8.20'
116112 } ) ;
117113 expect ( parser . languageVersion ) . toEqual ( '0.8.20' ) ;
118114
119- [ parser ] = createParser ( `pragma solidity ^0.8.0;` , {
115+ ( { parser } = createParser ( `pragma solidity ^0.8.0;` , {
120116 compiler : '0.8.2'
121- } ) ;
117+ } ) ) ;
122118 expect ( parser . languageVersion ) . toEqual ( '0.8.2' ) ;
123119
124- [ parser ] = createParser ( `pragma solidity ^0.8.0;` , { } ) ;
120+ ( { parser } = createParser ( `pragma solidity ^0.8.0;` , { } ) ) ;
125121 expect ( parser . languageVersion ) . toEqual ( latestSupportedVersion ) ;
126122 } ) ;
127123
0 commit comments