From 8ce6da114c6d16f81f3367cedb65cc97ceda5175 Mon Sep 17 00:00:00 2001 From: Nicolas Guillot Date: Tue, 18 Nov 2025 09:01:00 +0100 Subject: [PATCH] code cleaning: remove print statement --- Sources/SwiftMath/MathRender/MTMathList.swift | 2 +- .../MTFontMathTableV2Tests.swift | 2 -- Tests/SwiftMathTests/MTFontV2Tests.swift | 2 -- .../MTMathListBuilderTests.swift | 30 ------------------- .../MTMathUILabelLineWrappingTests.swift | 1 - Tests/SwiftMathTests/MathFontTests.swift | 1 - Tests/SwiftMathTests/MathImageTests.swift | 9 ------ 7 files changed, 1 insertion(+), 46 deletions(-) diff --git a/Sources/SwiftMath/MathRender/MTMathList.swift b/Sources/SwiftMath/MathRender/MTMathList.swift index de45252..d4d8b90 100644 --- a/Sources/SwiftMath/MathRender/MTMathList.swift +++ b/Sources/SwiftMath/MathRender/MTMathList.swift @@ -285,7 +285,7 @@ public class MTMathAtom: NSObject { assert(self.superScript == nil, "Cannot fuse into an atom which has a superscript: \(self)"); assert(atom.type == self.type, "Only atoms of the same type can be fused. \(self), \(atom)"); guard self.subScript == nil, self.superScript == nil, self.type == atom.type - else { print("Can't fuse these 2 atoms"); return } + else { return } // Update the fused atoms list if self.fusedAtoms.isEmpty { diff --git a/Tests/SwiftMathTests/MTFontMathTableV2Tests.swift b/Tests/SwiftMathTests/MTFontMathTableV2Tests.swift index a6dcbf4..8cf49f8 100755 --- a/Tests/SwiftMathTests/MTFontMathTableV2Tests.swift +++ b/Tests/SwiftMathTests/MTFontMathTableV2Tests.swift @@ -22,7 +22,6 @@ final class MTFontMathTableV2Tests: XCTestCase { mTable?.fractionNumeratorDisplayStyleGapMin, mTable?.fractionNumeratorGapMin, ].compactMap{$0} - print("\($0.rawValue).plist: \(values)") } } private let executionQueue = DispatchQueue(label: "com.swiftmath.mathbundle", attributes: .concurrent) @@ -40,7 +39,6 @@ final class MTFontMathTableV2Tests: XCTestCase { executionGroup.notify(queue: .main) { [weak self] in guard let self = self else { return } XCTAssertEqual(self.testCount, totalCases) - print("\(self.testCount) completed =================") } executionGroup.wait() } diff --git a/Tests/SwiftMathTests/MTFontV2Tests.swift b/Tests/SwiftMathTests/MTFontV2Tests.swift index 6cda61c..f98f58c 100755 --- a/Tests/SwiftMathTests/MTFontV2Tests.swift +++ b/Tests/SwiftMathTests/MTFontV2Tests.swift @@ -31,7 +31,6 @@ final class MTFontV2Tests: XCTestCase { executionGroup.notify(queue: .main) { [weak self] in guard let self = self else { return } XCTAssertEqual(self.testCount, totalCases) - print("\(self.testCount) completed =================") } executionGroup.wait() } @@ -68,7 +67,6 @@ final class MTFontV2Tests: XCTestCase { executionGroup.notify(queue: .main) { [weak self] in guard let self = self else { return } XCTAssertEqual(self.testCount, totalCases) - print("\(self.testCount) completed =================") } executionGroup.wait() } diff --git a/Tests/SwiftMathTests/MTMathListBuilderTests.swift b/Tests/SwiftMathTests/MTMathListBuilderTests.swift index 2a5aef2..576436f 100644 --- a/Tests/SwiftMathTests/MTMathListBuilderTests.swift +++ b/Tests/SwiftMathTests/MTMathListBuilderTests.swift @@ -2187,19 +2187,9 @@ final class MTMathListBuilderTests: XCTestCase { ] for (latex, desc) in testCases { - print("Testing: \(desc)") - print(" LaTeX: \(latex)") var error: NSError? = nil let list = MTMathListBuilder.build(fromString: latex, error: &error) - if let err = error { - print(" ERROR: \(err.localizedDescription)") - } else if list == nil { - print(" List is nil but no error") - } else { - print(" SUCCESS: Got \(list!.atoms.count) atoms") - } - let unwrappedList = try XCTUnwrap(list, "Should parse: \(desc)") XCTAssertNil(error, "Should not error on \(desc): \(error?.localizedDescription ?? "")") XCTAssertTrue(unwrappedList.atoms.count >= 1, "\(desc) should have atoms") @@ -2474,19 +2464,9 @@ final class MTMathListBuilderTests: XCTestCase { ] for (latex, desc) in testCases { - print("Testing: \(desc)") - print(" LaTeX: \(latex)") var error: NSError? = nil let list = MTMathListBuilder.build(fromString: latex, error: &error) - if let err = error { - print(" ERROR: \(err.localizedDescription)") - } else if list == nil { - print(" List is nil but no error") - } else { - print(" SUCCESS: Got \(list!.atoms.count) atoms") - } - let unwrappedList = try XCTUnwrap(list, "Should parse: \(desc)") XCTAssertNil(error, "Should not error on \(desc): \(error?.localizedDescription ?? "")") XCTAssertTrue(unwrappedList.atoms.count >= 1, "\(desc) should have atoms") @@ -2521,19 +2501,9 @@ final class MTMathListBuilderTests: XCTestCase { ] for (latex, desc) in testCases { - print("Testing: \(desc)") - print(" LaTeX: \(latex)") var error: NSError? = nil let list = MTMathListBuilder.build(fromString: latex, error: &error) - if let err = error { - print(" ERROR: \(err.localizedDescription)") - } else if list == nil { - print(" List is nil but no error") - } else { - print(" SUCCESS: Got \(list!.atoms.count) atoms") - } - let unwrappedList = try XCTUnwrap(list, "Should parse: \(desc)") XCTAssertNil(error, "Should not error on \(desc): \(error?.localizedDescription ?? "")") XCTAssertTrue(unwrappedList.atoms.count >= 1, "\(desc) should have atoms") diff --git a/Tests/SwiftMathTests/MTMathUILabelLineWrappingTests.swift b/Tests/SwiftMathTests/MTMathUILabelLineWrappingTests.swift index ef5de3f..eb37984 100644 --- a/Tests/SwiftMathTests/MTMathUILabelLineWrappingTests.swift +++ b/Tests/SwiftMathTests/MTMathUILabelLineWrappingTests.swift @@ -253,7 +253,6 @@ class MTMathUILabelLineWrappingTests: XCTestCase { // Check that we have multiple display elements (wrapped content) if let displayList = label.displayList { - print("Display has \(displayList.subDisplays.count) subdisplays") XCTAssertGreaterThan(displayList.subDisplays.count, 1, "Should have multiple display elements from wrapping") } } diff --git a/Tests/SwiftMathTests/MathFontTests.swift b/Tests/SwiftMathTests/MathFontTests.swift index b690156..05e3fdb 100644 --- a/Tests/SwiftMathTests/MathFontTests.swift +++ b/Tests/SwiftMathTests/MathFontTests.swift @@ -76,7 +76,6 @@ final class MathFontTests: XCTestCase { executionGroup.notify(queue: .main) { [weak self] in guard let self = self else { return } XCTAssertEqual(self.testCount, totalCases) - print("\(self.testCount) completed =================") } executionGroup.wait() } diff --git a/Tests/SwiftMathTests/MathImageTests.swift b/Tests/SwiftMathTests/MathImageTests.swift index df77069..821a9fb 100755 --- a/Tests/SwiftMathTests/MathImageTests.swift +++ b/Tests/SwiftMathTests/MathImageTests.swift @@ -24,8 +24,6 @@ final class MathImageTests: XCTestCase { XCTAssertNotNil(result.layoutInfo) if result.error == nil, let image = result.image, let imageData = image.pngData() { safeImage(fileName: "test", pngData: imageData) - let fileUrl = URL(fileURLWithPath: NSTemporaryDirectory()) - print("completed, check \(fileUrl.path) image-test.png =================") } } func testSequentialMultipleImageScript() throws { @@ -42,8 +40,6 @@ final class MathImageTests: XCTestCase { XCTAssertNotNil(result.layoutInfo) if result.error == nil, let image = result.image, let imageData = image.pngData() { safeImage(fileName: "\(caseNumber)", pngData: imageData) - //let fileUrl = URL(fileURLWithPath: NSTemporaryDirectory()) - print("completed image-\(caseNumber).png") } default: result = SwiftMathImageResult.useMTMathImage(latex: latex, font: mathfont, fontSize: fontsize) @@ -51,12 +47,9 @@ final class MathImageTests: XCTestCase { XCTAssertNotNil(result.image) if result.error == nil, let image = result.image, let imageData = image.pngData() { safeImage(fileName: "\(caseNumber)", pngData: imageData) - //let fileUrl = URL(fileURLWithPath: NSTemporaryDirectory()) - print("completed image-\(caseNumber).png") } } } - print("check: \(URL(fileURLWithPath: NSTemporaryDirectory()).path) ==") } private let executionQueue = DispatchQueue(label: "com.swiftmath.mathbundle", attributes: .concurrent) @@ -78,8 +71,6 @@ final class MathImageTests: XCTestCase { } } executionGroup.notify(queue: .main) { [weak self] in - let fileUrl = URL(fileURLWithPath: NSTemporaryDirectory()) - print("\(self!.testCount)/\(self!.totalCases) completed, check \(fileUrl.path) ===") XCTAssertEqual(self?.testCount,self?.totalCases) } executionGroup.wait()