Compare commits
1 Commits
1974ed90be
...
working/#1
| Author | SHA1 | Date | |
|---|---|---|---|
| e25c27f082 |
20
src/app.rs
20
src/app.rs
@@ -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,9 +163,23 @@ 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(
|
||||||
|
|||||||
7
src/templates/it_works.c
Normal file
7
src/templates/it_works.c
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
assert((1 + 1) == 2);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user