use std::path::PathBuf;
#[test]
#[allow(deprecated)]
fn test_symbol_fact_contains_line_column_spans() {
let source = b"fn test_function() {}\n\nstruct TestStruct {}";
let mut parser = magellan::Parser::new().unwrap();
let facts = parser.extract_symbols(PathBuf::from("test.rs"), source);
assert!(!facts.is_empty(), "Should extract at least one symbol");
let func = &facts[0];
assert_eq!(func.kind, magellan::SymbolKind::Function);
let _start_line = func.start_line;
let _start_col = func.start_col;
let _end_line = func.end_line;
let _end_col = func.end_col;
assert_eq!(func.start_line, 1, "Function should start at line 1");
assert_eq!(
func.start_col, 0,
"Function should start at column 0 (0-indexed)"
);
}
#[test]
#[allow(deprecated)]
fn test_reference_fact_contains_line_column_spans() {
let source = b"fn foo() {}\nfn bar() { foo(); }";
let mut parser = magellan::Parser::new().unwrap();
let symbols = parser.extract_symbols(PathBuf::from("test.rs"), source);
let refs = parser.extract_references(PathBuf::from("test.rs"), source, &symbols);
assert!(!refs.is_empty(), "Should extract at least one reference");
let reference = &refs[0];
let _start_line = reference.start_line;
let _start_col = reference.start_col;
let _end_line = reference.end_line;
let _end_col = reference.end_col;
assert_eq!(reference.start_line, 2, "Reference should be on line 2");
}
#[test]
fn test_symbol_node_persistence_includes_line_column() {
use magellan::CodeGraph;
use tempfile::TempDir;
let temp_dir = TempDir::new().unwrap();
let db_path = temp_dir.path().join("test.db");
let mut graph = CodeGraph::open(&db_path).unwrap();
let source = b"fn example() {}";
graph.index_file("test.rs", source).unwrap();
let symbols = graph.symbols_in_file("test.rs").unwrap();
assert!(!symbols.is_empty());
let symbol = &symbols[0];
let _start_line = symbol.start_line;
let _start_col = symbol.start_col;
let _end_line = symbol.end_line;
let _end_col = symbol.end_col;
assert_eq!(symbol.start_line, 1, "Symbol should be on line 1");
}