use xqpath::debugger::*;
#[cfg(test)]
mod enhanced_debugger_tests {
use super::*;
#[test]
fn test_enhanced_debugger_creation() {
let _debugger = XQPathDebugger::new();
assert!(true); }
#[test]
fn test_command_parsing_enhanced() {
assert!(matches!(
DebugCommand::parse(":help"),
Ok(DebugCommand::Help)
));
assert!(matches!(DebugCommand::parse(":h"), Ok(DebugCommand::Help)));
assert!(matches!(
DebugCommand::parse(":quit"),
Ok(DebugCommand::Quit)
));
assert!(matches!(DebugCommand::parse(":q"), Ok(DebugCommand::Quit)));
match DebugCommand::parse(":load test.json") {
Ok(DebugCommand::Load { file }) => {
assert_eq!(file.to_str().unwrap(), "test.json");
}
_ => panic!("Expected Load command"),
}
match DebugCommand::parse(":bp .users[0].name") {
Ok(DebugCommand::SetBreakpoint { path, condition }) => {
assert_eq!(path, ".users[0].name");
assert!(condition.is_none());
}
_ => panic!("Expected SetBreakpoint command"),
}
match DebugCommand::parse(":watch .users[*].age") {
Ok(DebugCommand::SetWatchPoint {
expression,
condition,
}) => {
assert_eq!(expression, ".users[*].age");
assert!(condition.is_none());
}
_ => panic!("Expected SetWatchPoint command"),
}
assert!(matches!(
DebugCommand::parse(":vars"),
Ok(DebugCommand::ListVariables)
));
assert!(matches!(
DebugCommand::parse(":v"),
Ok(DebugCommand::ListVariables)
));
assert!(matches!(
DebugCommand::parse(":reset"),
Ok(DebugCommand::Reset)
));
match DebugCommand::parse(".users[*].name") {
Ok(DebugCommand::Run { query }) => {
assert_eq!(query, ".users[*].name");
}
_ => panic!("Expected Run command for direct query"),
}
}
#[test]
fn test_debugger_session_management() {
let session = DebugSession::new();
assert!(session.breakpoints.is_empty());
assert!(session.watch_points.is_empty());
assert!(session.current_data.is_none());
assert!(matches!(session.execution_state, ExecutionState::Stopped));
}
#[test]
fn test_query_evaluator() {
let evaluator = QueryEvaluator::new();
assert!(evaluator.current_query.is_none());
assert!(evaluator.last_result.is_none());
}
#[test]
fn test_data_inspector() {
let inspector = DataInspector::default();
assert!(inspector.inspect_target.is_none());
assert!(inspector.inspect_path.is_none());
assert!(inspector.type_info.is_none());
}
}