Added rustfmt.toml, formatted codebase

This commit is contained in:
2025-08-12 13:58:25 -04:00
parent 23fb67aba8
commit 8ad53f09b3
52 changed files with 15188 additions and 14451 deletions

View File

@@ -6,32 +6,44 @@ use super::super::*;
#[test]
fn getopt_from_argv() {
let node = get_nodes("echo -n -e foo", |node| matches!(node.class, NdRule::Command {..}))
.pop()
.unwrap();
let NdRule::Command { assignments: _, argv } = node.class else {
panic!()
};
let node = get_nodes("echo -n -e foo", |node| {
matches!(node.class, NdRule::Command { .. })
})
.pop()
.unwrap();
let NdRule::Command {
assignments: _,
argv,
} = node.class
else {
panic!()
};
let (words,opts) = get_opts_from_tokens(argv);
insta::assert_debug_snapshot!(words);
insta::assert_debug_snapshot!(opts)
let (words, opts) = get_opts_from_tokens(argv);
insta::assert_debug_snapshot!(words);
insta::assert_debug_snapshot!(opts)
}
#[test]
fn getopt_simple() {
let raw = "echo -n foo".split_whitespace().map(|s| s.to_string()).collect::<Vec<_>>();
let raw = "echo -n foo"
.split_whitespace()
.map(|s| s.to_string())
.collect::<Vec<_>>();
let (words,opts) = get_opts(raw);
insta::assert_debug_snapshot!(words);
insta::assert_debug_snapshot!(opts);
let (words, opts) = get_opts(raw);
insta::assert_debug_snapshot!(words);
insta::assert_debug_snapshot!(opts);
}
#[test]
fn getopt_multiple_short() {
let raw = "echo -nre foo".split_whitespace().map(|s| s.to_string()).collect::<Vec<_>>();
let raw = "echo -nre foo"
.split_whitespace()
.map(|s| s.to_string())
.collect::<Vec<_>>();
let (words,opts) = get_opts(raw);
insta::assert_debug_snapshot!(words);
insta::assert_debug_snapshot!(opts);
let (words, opts) = get_opts(raw);
insta::assert_debug_snapshot!(words);
insta::assert_debug_snapshot!(opts);
}