Skip to content

Commit

Permalink
Merge pull request #170 from ocean90/add/test-comments-with-tab-inden…
Browse files Browse the repository at this point in the history
…tation

Add test to cover translator comments with tab indentations
  • Loading branch information
swissspidy committed Jul 15, 2019
2 parents c973eb4 + fe5ac4b commit 2dee22e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
4 changes: 2 additions & 2 deletions composer.json
Expand Up @@ -11,13 +11,13 @@
}
],
"require": {
"gettext/gettext": "^4.6",
"gettext/gettext": "^4.6.3",
"mck89/peast": "^1.8",
"wp-cli/wp-cli": "^2"
},
"require-dev": {
"wp-cli/scaffold-command": "^1.2 || ^2",
"wp-cli/wp-cli-tests": "^2.1"
"wp-cli/wp-cli-tests": "^2.1.3"
},
"config": {
"process-timeout": 7200,
Expand Down
15 changes: 13 additions & 2 deletions features/makepot.feature
Expand Up @@ -494,6 +494,8 @@ Feature: Generate a POT file of a WordPress project
"""

Scenario: Extract translator comments
Given I run `echo "\t"`
And save STDOUT as {TAB}
Given an empty foo-plugin directory
And a foo-plugin/foo-plugin.php file:
"""
Expand All @@ -520,9 +522,14 @@ Feature: Generate a POT file of a WordPress project
*/
__( 'off', 'foo-plugin' );
/* translators: this should get extracted. */ $foo = __( 'baba', 'foo-plugin' );
/* translators: this should get extracted. */ $foo = __( 'baba', 'foo-plugin' );
/* translators: boo */ /* translators: this should get extracted too. */ /* some other comment */ $bar = g ( __( 'bubu', 'foo-plugin' ) );
/* translators: boo */ /* translators: this should get extracted too. */ /* some other comment */ $bar = g( __( 'bubu', 'foo-plugin' ) );
{TAB}/*
{TAB} * translators: this comment block is indented with a tab and should get extracted too.
{TAB} */
{TAB}__( 'yolo', 'foo-plugin' );
"""

When I run `wp i18n make-pot foo-plugin`
Expand Down Expand Up @@ -568,6 +575,10 @@ Feature: Generate a POT file of a WordPress project
"""
#. translators: this should get extracted too.
"""
And the foo-plugin/foo-plugin.pot file should contain:
"""
#. translators: this comment block is indented with a tab and should get extracted too.
"""

Scenario: Generates a POT file for a child theme with no other files
When I run `wp scaffold child-theme foobar --parent_theme=twentyseventeen --theme_name="Foo Bar" --author="Jane Doe" --author_uri="https://example.com" --theme_uri="https://foobar.example.com"`
Expand Down

0 comments on commit 2dee22e

Please sign in to comment.