diff --git a/src/compare/diff.rs b/src/compare/diff.rs index 29ea6fec..1f7e1ce9 100644 --- a/src/compare/diff.rs +++ b/src/compare/diff.rs @@ -438,9 +438,31 @@ pub fn compare_document<'s>( Ok(_) => {} } - // TODO: Compare :path + // Compare :path // :path is a quoted string to the absolute path of the document. let document_path = get_property_quoted_string(emacs, ":path")?; + let rust_document_path = rust.path.as_ref().map(|p| p.to_str()).flatten(); + match ( + document_path.as_ref().map(|s| s.as_str()), + rust_document_path, + ) { + (None, None) => {} + (None, Some(_)) | (Some(_), None) => { + this_status = DiffStatus::Bad; + message = Some(format!( + "Path mismatch (emacs != rust) {:?} != {:?}", + document_path, rust_document_path + )); + } + (Some(e), Some(r)) if e != r => { + this_status = DiffStatus::Bad; + message = Some(format!( + "Path mismatch (emacs != rust) {:?} != {:?}", + document_path, rust_document_path + )); + } + (Some(_), Some(_)) => {} + }; // Compare category // :CATEGORY is specified either from "#+CATEGORY:" or it is the file name without the ".org" extension.