cleaning up tests

This commit is contained in:
Jakub Doka 2024-09-28 16:34:08 +02:00
parent 6d805dc2ec
commit c3f9e535d3
No known key found for this signature in database
GPG key ID: C6E9A89936B8C143
3 changed files with 78 additions and 79 deletions

View file

@ -2686,8 +2686,6 @@ impl Codegen {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
const README: &str = include_str!("../README.md");
fn generate(ident: &'static str, input: &'static str, output: &mut String) { fn generate(ident: &'static str, input: &'static str, output: &mut String) {
let mut codegen = let mut codegen =
super::Codegen { files: crate::test_parse_files(ident, input), ..Default::default() }; super::Codegen { files: crate::test_parse_files(ident, input), ..Default::default() };
@ -2707,39 +2705,39 @@ mod tests {
} }
crate::run_tests! { generate: crate::run_tests! { generate:
arithmetic => README; arithmetic;
variables => README; variables;
functions => README; functions;
comments => README; comments;
if_statements => README; if_statements;
loops => README; loops;
//fb_driver => README; //fb_driver;
pointers => README; pointers;
structs => README; structs;
different_types => README; different_types;
struct_operators => README; struct_operators;
directives => README; directives;
global_variables => README; global_variables;
generic_types => README; generic_types;
generic_functions => README; generic_functions;
c_strings => README; c_strings;
idk => README; idk;
struct_patterns => README; struct_patterns;
arrays => README; arrays;
struct_return_from_module_function => README; struct_return_from_module_function;
//comptime_pointers => README; //comptime_pointers;
sort_something_viredly => README; sort_something_viredly;
hex_octal_binary_literals => README; hex_octal_binary_literals;
//comptime_min_reg_leak => README; //comptime_min_reg_leak;
// structs_in_registers => README; // structs_in_registers;
comptime_function_from_another_file => README; comptime_function_from_another_file;
inline => README; inline;
inline_test => README; inline_test;
some_generic_code => README; some_generic_code;
integer_inference_issues => README; integer_inference_issues;
writing_into_string => README; writing_into_string;
request_page => README; request_page;
tests_ptr_to_ptr_copy => README; tests_ptr_to_ptr_copy;
wide_ret => README; wide_ret;
} }
} }

View file

@ -40,12 +40,15 @@ use {
}, },
}; };
#[cfg(test)]
const README: &str = include_str!("../README.md");
#[macro_export] #[macro_export]
macro_rules! run_tests { macro_rules! run_tests {
($runner:path: $($name:ident => $input:expr;)*) => {$( ($runner:path: $($name:ident;)*) => {$(
#[test] #[test]
fn $name() { 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);
} }
)*}; )*};
} }

View file

@ -3076,8 +3076,6 @@ fn common_dom(mut a: Nid, mut b: Nid, nodes: &mut Nodes) -> Nid {
mod tests { mod tests {
use std::fmt::Write; use std::fmt::Write;
const README: &str = include_str!("../README.md");
fn generate(ident: &'static str, input: &'static str, output: &mut String) { fn generate(ident: &'static str, input: &'static str, output: &mut String) {
_ = env_logger::builder().is_test(true).try_init(); _ = env_logger::builder().is_test(true).try_init();
@ -3111,44 +3109,44 @@ mod tests {
} }
crate::run_tests! { generate: crate::run_tests! { generate:
arithmetic => README; arithmetic;
variables => README; variables;
functions => README; functions;
comments => README; comments;
if_statements => README; if_statements;
loops => README; loops;
fb_driver => README; fb_driver;
pointers => README; pointers;
//structs => README; //structs;
//different_types => README; //different_types;
//struct_operators => README; //struct_operators;
//directives => README; //directives;
//global_variables => README; //global_variables;
//generic_types => README; //generic_types;
//generic_functions => README; //generic_functions;
//c_strings => README; //c_strings;
//struct_patterns => README; //struct_patterns;
//arrays => README; //arrays;
//struct_return_from_module_function => README; //struct_return_from_module_function;
////comptime_pointers => README; ////comptime_pointers;
//sort_something_viredly => README; //sort_something_viredly;
hex_octal_binary_literals => README; hex_octal_binary_literals;
//comptime_min_reg_leak => README; //comptime_min_reg_leak;
////structs_in_registers => README; ////structs_in_registers;
//comptime_function_from_another_file => README; //comptime_function_from_another_file;
//inline => README; //inline;
//inline_test => README; //inline_test;
const_folding_with_arg => README; const_folding_with_arg;
branch_assignments => README; branch_assignments;
exhaustive_loop_testing => README; exhaustive_loop_testing;
//idk => README; //idk;
//comptime_min_reg_leak => README; //comptime_min_reg_leak;
//some_generic_code => README; //some_generic_code;
//integer_inference_issues => README; //integer_inference_issues;
//writing_into_string => README; //writing_into_string;
//request_page => README; //request_page;
//tests_ptr_to_ptr_copy => README; //tests_ptr_to_ptr_copy;
//wide_ret => README; //wide_ret;
pointer_opts => README; pointer_opts;
} }
} }