@@ -58,108 +58,107 @@ Commands:
5858 expect ( res . stdout . toString ( ) . trim ( ) ) . to . equal ( expectedHelp )
5959 } )
6060
61- // it('remix-tests running a test file', function() {
62- // const res = spawnSync(executablePath, [resolve(__dirname + '/examples_0/assert_ok_test.sol')])
63- // //console.log(res.stdout.toString())
64- // // match initial lines
65- // console.log(res.stdout.toString())
66- // expect(res.stdout.toString().trim()).to.match(/:: Running tests using remix-tests ::/)
67- // expect(res.stdout.toString().trim()).to.match(/creation of library remix_tests.sol:Assert pending.../)
68- // // match test result
69- // expect(res.stdout.toString().trim()).to.match(/AssertOkTest/)
70- // expect(res.stdout.toString().trim()).to.match(/AssertOkTest okPassTest/) // check if console.log is printed
71- // expect(res.stdout.toString().trim()).to.match(/Ok pass test/)
72- // expect(res.stdout.toString().trim()).to.match(/AssertOkTest okFailTest/) // check if console.log is printed
73- // expect(res.stdout.toString().trim()).to.match(/Ok fail test/)
74- // // match fail test details
75- // expect(res.stdout.toString().trim()).to.match(/Expected value should be ok to: true/)
76- // expect(res.stdout.toString().trim()).to.match(/Received: false/)
77- // expect(res.stdout.toString().trim()).to.match(/Message: okFailTest fails/)
78-
79- // })
80-
81- // it('remix-tests running a test file with custom compiler version', () => {
82- // const res = spawnSync(executablePath, ['--compiler', '0.7.4', resolve(__dirname + '/examples_0/assert_ok_test.sol')])
83- // // match initial lines
84- // expect(res.stdout.toString().trim()).to.contain('Compiler version set to 0.7.4. Latest version is')
85- // expect(res.stdout.toString().trim()).to.contain('Loading remote solc version v0.7.4+commit.3f05b770 ...')
86- // expect(res.stdout.toString().trim()).to.match(/:: Running tests using remix-tests ::/)
87- // expect(res.stdout.toString().trim()).to.match(/creation of library remix_tests.sol:Assert pending.../)
88- // // match test result
89- // expect(res.stdout.toString().trim()).to.match(/Ok pass test/)
90- // expect(res.stdout.toString().trim()).to.match(/Ok fail test/)
91- // // match fail test details
92- // expect(res.stdout.toString().trim()).to.match(/Message: okFailTest fails/)
93- // })
94-
95- // it('remix-tests running a test file with unavailable custom compiler version (should fail)', () => {
96- // const res = spawnSync(executablePath, ['--compiler', '1.10.4', resolve(__dirname + '/examples_0/assert_ok_test.sol')])
97- // // match initial lines
98- // expect(res.stdout.toString().trim()).to.contain('No compiler found in releases with version 1.10.4')
99- // })
100-
101- // it('remix-tests running a test file with custom EVM', () => {
102- // const res = spawnSync(executablePath, ['--evm', 'petersburg', resolve(__dirname + '/examples_0/assert_ok_test.sol')])
103- // // match initial lines
104- // expect(res.stdout.toString().trim()).to.contain('EVM set to petersburg')
105- // expect(res.stdout.toString().trim()).to.match(/:: Running tests using remix-tests ::/)
106- // expect(res.stdout.toString().trim()).to.match(/creation of library remix_tests.sol:Assert pending.../)
107- // // match test result
108- // expect(res.stdout.toString().trim()).to.match(/Ok pass test/)
109- // expect(res.stdout.toString().trim()).to.match(/Ok fail test/)
110- // // match fail test details
111- // expect(res.stdout.toString().trim()).to.match(/Message: okFailTest fails/)
112- // })
113-
114- // it('remix-tests running a test file by enabling optimization', () => {
115- // const res = spawnSync(executablePath, ['--optimize', 'true', resolve(__dirname + '/examples_0/assert_ok_test.sol')])
116- // // match initial lines
117- // expect(res.stdout.toString().trim().includes('Optimization is enabled'))
118- // expect(res.stdout.toString().trim()).to.match(/:: Running tests using remix-tests ::/)
119- // expect(res.stdout.toString().trim()).to.match(/creation of library remix_tests.sol:Assert pending.../)
120- // // match test result
121- // expect(res.stdout.toString().trim()).to.match(/Ok pass test/)
122- // expect(res.stdout.toString().trim()).to.match(/Ok fail test/)
123- // // match fail test details
124- // expect(res.stdout.toString().trim()).to.match(/Message: okFailTest fails/)
125- // })
126-
127- // it('remix-tests running a test file by enabling optimization and setting runs', () => {
128- // const res = spawnSync(executablePath, ['--optimize', 'true', '--runs', '300', resolve(__dirname + '/examples_0/assert_ok_test.sol')])
129- // // match initial lines
130- // expect(res.stdout.toString().trim()).to.contain('Optimization is enabled')
131- // expect(res.stdout.toString().trim()).to.contain('Runs set to 300')
132- // expect(res.stdout.toString().trim()).to.match(/:: Running tests using remix-tests ::/)
133- // expect(res.stdout.toString().trim()).to.match(/creation of library remix_tests.sol:Assert pending.../)
134- // // match test result
135- // expect(res.stdout.toString().trim()).to.match(/Ok pass test/)
136- // expect(res.stdout.toString().trim()).to.match(/Ok fail test/)
137- // // match fail test details
138- // expect(res.stdout.toString().trim()).to.match(/Message: okFailTest fails/)
139- // })
140-
141- // it('remix-tests running a test file without enabling optimization and setting runs (should fail)', () => {
142- // const res = spawnSync(executablePath, ['--runs', '300', resolve(__dirname + '/examples_0/assert_ok_test.sol')])
143- // // match initial lines
144- // expect(res.stdout.toString().trim()).to.contain('Optimization should be enabled for runs')
145- // })
146-
147- // it('remix-tests running a test file with all options', () => {
148- // const res = spawnSync(executablePath, ['--compiler', '0.7.5', '--evm', 'istanbul', '--optimize', 'true', '--runs', '250', resolve(__dirname + '/examples_0/assert_ok_test.sol')])
149- // // match initial lines
150- // expect(res.stdout.toString().trim()).to.contain('Compiler version set to 0.7.5. Latest version is')
151- // expect(res.stdout.toString().trim()).to.contain('Loading remote solc version v0.7.5+commit.eb77ed08 ...')
152- // expect(res.stdout.toString().trim()).to.contain('EVM set to istanbul')
153- // expect(res.stdout.toString().trim()).to.contain('Optimization is enabled')
154- // expect(res.stdout.toString().trim()).to.contain('Runs set to 250')
155- // expect(res.stdout.toString().trim()).to.match(/:: Running tests using remix-tests ::/)
156- // expect(res.stdout.toString().trim()).to.match(/creation of library remix_tests.sol:Assert pending.../)
157- // // match test result
158- // expect(res.stdout.toString().trim()).to.match(/Ok pass test/)
159- // expect(res.stdout.toString().trim()).to.match(/Ok fail test/)
160- // // match fail test details
161- // expect(res.stdout.toString().trim()).to.match(/Message: okFailTest fails/)
162- // })
61+ it ( 'remix-tests running a test file' , function ( ) {
62+ const res = spawnSync ( executablePath , [ resolve ( __dirname + '/examples_0/assert_ok_test.sol' ) ] )
63+ // match initial lines
64+ console . log ( res . stdout . toString ( ) )
65+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . match ( / : : R u n n i n g t e s t s u s i n g r e m i x - t e s t s : : / )
66+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . match ( / c r e a t i o n o f l i b r a r y r e m i x _ t e s t s .s o l : A s s e r t p e n d i n g .../ )
67+ // match test result
68+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . match ( / A s s e r t O k T e s t / )
69+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . match ( / A s s e r t O k T e s t o k P a s s T e s t / ) // check if console.log is printed
70+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . match ( / O k p a s s t e s t / )
71+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . match ( / A s s e r t O k T e s t o k F a i l T e s t / ) // check if console.log is printed
72+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . match ( / O k f a i l t e s t / )
73+ // match fail test details
74+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . match ( / E x p e c t e d v a l u e s h o u l d b e o k t o : t r u e / )
75+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . match ( / R e c e i v e d : f a l s e / )
76+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . match ( / M e s s a g e : o k F a i l T e s t f a i l s / )
77+
78+ } )
79+
80+ it ( 'remix-tests running a test file with custom compiler version' , ( ) => {
81+ const res = spawnSync ( executablePath , [ '--compiler' , '0.7.4' , resolve ( __dirname + '/examples_0/assert_ok_test.sol' ) ] )
82+ // match initial lines
83+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . contain ( 'Compiler version set to 0.7.4. Latest version is' )
84+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . contain ( 'Loading remote solc version v0.7.4+commit.3f05b770 ...' )
85+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . match ( / : : R u n n i n g t e s t s u s i n g r e m i x - t e s t s : : / )
86+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . match ( / c r e a t i o n o f l i b r a r y r e m i x _ t e s t s .s o l : A s s e r t p e n d i n g .../ )
87+ // match test result
88+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . match ( / O k p a s s t e s t / )
89+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . match ( / O k f a i l t e s t / )
90+ // match fail test details
91+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . match ( / M e s s a g e : o k F a i l T e s t f a i l s / )
92+ } )
93+
94+ it ( 'remix-tests running a test file with unavailable custom compiler version (should fail)' , ( ) => {
95+ const res = spawnSync ( executablePath , [ '--compiler' , '1.10.4' , resolve ( __dirname + '/examples_0/assert_ok_test.sol' ) ] )
96+ // match initial lines
97+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . contain ( 'No compiler found in releases with version 1.10.4' )
98+ } )
99+
100+ it ( 'remix-tests running a test file with custom EVM' , ( ) => {
101+ const res = spawnSync ( executablePath , [ '--evm' , 'petersburg' , resolve ( __dirname + '/examples_0/assert_ok_test.sol' ) ] )
102+ // match initial lines
103+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . contain ( 'EVM set to petersburg' )
104+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . match ( / : : R u n n i n g t e s t s u s i n g r e m i x - t e s t s : : / )
105+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . match ( / c r e a t i o n o f l i b r a r y r e m i x _ t e s t s .s o l : A s s e r t p e n d i n g .../ )
106+ // match test result
107+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . match ( / O k p a s s t e s t / )
108+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . match ( / O k f a i l t e s t / )
109+ // match fail test details
110+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . match ( / M e s s a g e : o k F a i l T e s t f a i l s / )
111+ } )
112+
113+ it ( 'remix-tests running a test file by enabling optimization' , ( ) => {
114+ const res = spawnSync ( executablePath , [ '--optimize' , 'true' , resolve ( __dirname + '/examples_0/assert_ok_test.sol' ) ] )
115+ // match initial lines
116+ expect ( res . stdout . toString ( ) . trim ( ) . includes ( 'Optimization is enabled' ) )
117+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . match ( / : : R u n n i n g t e s t s u s i n g r e m i x - t e s t s : : / )
118+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . match ( / c r e a t i o n o f l i b r a r y r e m i x _ t e s t s .s o l : A s s e r t p e n d i n g .../ )
119+ // match test result
120+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . match ( / O k p a s s t e s t / )
121+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . match ( / O k f a i l t e s t / )
122+ // match fail test details
123+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . match ( / M e s s a g e : o k F a i l T e s t f a i l s / )
124+ } )
125+
126+ it ( 'remix-tests running a test file by enabling optimization and setting runs' , ( ) => {
127+ const res = spawnSync ( executablePath , [ '--optimize' , 'true' , '--runs' , '300' , resolve ( __dirname + '/examples_0/assert_ok_test.sol' ) ] )
128+ // match initial lines
129+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . contain ( 'Optimization is enabled' )
130+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . contain ( 'Runs set to 300' )
131+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . match ( / : : R u n n i n g t e s t s u s i n g r e m i x - t e s t s : : / )
132+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . match ( / c r e a t i o n o f l i b r a r y r e m i x _ t e s t s .s o l : A s s e r t p e n d i n g .../ )
133+ // match test result
134+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . match ( / O k p a s s t e s t / )
135+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . match ( / O k f a i l t e s t / )
136+ // match fail test details
137+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . match ( / M e s s a g e : o k F a i l T e s t f a i l s / )
138+ } )
139+
140+ it ( 'remix-tests running a test file without enabling optimization and setting runs (should fail)' , ( ) => {
141+ const res = spawnSync ( executablePath , [ '--runs' , '300' , resolve ( __dirname + '/examples_0/assert_ok_test.sol' ) ] )
142+ // match initial lines
143+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . contain ( 'Optimization should be enabled for runs' )
144+ } )
145+
146+ it ( 'remix-tests running a test file with all options' , ( ) => {
147+ const res = spawnSync ( executablePath , [ '--compiler' , '0.7.5' , '--evm' , 'istanbul' , '--optimize' , 'true' , '--runs' , '250' , resolve ( __dirname + '/examples_0/assert_ok_test.sol' ) ] )
148+ // match initial lines
149+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . contain ( 'Compiler version set to 0.7.5. Latest version is' )
150+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . contain ( 'Loading remote solc version v0.7.5+commit.eb77ed08 ...' )
151+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . contain ( 'EVM set to istanbul' )
152+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . contain ( 'Optimization is enabled' )
153+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . contain ( 'Runs set to 250' )
154+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . match ( / : : R u n n i n g t e s t s u s i n g r e m i x - t e s t s : : / )
155+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . match ( / c r e a t i o n o f l i b r a r y r e m i x _ t e s t s .s o l : A s s e r t p e n d i n g .../ )
156+ // match test result
157+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . match ( / O k p a s s t e s t / )
158+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . match ( / O k f a i l t e s t / )
159+ // match fail test details
160+ expect ( res . stdout . toString ( ) . trim ( ) ) . to . match ( / M e s s a g e : o k F a i l T e s t f a i l s / )
161+ } )
163162
164163 } )
165164} )
0 commit comments