@@ -3554,49 +3554,42 @@ def test_embind_tsgen_end_to_end(self, opts, tsc_opts):
35543554
35553555 @is_slow_test
35563556 @requires_dev_dependency ('typescript' )
3557- def test_embind_tsgen_ignore(self):
3557+ # These extra arguments are not related to TS binding generation but we want to
3558+ # verify that they do not interfere with it.
3559+ @parameterized ({
3560+ '1' : [['-sALLOW_MEMORY_GROWTH=1' ,
3561+ '-Wno-pthreads-mem-growth' ,
3562+ '-sMAXIMUM_MEMORY=4GB' ,
3563+ '--pre-js' , 'fail.js' ,
3564+ '--post-js' , 'fail.js' ,
3565+ '--extern-pre-js' , 'fail.js' ,
3566+ '--extern-post-js' , 'fail.js' ,
3567+ '-sENVIRONMENT=worker' ,
3568+ '--use-preload-cache' ,
3569+ '--preload-file' , 'fail.js' ,
3570+ '-O3' ,
3571+ '-msimd128' ,
3572+ '-pthread' ,
3573+ '-sPROXY_TO_PTHREAD' ,
3574+ '-sPTHREAD_POOL_SIZE=1' ,
3575+ '-sSINGLE_FILE' ,
3576+ '-lembind' , # Test duplicated link option.
3577+ ], 'embind_tsgen_ignore_1.d.ts' ],
3578+ '2' : [['--embed-file' , 'fail.js' ,
3579+ '-sMINIMAL_RUNTIME=2' ,
3580+ '-sEXPORT_ES6=1' ,
3581+ '-sASSERTIONS=0' ,
3582+ '-sSTRICT=1' ,
3583+ ], 'embind_tsgen_ignore_2.d.ts' ],
3584+ '3' : [['-sWASM=0' ], 'embind_tsgen_ignore_3.d.ts' ],
3585+ '4' : [['-fsanitize=undefined' , '-gsource-map' ], 'embind_tsgen_ignore_3.d.ts' ],
3586+ '5' : [['-sASYNCIFY' ], 'embind_tsgen_ignore_3.d.ts' ],
3587+ })
3588+ def test_embind_tsgen_ignore (self , extra_args , expected_ts_file ):
35583589 create_file ('fail.js' , 'assert(false);' )
35593590 self .cflags += ['-lembind' , '--emit-tsd' , 'embind_tsgen.d.ts' ]
3560- # These extra arguments are not related to TS binding generation but we want to
3561- # verify that they do not interfere with it.
3562- extra_args = ['-sALLOW_MEMORY_GROWTH=1',
3563- '-Wno-pthreads-mem-growth',
3564- '-sMAXIMUM_MEMORY=4GB',
3565- '--pre-js', 'fail.js',
3566- '--post-js', 'fail.js',
3567- '--extern-pre-js', 'fail.js',
3568- '--extern-post-js', 'fail.js',
3569- '-sENVIRONMENT=worker',
3570- '--use-preload-cache',
3571- '--preload-file', 'fail.js',
3572- '-O3',
3573- '-msimd128',
3574- '-pthread',
3575- '-sPROXY_TO_PTHREAD',
3576- '-sPTHREAD_POOL_SIZE=1',
3577- '-sSINGLE_FILE',
3578- '-lembind', # Test duplicated link option.
3579- ]
35803591 self .emcc ('other/embind_tsgen.cpp' , extra_args )
3581- self.assertFileContents(test_file('other/embind_tsgen_ignore_1.d.ts'), read_file('embind_tsgen.d.ts'))
3582- # Test these args separately since they conflict with arguments in the first test.
3583- extra_args = ['-sMODULARIZE',
3584- '--embed-file', 'fail.js',
3585- '-sMINIMAL_RUNTIME=2',
3586- '-sEXPORT_ES6=1',
3587- '-sASSERTIONS=0',
3588- '-sSTRICT=1']
3589- self.emcc('other/embind_tsgen.cpp', extra_args)
3590- self.assertFileContents(test_file('other/embind_tsgen_ignore_2.d.ts'), read_file('embind_tsgen.d.ts'))
3591- # Also test this separately since it conflicts with other settings.
3592- extra_args = ['-sWASM=0']
3593- self.emcc('other/embind_tsgen.cpp', extra_args)
3594- self.assertFileContents(test_file('other/embind_tsgen_ignore_3.d.ts'), read_file('embind_tsgen.d.ts'))
3595-
3596- extra_args = ['-fsanitize=undefined',
3597- '-gsource-map']
3598- self.emcc('other/embind_tsgen.cpp', extra_args)
3599- self.assertFileContents(test_file('other/embind_tsgen_ignore_3.d.ts'), read_file('embind_tsgen.d.ts'))
3592+ self .assertFileContents (test_file (f'other/{ expected_ts_file } ' ), read_file ('embind_tsgen.d.ts' ))
36003593
36013594 def test_embind_tsgen_worker_env (self ):
36023595 self .cflags += ['-lembind' , '--emit-tsd' , 'embind_tsgen.d.ts' ]
0 commit comments