From e5a402ee1b651aff99df37a972c48583b7383049 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Mon, 2 Oct 2023 23:57:17 -0400 Subject: [PATCH] Compare type and value. Since we only support org-mode tables, type is always org. Value seems to always be nil, not sure why. --- src/compare/diff.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/compare/diff.rs b/src/compare/diff.rs index dd44402..b27e22a 100644 --- a/src/compare/diff.rs +++ b/src/compare/diff.rs @@ -1388,7 +1388,22 @@ fn compare_table<'b, 's>( } } - // TODO: Compare :type :value + // Compare type + let table_type = get_property_unquoted_atom(emacs, ":type")?.expect("Table should have a type"); + if table_type != "org" { + this_status = DiffStatus::Bad; + message = Some(format!( + "Table type mismatch (emacs != rust) {:?} != {:?}", + table_type, "org" + )); + } + + // Compare value + let value = get_property(emacs, ":value")?; + if value.is_some() { + this_status = DiffStatus::Bad; + message = Some(format!("Non-nil value {:?}", value)) + } for (emacs_child, rust_child) in children.iter().skip(2).zip(rust.children.iter()) { child_status.push(compare_ast_node(source, emacs_child, rust_child.into())?);