Skip to main content

decy_debugger/
step_debugger.rs

1//! Interactive step-through debugger
2//!
3//! Step through the transpilation pipeline interactively
4
5use std::path::Path;
6
7/// Run interactive step-through debugging
8pub fn interactive_step_through(file_path: &Path, _verbose: bool) {
9    println!("═══ Interactive Step-Through Debugger ═══");
10    println!("File: {}", file_path.display());
11    println!();
12    println!("Note: Interactive mode coming in future release.");
13    println!("For now, use:");
14    println!("  decy debug --visualize-ast <file>");
15    println!("  decy debug --visualize-hir <file>");
16    println!("  decy debug --visualize-ownership <file>");
17}
18
19#[cfg(test)]
20mod tests {
21    use super::*;
22    use std::path::PathBuf;
23
24    // Note: These tests verify the function doesn't panic with various inputs.
25    // Since the function prints to stdout, we test for non-panicking behavior.
26
27    #[test]
28    fn test_interactive_step_through_with_valid_path() {
29        let path = PathBuf::from("/tmp/test.c");
30        // Should not panic
31        interactive_step_through(&path, false);
32    }
33
34    #[test]
35    fn test_interactive_step_through_with_verbose_flag() {
36        let path = PathBuf::from("/tmp/test.c");
37        // Should not panic even with verbose=true (currently unused)
38        interactive_step_through(&path, true);
39    }
40
41    #[test]
42    fn test_interactive_step_through_with_nonexistent_file() {
43        let path = PathBuf::from("/nonexistent/path/to/file.c");
44        // Should not panic - function just prints the path, doesn't verify existence
45        interactive_step_through(&path, false);
46    }
47
48    #[test]
49    fn test_interactive_step_through_with_empty_path() {
50        let path = PathBuf::from("");
51        // Should not panic with empty path
52        interactive_step_through(&path, false);
53    }
54
55    #[test]
56    fn test_interactive_step_through_with_special_characters() {
57        let path = PathBuf::from("/path/with spaces/and-dashes/file_name.c");
58        // Should handle special characters in path
59        interactive_step_through(&path, false);
60    }
61
62    #[test]
63    fn test_interactive_step_through_with_unicode_path() {
64        let path = PathBuf::from("/home/用户/测试文件.c");
65        // Should handle unicode in path
66        interactive_step_through(&path, false);
67    }
68
69    #[test]
70    fn test_interactive_step_through_with_relative_path() {
71        let path = PathBuf::from("./relative/path/test.c");
72        // Should work with relative paths
73        interactive_step_through(&path, false);
74    }
75
76    #[test]
77    fn test_interactive_step_through_with_dot_path() {
78        let path = PathBuf::from(".");
79        // Should work with current directory
80        interactive_step_through(&path, false);
81    }
82}