Since I was working on adding tests to l10n_server at #560132: Write tests, it quickly turned out that I'd need a full test suite for potx to ensure that files are parsed properly for the supported major versions of Drupal. I've actually started to add files to the l10n_server tests, since I needed packages for major Drupal versions, but figured out that these should really be in potx, so we can test potx standalone and then l10n_server can reuse these and package/wrap these as needed for its tests.

So I've made up the following tests:

- Drupal 5 module
- Drupal 6 module
- Drupal 7 module
- Drupal 6/7 JS file
- Drupal 5/6/7 info file

I've added tests to ensure that certain API characteristics are properly handled. Like the second argument to watchdog() is extracted in 6 or 7 but not in 5. Or that the hook_perm() items are not extracted in 7 or the context support is only effective in 7 but the base t() string is extracted nonetheless with any major Drupal version.

The info file test was easier, only checking for name, description and package fields. This is universal among major versions.

The JS string test is also simple, looking for the basic Drupal.t() and Drupal.formatPlural() that is supported in JS.

Missing are tests to look for more complex situations where function calls are embedded. Also lacking tests for how potx finds errors in source files. These would be useful to add tests for but this is already a pretty nice testsuite in itself.

Committed to 6 and needs porting to Drupal 7. Maybe the testing API is the very same (since I'm using the 6.x-2.x branch of simpletest), that would help in porting :)

CommentFileSizeAuthor
potx-tests.patch15.3 KBGábor Hojtsy
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Gábor Hojtsy’s picture

Version: 6.x-3.x-dev » 7.x-1.x-dev
Status: Patch (to be ported) » Fixed

Committed to the Drupal 7 branch as well.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.