Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#35961 closed enhancement (fixed)

Unit tests for _n_noop & _nx_noop

Reported by: realloc Owned by: SergeyBiryukov
Priority: normal Milestone: 4.5
Component: I18N Version:
Severity: normal Keywords: has-patch has-unit-tests
Cc: Focuses:

Description

I created the unit tests for _n_noop and _nx_noop. Additionally, I corrected a typo in the description of _n_noop.

Attachments (3)

35961.patch​ (1.6 KB ) - added by realloc 11 years ago.
Unit tests and correction of type in phpdoc of _n_noop
35961.2.patch​ (2.0 KB ) - added by realloc 11 years ago.
Unit tests and correction of the description in the doc of the functions
35961.3.patch​ (2.2 KB ) - added by realloc 11 years ago.
Interaction with translate_nooped_plural() added

Download all attachments as: .zip

Change History (12)

@realloc
11 years ago

Unit tests and correction of type in phpdoc of _n_noop

#1 follow-up: @swissspidy
11 years ago

  • Keywords has-patch needs-refresh added

That's not a typo, just a third-person singular verb.

#2 in reply to: ↑ 1 @realloc
11 years ago

Replying to swissspidy:

That's not a typo, just a third-person singular verb.

I don't think so ... at least, it's inconsistent. Please have a look at the description of _nx_noop ;)

#3 follow-up: @swissspidy
11 years ago

Yes, the docs are inconsistent. As ​per the handbook, third-person singular verbs should be used to describe what a function does. For example:

Registers plural strings in POT file, but doesn't translate them.

@realloc Would you mind creating a separate patch for the docs changes of these two functions?

@realloc
11 years ago

Unit tests and correction of the description in the doc of the functions

#4 in reply to: ↑ 3 @realloc
11 years ago

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

Replying to swissspidy:

@realloc Would you mind creating a separate patch for the docs changes of these two functions?

Ok, thanks for pointing that out. This time, I asked also my English teacher - jut to be sure. :-D

#5 follow-up: @johnbillion
11 years ago

  • Milestone Awaiting Review → Future Release
  • Version trunk

Thanks again for writing tests, @realloc!

I think these tests are too tightly coupled to the internal implementation of _n_noop() and _nx_noop(). Testing that the function returns an array containing those elements is ok, but what really needs to be tested is whether their return values work when they're passed to translate_nooped_plural(). Testing the return value doesn't really prove anything with regard to these particular functions.

I think it would be better to combine the tests with some for translate_nooped_plural(), that way we ensure that the *_noop() functions correctly interact with translate_nooped_plural().

@realloc
11 years ago

Interaction with translate_nooped_plural() added

#6 in reply to: ↑ 5 @realloc
11 years ago

Replying to johnbillion:

I think it would be better to combine the tests with some for translate_nooped_plural(), that way we ensure that the *_noop() functions correctly interact with translate_nooped_plural().

Thank you very much for helping here, John. I changed the tests so that these functions interact with translate_nooped_plural() now.

#7 @SergeyBiryukov
11 years ago

In 36765:

Docs: Correct _n_noop() and _nx_noop() descriptions to use third-person singular verbs.

Props realloc.
See #35961.

#8 @SergeyBiryukov
11 years ago

  • Owner set to SergeyBiryukov
  • Resolution → fixed
  • Status new → closed

In 36766:

L10n: Add unit tests for _n_noop() and _nx_noop().

Props realloc.
Fixes #35961.

#9 @SergeyBiryukov
11 years ago

  • Milestone Future Release → 4.5
Note: See TracTickets for help on using tickets.