From 9a1f0470441bf1d3ddd8b43ca8ba8eb4164257c2 Mon Sep 17 00:00:00 2001 From: p-x9 <50244599+p-x9@users.noreply.github.com> Date: Tue, 6 Feb 2024 21:22:56 +0900 Subject: [PATCH] add tests for `Symbol.sectionNumber` --- Tests/MachOKitTests/MachOFilePrintTests.swift | 4 ++++ Tests/MachOKitTests/MachOPrintTests.swift | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/Tests/MachOKitTests/MachOFilePrintTests.swift b/Tests/MachOKitTests/MachOFilePrintTests.swift index 5c43f60..ca02d6b 100644 --- a/Tests/MachOKitTests/MachOFilePrintTests.swift +++ b/Tests/MachOKitTests/MachOFilePrintTests.swift @@ -170,6 +170,10 @@ final class MachOFilePrintTests: XCTestCase { print("Stab:", stab) } } + if let sectionNumber = symbol.nlist.sectionNumber { + let section = machO.sections[sectionNumber - 1] + print("Section:", "\(section.segmentName).\(section.sectionName)") + } if let description = symbol.nlist.symbolDescription { print("SymbolDescription:", description.bits) if let referenceFlag = description.referenceFlag { diff --git a/Tests/MachOKitTests/MachOPrintTests.swift b/Tests/MachOKitTests/MachOPrintTests.swift index 2cc71eb..be06e8f 100644 --- a/Tests/MachOKitTests/MachOPrintTests.swift +++ b/Tests/MachOKitTests/MachOPrintTests.swift @@ -103,6 +103,10 @@ final class MachOPrintTests: XCTestCase { print("Stab:", stab) } } + if let sectionNumber = symbol.nlist.sectionNumber { + let section = machO.sections[sectionNumber - 1] + print("Section:", "\(section.segmentName).\(section.sectionName)") + } if let description = symbol.nlist.symbolDescription { print("SymbolDescription:", description.bits) if let referenceFlag = description.referenceFlag {