Skip to content

Commit

Permalink
test: add test for panic in macro parsing (#409)
Browse files Browse the repository at this point in the history
  • Loading branch information
jtroo committed May 20, 2023
1 parent 5afffa6 commit 3e292fe
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/cfg/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,19 @@ fn disallow_multiple_waiting_actions() {
}
}

#[test]
fn chord_in_macro_dont_panic() {
let _lk = match CFG_PARSE_LOCK.lock() {
Ok(guard) => guard,
Err(poisoned) => poisoned.into_inner(),
};
new_from_file(&std::path::PathBuf::from(
"./test_cfgs/macro-chord-dont-panic.kbd",
))
.map(|_| ())
.expect_err("graceful failure, no panic, also no success");
}

#[test]
fn recursive_multi_is_flattened() {
macro_rules! atom {
Expand Down
2 changes: 2 additions & 0 deletions test_cfgs/macro-chord-dont-panic.kbd
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(defsrc a)
(deflayer test (macro @ch|bas))

0 comments on commit 3e292fe

Please sign in to comment.