Skip to content

Commit

Permalink
add a bless option to cli args
Browse files Browse the repository at this point in the history
  • Loading branch information
xffxff committed Sep 20, 2023
1 parent 22f80a3 commit ded6036
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ enum Commands {
/// path to test file or directory
#[arg(default_value = "lox_tests")]
path: PathBuf,

/// instead of validating the output, generate or update it
#[arg(long)]
bless: bool,
},
}

Expand All @@ -157,7 +161,11 @@ fn main() {
let db = Database::default();

match cli.command {
Commands::Test { path } => {
Commands::Test { path, bless } => {
if bless {
// add `UPDATE_EXPECT` to the environment to update the expected output
std::env::set_var("UPDATE_EXPECT", "1");
}
if path.is_dir() {
let test_cases = TestCase::list(&path);
for test_case in test_cases {
Expand Down

0 comments on commit ded6036

Please sign in to comment.