INNER CODE UNIT · Rust

test_normalize_diagnostic

stjude-rust-labs/sprocket · crates/gauntlet/src/lib.rs:454

    fn test_normalize_diagnostic() {
        // Test Windows-style path normalization
        let windows_path = "Failed to import 'C:\\Users\\test\\file.wdl'";
        let unix_path = "Failed to import 'C:/Users/test/file.wdl'";
        assert_eq!(normalize_diagnostic(windows_path), unix_path);

        // Test line ending normalization
        let windows_line_ending = "Error message\r\nSecond line";
        let unix_line_ending = "Error message\nSecond line";
        assert_eq!(normalize_diagnostic(windows_line_ending), unix_line_ending);

        // Test OS-specific error message normalization
        let windows_file_error = "The system cannot find the file specified. (os error 2)";
        let windows_path_error = "The system cannot find the path specified. (os error 3)";
        let unix_error = "No such file or directory (os error 2)";
        assert_eq!(normalize_diagnostic(windows_file_error), unix_error);
        assert_eq!(normalize_diagnostic(windows_path_error), unix_error);

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…