mirror of
https://github.com/encounter/objdiff.git
synced 2025-12-10 14:07:45 +00:00
Fix section ordering with many same-named sections
Before, this was comparing, for example, `.text-2` with `.text-10` with standard string comparison, yielding `.text-10` before `.text-2`. Instead, this simply uses a stable sort by name, which preserves the relative ordering of sections.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use objdiff_core::{diff, obj};
|
||||
use objdiff_core::{diff, diff::display::SymbolFilter, obj};
|
||||
|
||||
mod common;
|
||||
|
||||
@@ -40,3 +40,18 @@ fn read_x86_64() {
|
||||
let output = common::display_diff(&obj, &diff, symbol_idx, &diff_config);
|
||||
insta::assert_snapshot!(output);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(feature = "x86")]
|
||||
fn display_section_ordering() {
|
||||
let diff_config = diff::DiffObjConfig::default();
|
||||
let obj = obj::read::parse(include_object!("data/x86/basenode.obj"), &diff_config).unwrap();
|
||||
let obj_diff =
|
||||
diff::diff_objs(Some(&obj), None, None, &diff_config, &diff::MappingConfig::default())
|
||||
.unwrap()
|
||||
.left
|
||||
.unwrap();
|
||||
let section_display =
|
||||
diff::display::display_sections(&obj, &obj_diff, SymbolFilter::None, false, false, false);
|
||||
insta::assert_debug_snapshot!(section_display);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user