Make WordPress Core

#57718 closed defect (bug) (fixed)

Account for Windows line endings in `Tests_Formatting_wpAutop::test_skip_block_math_elements()`

Reported by: davidbaumwald's profile davidbaumwald Owned by: davidbaumwald's profile davidbaumwald
Milestone: 6.2 Priority: normal
Severity: normal Version: 6.2
Component: Build/Test Tools Keywords: good-first-bug has-patch has-unit-tests commit
Focuses: Cc:

Description

[55272] added support for <math> block elements in wpautop().

On Windows systems, one of the added tests for the changes in [55272] fails:

1) Tests_Formatting_wpAutop::test_skip_block_math_elements
Failed asserting that two strings are identical.
...
#Warning: Strings contain different line endings!

Perhaps the fix here is assertSameIgnoreEOL in place of assertSame?

CC @SergeyBiryukov.

Attachments (1)

57718.diff (510 bytes) - added by sakibmd 16 months ago.

Download all attachments as: .zip

Change History (9)

#1 @davidbaumwald
16 months ago

  • Summary changed from Account Windows line endings in `Tests_Formatting_wpAutop::test_skip_block_math_elements()` to Account for Windows line endings in `Tests_Formatting_wpAutop::test_skip_block_math_elements()`

#2 in reply to: ↑ description @SergeyBiryukov
16 months ago

Replying to davidbaumwald:

Perhaps the fix here is assertSameIgnoreEOL in place of assertSame?

Yes, that should work and would be consistent with other similar assertions in the same test class.

This ticket was mentioned in PR #4089 on WordPress/wordpress-develop by IgnatGeorgiev.


16 months ago
#3

  • Keywords has-patch has-unit-tests added; needs-patch removed

Tests: Changing assertion type for test_skip_block_math_elements() method from Tests_Formatting_wpAutop class.

The assertion type has been changed due to an issue with Windows installations and differences in EOL characters.

Trac ticket: https://core.trac.wordpress.org/ticket/57718

Trac ticket:

#4 @SergeyBiryukov
16 months ago

  • Keywords commit added

The PR looks good to me :)

#5 @davidbaumwald
16 months ago

  • Owner set to davidbaumwald
  • Status changed from new to reviewing

This ticket was mentioned in Slack in #core by costdev. View the logs.


16 months ago

@sakibmd
16 months ago

This ticket was mentioned in Slack in #core by costdev. View the logs.


16 months ago

#8 @SergeyBiryukov
16 months ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 55445:

Tests: Ignore EOL differences in a wpautop() test for <math> block elements.

Unix vs. Windows EOL style mismatches can cause misleading failures in tests using the heredoc syntax (<<<) or multiline strings as the expected result.

This commit resolves a failure when running the test suite on Windows:

1) Tests_Formatting_wpAutop::test_skip_block_math_elements
Failed asserting that two strings are identical.
...
#Warning: Strings contain different line endings!

Follow-up to [55272].

Props davidbaumwald, ignatggeorgiev, sakibmd.
Fixes #57718.

Note: See TracTickets for help on using tickets.