ricecoder 0.1.72

Terminal-first, spec-driven coding assistant that understands your project before generating code
Documentation
// 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");
    }
}