@@ -2,9 +2,9 @@ use std::io::Write;
22use std:: process:: Command ;
33use tempfile:: NamedTempFile ;
44
5- // Helper to run dts2extern command
6- fn run_dts2extern ( args : & [ & str ] ) -> std:: process:: Output {
7- let mut cmd_args = vec ! [ "run" , "-q" , "--" , "dts2-extern " ] ;
5+ // Helper to run bindgen command
6+ fn run_bindgen ( args : & [ & str ] ) -> std:: process:: Output {
7+ let mut cmd_args = vec ! [ "run" , "-q" , "--" , "bindgen " ] ;
88 cmd_args. extend_from_slice ( args) ;
99
1010 Command :: new ( "cargo" )
@@ -22,7 +22,7 @@ fn create_temp_file(content: &str, suffix: &str) -> NamedTempFile {
2222
2323#[ test]
2424fn test_non_existent_file ( ) {
25- let output = run_dts2extern ( & [ "/path/that/does/not/exist.d.ts" ] ) ;
25+ let output = run_bindgen ( & [ "/path/that/does/not/exist.d.ts" ] ) ;
2626
2727 if output. status . success ( ) {
2828 eprintln ! ( "Expected failure for non-existent file, but got success" ) ;
@@ -46,7 +46,7 @@ fn test_non_existent_file() {
4646fn test_non_dts_extension ( ) {
4747 let file = create_temp_file ( "export function test(): void;" , ".ts" ) ;
4848
49- let output = run_dts2extern ( & [ file. path ( ) . to_str ( ) . unwrap ( ) ] ) ;
49+ let output = run_bindgen ( & [ file. path ( ) . to_str ( ) . unwrap ( ) ] ) ;
5050
5151 assert ! ( !output. status. success( ) ) ;
5252 let stderr = String :: from_utf8_lossy ( & output. stderr ) ;
@@ -58,7 +58,7 @@ fn test_non_dts_extension() {
5858fn test_empty_file ( ) {
5959 let file = create_temp_file ( "" , ".d.ts" ) ;
6060
61- let output = run_dts2extern ( & [ file. path ( ) . to_str ( ) . unwrap ( ) ] ) ;
61+ let output = run_bindgen ( & [ file. path ( ) . to_str ( ) . unwrap ( ) ] ) ;
6262
6363 // Empty file should succeed
6464 assert ! ( output. status. success( ) ) ;
@@ -71,7 +71,7 @@ fn test_invalid_typescript_syntax() {
7171 ".d.ts" ,
7272 ) ;
7373
74- let output = run_dts2extern ( & [ file. path ( ) . to_str ( ) . unwrap ( ) ] ) ;
74+ let output = run_bindgen ( & [ file. path ( ) . to_str ( ) . unwrap ( ) ] ) ;
7575
7676 assert ! ( !output. status. success( ) ) ;
7777 let stderr = String :: from_utf8_lossy ( & output. stderr ) ;
@@ -92,7 +92,7 @@ fn test_malformed_type_declarations() {
9292 ".d.ts" ,
9393 ) ;
9494
95- let output = run_dts2extern ( & [ file. path ( ) . to_str ( ) . unwrap ( ) ] ) ;
95+ let output = run_bindgen ( & [ file. path ( ) . to_str ( ) . unwrap ( ) ] ) ;
9696
9797 assert ! ( !output. status. success( ) ) ;
9898}
@@ -108,7 +108,7 @@ fn test_circular_type_reference() {
108108 ".d.ts" ,
109109 ) ;
110110
111- let output = run_dts2extern ( & [ file. path ( ) . to_str ( ) . unwrap ( ) ] ) ;
111+ let output = run_bindgen ( & [ file. path ( ) . to_str ( ) . unwrap ( ) ] ) ;
112112
113113 // Should handle circular references gracefully
114114 assert ! ( output. status. success( ) ) ;
@@ -128,7 +128,7 @@ fn test_reserved_keyword_parameter_names() {
128128 ".d.ts" ,
129129 ) ;
130130
131- let output = run_dts2extern ( & [ file. path ( ) . to_str ( ) . unwrap ( ) ] ) ;
131+ let output = run_bindgen ( & [ file. path ( ) . to_str ( ) . unwrap ( ) ] ) ;
132132
133133 // Should handle reserved keywords
134134 assert ! ( output. status. success( ) ) ;
@@ -141,7 +141,7 @@ fn test_reserved_keyword_parameter_names() {
141141fn test_output_to_readonly_directory ( ) {
142142 let file = create_temp_file ( "export function test(): void;" , ".d.ts" ) ;
143143
144- let output = run_dts2extern ( & [
144+ let output = run_bindgen ( & [
145145 file. path ( ) . to_str ( ) . unwrap ( ) ,
146146 "-o" ,
147147 "/root/readonly_output.husk" ,
@@ -168,7 +168,7 @@ fn test_filter_with_no_matches() {
168168 ".d.ts" ,
169169 ) ;
170170
171- let output = run_dts2extern ( & [ file. path ( ) . to_str ( ) . unwrap ( ) , "--filter" , "nonexistent.*" ] ) ;
171+ let output = run_bindgen ( & [ file. path ( ) . to_str ( ) . unwrap ( ) , "--filter" , "nonexistent.*" ] ) ;
172172
173173 // Should succeed but produce module with no exports
174174 assert ! ( output. status. success( ) ) ;
@@ -178,7 +178,7 @@ fn test_filter_with_no_matches() {
178178fn test_invalid_regex_filter ( ) {
179179 let file = create_temp_file ( "export function test(): void;" , ".d.ts" ) ;
180180
181- let output = run_dts2extern ( & [ file. path ( ) . to_str ( ) . unwrap ( ) , "--filter" , "[invalid(regex" ] ) ;
181+ let output = run_bindgen ( & [ file. path ( ) . to_str ( ) . unwrap ( ) , "--filter" , "[invalid(regex" ] ) ;
182182
183183 // TODO: Filter validation is not yet implemented
184184 // For now, the command succeeds even with invalid regex
@@ -202,7 +202,7 @@ fn test_no_exports_in_file() {
202202 ".d.ts" ,
203203 ) ;
204204
205- let output = run_dts2extern ( & [ file. path ( ) . to_str ( ) . unwrap ( ) ] ) ;
205+ let output = run_bindgen ( & [ file. path ( ) . to_str ( ) . unwrap ( ) ] ) ;
206206
207207 // Should succeed
208208 assert ! ( output. status. success( ) ) ;
@@ -220,7 +220,7 @@ fn test_namespace_only_declarations() {
220220 ".d.ts" ,
221221 ) ;
222222
223- let output = run_dts2extern ( & [ file. path ( ) . to_str ( ) . unwrap ( ) ] ) ;
223+ let output = run_bindgen ( & [ file. path ( ) . to_str ( ) . unwrap ( ) ] ) ;
224224
225225 // Should handle namespace-only files
226226 assert ! ( output. status. success( ) ) ;
@@ -237,7 +237,7 @@ fn test_complex_generic_types_with_simplify() {
237237 ".d.ts" ,
238238 ) ;
239239
240- let output = run_dts2extern ( & [ file. path ( ) . to_str ( ) . unwrap ( ) , "--simplify" ] ) ;
240+ let output = run_bindgen ( & [ file. path ( ) . to_str ( ) . unwrap ( ) , "--simplify" ] ) ;
241241
242242 // With simplify, should succeed
243243 assert ! ( output. status. success( ) ) ;
@@ -250,7 +250,7 @@ fn test_complex_generic_types_with_simplify() {
250250fn test_module_name_with_special_chars ( ) {
251251 let file = create_temp_file ( "export function test(): void;" , ".d.ts" ) ;
252252
253- let output =
run_dts2extern ( & [ file
. path ( ) . to_str ( ) . unwrap ( ) , "-m" , "[email protected] " ] ) ; 253+ let output =
run_bindgen ( & [ file
. path ( ) . to_str ( ) . unwrap ( ) , "-m" , "[email protected] " ] ) ; 254254
255255 // Module names with special characters should be handled
256256 assert ! ( output. status. success( ) ) ;
@@ -261,7 +261,7 @@ fn test_very_long_module_name() {
261261 let file = create_temp_file ( "export function test(): void;" , ".d.ts" ) ;
262262
263263 let very_long_name = "a" . repeat ( 1000 ) ;
264- let output = run_dts2extern ( & [ file. path ( ) . to_str ( ) . unwrap ( ) , "-m" , & very_long_name] ) ;
264+ let output = run_bindgen ( & [ file. path ( ) . to_str ( ) . unwrap ( ) , "-m" , & very_long_name] ) ;
265265
266266 // Should handle very long module names
267267 assert ! ( output. status. success( ) ) ;
@@ -275,7 +275,7 @@ fn test_binary_file_input() {
275275 . unwrap ( ) ;
276276 file. flush ( ) . unwrap ( ) ;
277277
278- let output = run_dts2extern ( & [ file. path ( ) . to_str ( ) . unwrap ( ) ] ) ;
278+ let output = run_bindgen ( & [ file. path ( ) . to_str ( ) . unwrap ( ) ] ) ;
279279
280280 assert ! ( !output. status. success( ) ) ;
281281}
@@ -288,7 +288,7 @@ fn test_file_with_bom() {
288288 file. write_all ( b"export function test(): void;" ) . unwrap ( ) ;
289289 file. flush ( ) . unwrap ( ) ;
290290
291- let output = run_dts2extern ( & [ file. path ( ) . to_str ( ) . unwrap ( ) ] ) ;
291+ let output = run_bindgen ( & [ file. path ( ) . to_str ( ) . unwrap ( ) ] ) ;
292292
293293 // Should handle BOM correctly
294294 assert ! ( output. status. success( ) ) ;
0 commit comments