mirror of
https://github.com/storytold/cadcraft.git
synced 2026-10-26 20:06:50 -06:00
* Build: line tables only in dev, no debug info for dependencies * Tests: one integration-test binary per crate Each crate's tests/*.rs becomes a module of tests/it/main.rs. Files that install process-wide state (the file io hooks, user aliases, SAVETIME and SAVEFILEPATH, user linetype and pattern files, registered fonts) stay their own test binaries. * xtask ci: nextest, tests without examples, one wasm check call
21 lines
769 B
Rust
21 lines
769 B
Rust
//! Recent Commands for the shortcut menus (#512): the commands started most recently, newest
|
|
//! first, each once.
|
|
|
|
use cadcraft_engine::Session;
|
|
|
|
#[test]
|
|
fn recent_commands_newest_first_without_repeats() {
|
|
let mut s = Session::new();
|
|
assert!(s.recent_commands(5).is_empty());
|
|
for line in ["LINE 0,0 10,0", "", "CIRCLE 0,0 5", "L 0,0 0,10", "", "ZOOM E"] {
|
|
s.cmdline(line).unwrap();
|
|
}
|
|
assert_eq!(s.recent_commands(5), ["zoom", "line", "circle"]);
|
|
assert_eq!(s.recent_commands(2), ["zoom", "line"]);
|
|
assert!(s.recent_commands(0).is_empty());
|
|
// Unknown names never get in.
|
|
assert!(s.cmdline("NOSUCHCOMMAND").is_err());
|
|
s.echo("Command: NOSUCHCOMMAND");
|
|
assert_eq!(s.recent_commands(5), ["zoom", "line", "circle"]);
|
|
}
|