Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unit tests failing in Xcode 15 #1382

Closed
wants to merge 1 commit into from

Conversation

mokagio
Copy link
Contributor

@mokagio mokagio commented Jan 12, 2024

WIP


These tests fail in CI, 15.0.1:

✖ testPasteImageWithoutFormatting, XCTAssertEqual failed: ("<p><strong>Pasted: This is an image </strong></p>") is not equal to ("<p><strong>Pasted: This is an image <img src="image.jpg"></strong></p>")

  | ✖ testPasteVideoWithoutFormatting, XCTAssertEqual failed: ("<p><strong>Pasted: This is a video </strong></p>") is not equal to ("<p><strong>Pasted: This is a video <video src="video.mp4" poster="video.jpg"></video></strong></p>")

Locally, on my Xcode 15.2, this other test fails, and only that:

CaptionShortcodeInputProcessorTests.swift:24: XCTAssertEqual failed: ("<figure  someattribute><img src="."><figcaption><b>Text</b><br><br><br></figcaption></figure>") is not equal to ("<figure someattribute><img src="."><figcaption><b>Text</b><br><br><br></figcaption></figure>")

The Xcode 15.2 test fails because of a different space in the output:

+ <figure  someattribute>
- <figure someattribute>

The following diff fixes the issue, but it would be good to get to the bottom of it, right?

diff --git a/WordPressEditor/WordPressEditorTests/WordPressPlugin/Calypso/CaptionShortcode/CaptionShortcodeInputProcessorTests.swift b/WordPressEditor/WordPressEditorTests/WordPressPlugin/Calypso/CaptionShortcode/CaptionShortcodeInputProcessorTests.swift
index d185ced6..b83695fc 100644
--- a/WordPressEditor/WordPressEditorTests/WordPressPlugin/Calypso/CaptionShortcode/CaptionShortcodeInputProcessorTests.swift
+++ b/WordPressEditor/WordPressEditorTests/WordPressPlugin/Calypso/CaptionShortcode/CaptionShortcodeInputProcessorTests.swift
@@ -19,12 +19,11 @@ class CaptionShortcodeInputProcessorTests: XCTestCase {
     ///
     func testCaptionShortcodeIsProperlyConvertedIntoFigureTagPreservingNestedTags() {
         let input = "[caption someattribute]<img src=\".\"><b>Text</b><br><br><br>[/caption]"
-        let expected = "<figure someattribute><img src=\".\"><figcaption><b>Text</b><br><br><br></figcaption></figure>"
+        let expected = "<figure  someattribute><img src=\".\"><figcaption><b>Text</b><br><br><br></figcaption></figure>"
 
         XCTAssertEqual(processor.process(input), expected)
     }
 
-
     /// Verifies that the caption shortcode's attributes are transferred over the Figure Tag.
     ///
     func testCaptionShortcodeAttributesAreProperlyPassedOntoTheFigureTag() {

The space issue look suspiciously similar to issues we encountered when migrating WordPress iOS. See wordpress-mobile/WordPress-iOS@49aedbb#diff-d0661df56dbfd6db7932a214bcaf9b0861007eee71a73562fc326176a5475439L41-R54

There, we noticed a formatter going from (the regular space) to \u{202F}. I tried it in the code failing on Xcode 15.2, but it didn't help. That should not be surprising given the diff here on GitHub shows we need to add two spaces.


  • I have considered if this change warrants release notes and have added them to the appropriate section in the CHANGELOG.md if necessary.

@mokagio mokagio mentioned this pull request Jan 12, 2024
2 tasks
Base automatically changed from use/xcode-15.0.1 to develop April 16, 2024 04:56
@mokagio
Copy link
Contributor Author

mokagio commented Apr 16, 2024

There, we noticed a formatter going from (the regular space) to \u{202F}. I tried it in the code failing on Xcode 15.2, but it didn't help. That should not be surprising given the diff here on GitHub shows we need to add two spaces.

This might be related. Notice the \u{fffc} in the plain value:

image

@mokagio
Copy link
Contributor Author

mokagio commented Apr 16, 2024

Closing in favor of #1392 and #1393

@mokagio mokagio closed this Apr 16, 2024
@mokagio mokagio deleted the mokagio/fix-unit-tests-xcode-15 branch April 16, 2024 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant