Skip to content

Commit

Permalink
test: ensure no default actions on real keys layer
Browse files Browse the repository at this point in the history
  • Loading branch information
jtroo committed Jun 16, 2024
1 parent d3ef95d commit 56676e5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
14 changes: 12 additions & 2 deletions parser/src/cfg/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ fn parse_cfg(cfg: &str) -> Result<IntermediateCfg> {
init_log();
let _lk = lock(&CFG_PARSE_LOCK);
let mut s = ParserState::default();
parse_cfg_raw_string(
let icfg = parse_cfg_raw_string(
cfg,
&mut s,
&PathBuf::from("test"),
Expand All @@ -53,7 +53,17 @@ fn parse_cfg(cfg: &str) -> Result<IntermediateCfg> {
},
DEF_LOCAL_KEYS,
Err("env vars not implemented".into()),
)
);
if let Ok(ref icfg) = icfg {
assert!(icfg
.klayers
.layers
.iter()
.all(|layer| layer[usize::from(NORMAL_KEY_ROW)]
.iter()
.all(|action| *action != DEFAULT_ACTION)));
}
icfg
}

#[test]
Expand Down
3 changes: 2 additions & 1 deletion parser/src/layers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ pub type KLayers =
Layers<'static, KEYS_IN_ROW, LAYER_ROWS, &'static &'static [&'static CustomAction]>;

pub struct KanataLayers {
layers: Layers<'static, KEYS_IN_ROW, LAYER_ROWS, &'static &'static [&'static CustomAction]>,
pub(crate) layers:
Layers<'static, KEYS_IN_ROW, LAYER_ROWS, &'static &'static [&'static CustomAction]>,
_allocations: Arc<Allocations>,
}

Expand Down

0 comments on commit 56676e5

Please sign in to comment.