Add tests for add-comments option
This commit is contained in:
Родитель
3a9180b6bc
Коммит
f43fda2726
|
@ -0,0 +1,7 @@
|
|||
// I am a normal comment
|
||||
// comment: I am an extracted comment
|
||||
var msg = gettext('Hello World'); // comment: I am a comment on the same line
|
||||
// comment: I belong to dup
|
||||
var dup = gettext('Hello translators'); // I am an ordinary, inline code comment
|
||||
/// I'm a standards compliant extracted comment!
|
||||
var tis = gettext('Hello everyone'); ///I am an inline triple-slash comment
|
|
@ -0,0 +1,16 @@
|
|||
#: inputs/arbitrary_comments.js:3
|
||||
#. I am an extracted comment
|
||||
#. I am a comment on the same line
|
||||
msgid "Hello World"
|
||||
msgstr ""
|
||||
|
||||
#: inputs/arbitrary_comments.js:5
|
||||
#. I belong to dup
|
||||
msgid "Hello translators"
|
||||
msgstr ""
|
||||
|
||||
#: inputs/arbitrary_comments.js:7
|
||||
#. I'm a standards compliant extracted comment!
|
||||
#. I am an inline triple-slash comment
|
||||
msgid "Hello everyone"
|
||||
msgstr ""
|
|
@ -0,0 +1,23 @@
|
|||
"use strict";
|
||||
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
|
||||
var jsxgettext = require('../../lib/jsxgettext');
|
||||
var utils = require('../utils');
|
||||
|
||||
exports['test --add-comments option'] = function (assert, cb) {
|
||||
var inputFilename = path.join(__dirname, '..', 'inputs', 'arbitrary_comments.js');
|
||||
fs.readFile(inputFilename, 'utf8', function (err, source) {
|
||||
var options = {"add-comments": "comment:"};
|
||||
var result = jsxgettext.generate({'inputs/arbitrary_comments.js': source}, options);
|
||||
|
||||
assert.equal(typeof result, 'string', 'Result should be a string');
|
||||
assert.ok(result.length > 0, 'Result should not be empty');
|
||||
|
||||
var outputFilename = path.join(__dirname, '..', 'outputs', 'arbitrary_comments.pot');
|
||||
utils.compareResultWithFile(result, outputFilename, assert, cb);
|
||||
});
|
||||
};
|
||||
|
||||
if (module === require.main) require('test').run(exports);
|
Загрузка…
Ссылка в новой задаче