use prometeu_analysis::{ids::FileId, span::Span}; use prometeu_compiler::common::diagnostics::{Diagnostic, DiagnosticBundle, Severity}; #[test] fn diagnostic_span_is_valid_for_file() { // Fixture simples let text = "let x = 10;"; // len = 11 let file = FileId(1); // Cria um diagnóstico com span válido: end exclusivo e <= len let span = Span::new(file, 0, text.len() as u32); assert!(span.end >= span.start); assert!(span.end <= text.len() as u32); let diag = Diagnostic { severity: Severity::Error, code: "E_TEST".to_string(), message: "testing".to_string(), span, related: vec![], }; let bundle = DiagnosticBundle { diagnostics: vec![diag] }; // Serialize para garantir que o span passa pelo pipeline sem panics let _json = serde_json::to_string(&bundle).expect("must serialize diagnostics"); }