From c3f9e535d3feb8e9872a30ca011c1382a417990c Mon Sep 17 00:00:00 2001 From: Jakub Doka Date: Sat, 28 Sep 2024 16:34:08 +0200 Subject: [PATCH] cleaning up tests --- hblang/src/codegen.rs | 70 ++++++++++++++++++------------------- hblang/src/lib.rs | 7 ++-- hblang/src/son.rs | 80 +++++++++++++++++++++---------------------- 3 files changed, 78 insertions(+), 79 deletions(-) diff --git a/hblang/src/codegen.rs b/hblang/src/codegen.rs index d3eee41..02f4246 100644 --- a/hblang/src/codegen.rs +++ b/hblang/src/codegen.rs @@ -2686,8 +2686,6 @@ impl Codegen { #[cfg(test)] mod tests { - const README: &str = include_str!("../README.md"); - fn generate(ident: &'static str, input: &'static str, output: &mut String) { let mut codegen = super::Codegen { files: crate::test_parse_files(ident, input), ..Default::default() }; @@ -2707,39 +2705,39 @@ mod tests { } crate::run_tests! { generate: - arithmetic => README; - variables => README; - functions => README; - comments => README; - if_statements => README; - loops => README; - //fb_driver => README; - pointers => README; - structs => README; - different_types => README; - struct_operators => README; - directives => README; - global_variables => README; - generic_types => README; - generic_functions => README; - c_strings => README; - idk => README; - struct_patterns => README; - arrays => README; - struct_return_from_module_function => README; - //comptime_pointers => README; - sort_something_viredly => README; - hex_octal_binary_literals => README; - //comptime_min_reg_leak => README; - // structs_in_registers => README; - comptime_function_from_another_file => README; - inline => README; - inline_test => README; - some_generic_code => README; - integer_inference_issues => README; - writing_into_string => README; - request_page => README; - tests_ptr_to_ptr_copy => README; - wide_ret => README; + arithmetic; + variables; + functions; + comments; + if_statements; + loops; + //fb_driver; + pointers; + structs; + different_types; + struct_operators; + directives; + global_variables; + generic_types; + generic_functions; + c_strings; + idk; + struct_patterns; + arrays; + struct_return_from_module_function; + //comptime_pointers; + sort_something_viredly; + hex_octal_binary_literals; + //comptime_min_reg_leak; + // structs_in_registers; + comptime_function_from_another_file; + inline; + inline_test; + some_generic_code; + integer_inference_issues; + writing_into_string; + request_page; + tests_ptr_to_ptr_copy; + wide_ret; } } diff --git a/hblang/src/lib.rs b/hblang/src/lib.rs index 9b4e2db..59fe947 100644 --- a/hblang/src/lib.rs +++ b/hblang/src/lib.rs @@ -40,12 +40,15 @@ use { }, }; +#[cfg(test)] +const README: &str = include_str!("../README.md"); + #[macro_export] macro_rules! run_tests { - ($runner:path: $($name:ident => $input:expr;)*) => {$( + ($runner:path: $($name:ident;)*) => {$( #[test] fn $name() { - $crate::run_test(std::any::type_name_of_val(&$name), stringify!($name), $input, $runner); + $crate::run_test(std::any::type_name_of_val(&$name), stringify!($name), $crate::README, $runner); } )*}; } diff --git a/hblang/src/son.rs b/hblang/src/son.rs index 8da65fe..f0e22de 100644 --- a/hblang/src/son.rs +++ b/hblang/src/son.rs @@ -3076,8 +3076,6 @@ fn common_dom(mut a: Nid, mut b: Nid, nodes: &mut Nodes) -> Nid { mod tests { use std::fmt::Write; - const README: &str = include_str!("../README.md"); - fn generate(ident: &'static str, input: &'static str, output: &mut String) { _ = env_logger::builder().is_test(true).try_init(); @@ -3111,44 +3109,44 @@ mod tests { } crate::run_tests! { generate: - arithmetic => README; - variables => README; - functions => README; - comments => README; - if_statements => README; - loops => README; - fb_driver => README; - pointers => README; - //structs => README; - //different_types => README; - //struct_operators => README; - //directives => README; - //global_variables => README; - //generic_types => README; - //generic_functions => README; - //c_strings => README; - //struct_patterns => README; - //arrays => README; - //struct_return_from_module_function => README; - ////comptime_pointers => README; - //sort_something_viredly => README; - hex_octal_binary_literals => README; - //comptime_min_reg_leak => README; - ////structs_in_registers => README; - //comptime_function_from_another_file => README; - //inline => README; - //inline_test => README; - const_folding_with_arg => README; - branch_assignments => README; - exhaustive_loop_testing => README; - //idk => README; - //comptime_min_reg_leak => README; - //some_generic_code => README; - //integer_inference_issues => README; - //writing_into_string => README; - //request_page => README; - //tests_ptr_to_ptr_copy => README; - //wide_ret => README; - pointer_opts => README; + arithmetic; + variables; + functions; + comments; + if_statements; + loops; + fb_driver; + pointers; + //structs; + //different_types; + //struct_operators; + //directives; + //global_variables; + //generic_types; + //generic_functions; + //c_strings; + //struct_patterns; + //arrays; + //struct_return_from_module_function; + ////comptime_pointers; + //sort_something_viredly; + hex_octal_binary_literals; + //comptime_min_reg_leak; + ////structs_in_registers; + //comptime_function_from_another_file; + //inline; + //inline_test; + const_folding_with_arg; + branch_assignments; + exhaustive_loop_testing; + //idk; + //comptime_min_reg_leak; + //some_generic_code; + //integer_inference_issues; + //writing_into_string; + //request_page; + //tests_ptr_to_ptr_copy; + //wide_ret; + pointer_opts; } }