This commit is contained in:
2026-03-23 11:43:22 -05:00
parent f30432c1db
commit e25c27f082
2 changed files with 27 additions and 0 deletions

View File

@@ -9,6 +9,7 @@ use colored::Colorize;
use glob::glob; use glob::glob;
const MAIN_C: &str = include_str!("templates/main.c"); const MAIN_C: &str = include_str!("templates/main.c");
const TEST_C: &str = include_str!("templates/it_works.c");
const GITIGNORE: &str = "target/"; const GITIGNORE: &str = "target/";
#[derive(clap::Parser)] #[derive(clap::Parser)]
@@ -53,6 +54,11 @@ enum Subcommand {
#[clap(subcommand)] #[clap(subcommand)]
command: UtilSubcommand, command: UtilSubcommand,
}, },
/// Run tests in your project
Test {
/// The build mode to use
mode: Option<String>,
},
/// List available build modes /// List available build modes
List, List,
} }
@@ -157,10 +163,24 @@ impl App {
std::process::exit(1); 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<String>) -> 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<()> { fn list() -> std::io::Result<()> {
let conf = get_config().ok_or(std::io::Error::new( let conf = get_config().ok_or(std::io::Error::new(
std::io::ErrorKind::NotFound, std::io::ErrorKind::NotFound,

7
src/templates/it_works.c Normal file
View File

@@ -0,0 +1,7 @@
#include <assert.h>
int main() {
assert((1 + 1) == 2);
return 0;
}