@@ -3,40 +3,43 @@ mod nested_module;
33mod nested_struct;
44mod params;
55mod r#struct;
6+ mod win32_struct;
7+ mod winrt_struct;
68
79use std:: process:: Command ;
810
9- pub fn run_riddle ( name : & str ) -> Vec < windows_metadata:: File > {
10- let rd = format ! ( "tests/{name}.rd " ) ;
11+ pub fn run_riddle ( name : & str , dialect : & str , etc : & [ & str ] ) -> Vec < windows_metadata:: File > {
12+ let rdl = format ! ( "tests/{name}.rdl " ) ;
1113 let winmd = format ! ( "tests/{name}.winmd" ) ;
1214 let rs = format ! ( "src/{name}.rs" ) ;
1315
14- let before = std:: fs:: read_to_string ( & rd ) . expect ( "Failed to read input" ) ;
16+ let before = std:: fs:: read_to_string ( & rdl ) . expect ( "Failed to read input" ) ;
1517
16- // Convert .rd to .winmd
18+ // Convert .rdl to .winmd
1719 let mut command = Command :: new ( "cargo" ) ;
1820 command. args ( [
19- "run" , "-p" , "riddle" , "--" , "--in" , & rd , "--out" , & winmd, "--filter" , "Test" ,
21+ "run" , "-p" , "riddle" , "--" , "--in" , & rdl , "--out" , & winmd, "--filter" , "Test" ,
2022 ] ) ;
2123 assert ! ( command. status( ) . unwrap( ) . success( ) ) ;
2224
23- // Convert .winmd back to .rd
25+ // Convert .winmd back to .rdl
2426 let mut command = Command :: new ( "cargo" ) ;
2527 command. args ( [
26- "run" , "-p" , "riddle" , "--" , "--in" , & winmd, "--out" , & rd , "--filter" , "Test" ,
28+ "run" , "-p" , "riddle" , "--" , "--in" , & winmd, "--out" , & rdl , "--filter" , "Test" , "--config ",
2729 ] ) ;
30+ command. arg ( format ! ( "TYPE={dialect}" ) ) ;
2831 assert ! ( command. status( ) . unwrap( ) . success( ) ) ;
2932
30- // Check that .rd is unchanged
31- let after = std:: fs:: read_to_string ( & rd ) . expect ( "Failed to read output" ) ;
32- assert_eq ! ( before, after) ;
33+ // Check that .rdl is unchanged
34+ let after = std:: fs:: read_to_string ( & rdl ) . expect ( "Failed to read output" ) ;
35+ assert_eq ! ( before, after, "no equal {}" , rdl ) ;
3336
34- // Convert .rd to .rs
37+ // Convert .rdl to .rs
3538 let mut command = Command :: new ( "cargo" ) ;
3639 command. args ( [
37- "run" , "-p" , "riddle" , "--" , "--in" , & rd, "--out" , & rs, "--filter" , "Test" , "--config" ,
38- "FLATTEN" ,
40+ "run" , "-p" , "riddle" , "--" , "--in" , & rdl, "--out" , & rs, "--filter" , "Test" ,
3941 ] ) ;
42+ command. args ( etc) ;
4043 assert ! ( command. status( ) . unwrap( ) . success( ) ) ;
4144
4245 // Return winmd file for validation
0 commit comments