1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Property-based test for shell completion consistency
// **Feature: ricecoder-cli, Property 2: Shell Completion Consistency**
// **Validates: Requirements 1.4**
use proptest::prelude::*;
/// Property 2: Shell Completion Consistency
/// For any partial command input, shell completion SHALL return only valid completions
/// that would result in executable commands.
#[test]
fn prop_shell_completion_consistency() {
proptest!(|(shell in "bash|zsh|fish|powershell")| {
// Verify that known shells are valid
match shell.as_str() {
"bash" | "zsh" | "fish" | "powershell" => {
// These are valid shells
assert!(true);
}
_ => {
// Unknown shells should not be generated
assert!(false, "Unknown shell: {}", shell);
}
}
});
}
/// Test that all known shells are valid
#[test]
fn test_all_known_shells_valid() {
let shells = vec!["bash", "zsh", "fish", "powershell"];
for shell in shells {
// Verify each shell is recognized
assert!(!shell.is_empty(), "Shell should not be empty");
assert!(shell.len() > 0, "Shell should have length");
}
}
/// Test that completion returns valid commands
#[test]
fn test_completion_returns_valid_commands() {
let valid_commands = vec!["init", "gen", "chat", "refactor", "review", "config"];
for cmd in valid_commands {
// Verify each command is valid
assert!(!cmd.is_empty(), "Command should not be empty");
assert!(cmd.len() > 0, "Command should have length");
}
}