From e25c27f082787a1f7a3e3fa1462a661d3e8cb26e Mon Sep 17 00:00:00 2001 From: godsfryingpan Date: Mon, 23 Mar 2026 11:43:22 -0500 Subject: [PATCH] wip --- src/app.rs | 20 ++++++++++++++++++++ src/templates/it_works.c | 7 +++++++ 2 files changed, 27 insertions(+) create mode 100644 src/templates/it_works.c diff --git a/src/app.rs b/src/app.rs index 2c19683..8002cdf 100644 --- a/src/app.rs +++ b/src/app.rs @@ -9,6 +9,7 @@ use colored::Colorize; use glob::glob; const MAIN_C: &str = include_str!("templates/main.c"); +const TEST_C: &str = include_str!("templates/it_works.c"); const GITIGNORE: &str = "target/"; #[derive(clap::Parser)] @@ -53,6 +54,11 @@ enum Subcommand { #[clap(subcommand)] command: UtilSubcommand, }, + /// Run tests in your project + Test { + /// The build mode to use + mode: Option, + }, /// List available build modes List, } @@ -157,10 +163,24 @@ impl App { std::process::exit(1); } } + Subcommand::Test { mode } => { + if let Err(e) = test(mode) { + eprintln!("Error running tests: {e}"); + std::process::exit(1); + } + } } } } +fn test(mode: Option) -> std::io::Result<()> { + for entry in glob("src/tests/*.c").expect("a valid glob pattern") { + if let Ok(file) = entry {} + } + + Ok(()) +} + fn list() -> std::io::Result<()> { let conf = get_config().ok_or(std::io::Error::new( std::io::ErrorKind::NotFound, diff --git a/src/templates/it_works.c b/src/templates/it_works.c new file mode 100644 index 0000000..3487b8f --- /dev/null +++ b/src/templates/it_works.c @@ -0,0 +1,7 @@ +#include + +int main() { + assert((1 + 1) == 2); + + return 0; +}