aboutsummaryrefslogtreecommitdiff
path: root/node_modules/po2json/test
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2016-10-10 03:43:44 +0200
committerFlorian Dold <florian.dold@gmail.com>2016-10-10 03:43:44 +0200
commitabd94a7f5a50f43c797a11b53549ae48fff667c3 (patch)
treeab8ed457f65cdd72e13e0571d2975729428f1551 /node_modules/po2json/test
parenta0247c6a3fd6a09a41a7e35a3441324c4dcb58be (diff)
downloadwallet-core-abd94a7f5a50f43c797a11b53549ae48fff667c3.tar.xz
add node_modules to address #4364
Diffstat (limited to 'node_modules/po2json/test')
-rw-r--r--node_modules/po2json/test/fixtures/en-empty.json40
-rw-r--r--node_modules/po2json/test/fixtures/en-empty.po45
-rw-r--r--node_modules/po2json/test/fixtures/en-mf-fallback-to-msgid.json9
-rw-r--r--node_modules/po2json/test/fixtures/en-no-header.json6
-rw-r--r--node_modules/po2json/test/fixtures/en-no-header.po4
-rw-r--r--node_modules/po2json/test/fixtures/ja.json16
-rwxr-xr-xnode_modules/po2json/test/fixtures/ja.po22
-rw-r--r--node_modules/po2json/test/fixtures/pl-jed.json40
-rw-r--r--node_modules/po2json/test/fixtures/pl-jed1.x.json34
-rw-r--r--node_modules/po2json/test/fixtures/pl-mf.json7
-rw-r--r--node_modules/po2json/test/fixtures/pl-mf.po44
-rw-r--r--node_modules/po2json/test/fixtures/pl.json43
-rw-r--r--node_modules/po2json/test/fixtures/pl.po58
-rw-r--r--node_modules/po2json/test/po2json_test.js144
14 files changed, 512 insertions, 0 deletions
diff --git a/node_modules/po2json/test/fixtures/en-empty.json b/node_modules/po2json/test/fixtures/en-empty.json
new file mode 100644
index 000000000..4216a1c05
--- /dev/null
+++ b/node_modules/po2json/test/fixtures/en-empty.json
@@ -0,0 +1,40 @@
+{
+ "": {
+ "project-id-version": "po2json",
+ "pot-creation-date": "2012-10-26 12:00+0000",
+ "po-revision-date": "2013-11-08 09:09+0200",
+ "last-translator": "Illimar Tambek <illimar.tambek@gmail.com>",
+ "language-team": "po2json",
+ "mime-version": "1.0",
+ "plural-forms": "nplurals=2; plural=(n != 1);",
+ "content-type": "text/plain; charset=UTF-8",
+ "content-transfer-encoding": "8bit",
+ "x-generator": "Poedit 1.5.7",
+ "language": "en"
+ },
+ "Hello, world!\n": [
+ null,
+ "Hello, world!\n"
+ ],
+ "string context\u0004the contextual phrase": [
+ null,
+ "the contextual phrase"
+ ],
+ "this is the first line\nthis is the next one\nbut this is the last\n": [
+ null,
+ "this is the first line\nthis is the next one\nbut this is the last\n"
+ ],
+ "one product": [
+ "%d products",
+ "one product",
+ "%d products"
+ ],
+ "A sentence with \"quotation\" marks.": [
+ null,
+ "A sentence with \"quotation\" marks."
+ ],
+ "A fuzzy translation": [
+ null,
+ "A fuzzy translation"
+ ]
+} \ No newline at end of file
diff --git a/node_modules/po2json/test/fixtures/en-empty.po b/node_modules/po2json/test/fixtures/en-empty.po
new file mode 100644
index 000000000..b2cb6bd55
--- /dev/null
+++ b/node_modules/po2json/test/fixtures/en-empty.po
@@ -0,0 +1,45 @@
+# English empty translation for po2json text fixture.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: po2json\n"
+"POT-Creation-Date: 2012-10-26 12:00+0000\n"
+"PO-Revision-Date: 2013-11-08 09:09+0200\n"
+"Last-Translator: Illimar Tambek <illimar.tambek@gmail.com>\n"
+"Language-Team: po2json\n"
+"MIME-Version: 1.0\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: Poedit 1.5.7\n"
+"Language: en\n"
+
+#: test.js:1
+msgid "Hello, world!\n"
+msgstr ""
+
+#: test.js:2
+msgctxt "string context"
+msgid "the contextual phrase"
+msgstr ""
+
+#: test.js:3
+msgid ""
+"this is the first line\n"
+"this is the next one\n"
+"but this is the last\n"
+msgstr ""
+
+#: test.js:4
+msgid "one product"
+msgid_plural "%d products"
+msgstr[0] ""
+msgstr[1] ""
+
+#: test.js:5
+msgid "A sentence with \"quotation\" marks."
+msgstr ""
+
+#: test.js:6
+msgid "A fuzzy translation"
+msgstr ""
diff --git a/node_modules/po2json/test/fixtures/en-mf-fallback-to-msgid.json b/node_modules/po2json/test/fixtures/en-mf-fallback-to-msgid.json
new file mode 100644
index 000000000..8f4d790ba
--- /dev/null
+++ b/node_modules/po2json/test/fixtures/en-mf-fallback-to-msgid.json
@@ -0,0 +1,9 @@
+{
+ "Hello, world!\n": "Hello, world!\n",
+ "this is the first line\nthis is the next one\nbut this is the last\n":
+ "this is the first line\nthis is the next one\nbut this is the last\n",
+ "A sentence with \"quotation\" marks.": "A sentence with \"quotation\" marks.",
+ "one product": "one product",
+ "string context\u0004the contextual phrase": "the contextual phrase",
+ "A fuzzy translation": "A fuzzy translation"
+} \ No newline at end of file
diff --git a/node_modules/po2json/test/fixtures/en-no-header.json b/node_modules/po2json/test/fixtures/en-no-header.json
new file mode 100644
index 000000000..f933eb8eb
--- /dev/null
+++ b/node_modules/po2json/test/fixtures/en-no-header.json
@@ -0,0 +1,6 @@
+{
+ "Hello World": [
+ null,
+ "Hello World"
+ ]
+} \ No newline at end of file
diff --git a/node_modules/po2json/test/fixtures/en-no-header.po b/node_modules/po2json/test/fixtures/en-no-header.po
new file mode 100644
index 000000000..7b57ae104
--- /dev/null
+++ b/node_modules/po2json/test/fixtures/en-no-header.po
@@ -0,0 +1,4 @@
+# Very minimal .po
+
+msgid "Hello World"
+msgstr "Hello World"
diff --git a/node_modules/po2json/test/fixtures/ja.json b/node_modules/po2json/test/fixtures/ja.json
new file mode 100644
index 000000000..35f2cdc7b
--- /dev/null
+++ b/node_modules/po2json/test/fixtures/ja.json
@@ -0,0 +1,16 @@
+{
+ "": {
+ "project-id-version": "VERSION",
+ "po-revision-date": "2016-08-08 14:08+0000",
+ "last-translator": "FULL NAME <EMAIL@ADDRESS>",
+ "language-team": "LANGUAGE TEAM <EMAIL@ADDRESS>",
+ "language": "ja",
+ "mime-version": "1.0",
+ "content-type": "text/plain; charset=UTF-8",
+ "content-transfer-encoding": "8bit",
+ "plural-forms": "nplurals=1; plural=0;"
+ },
+ "♂ Male": [ null, "男性" ],
+ "partner application": [ "partner applications", [ "パートナーアプリ" ] ],
+ "result": [ "results", [ "検索結果" ] ]
+}
diff --git a/node_modules/po2json/test/fixtures/ja.po b/node_modules/po2json/test/fixtures/ja.po
new file mode 100755
index 000000000..3310fa930
--- /dev/null
+++ b/node_modules/po2json/test/fixtures/ja.po
@@ -0,0 +1,22 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: VERSION\n"
+"PO-Revision-Date: 2016-08-08 14:08+0000\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE TEAM <EMAIL@ADDRESS>\n"
+"Language: ja\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=1; plural=0;\n"
+
+msgid "♂ Male"
+msgstr "男性"
+
+msgid "partner application"
+msgid_plural "partner applications"
+msgstr[0] "パートナーアプリ"
+
+msgid "result"
+msgid_plural "results"
+msgstr[0] "検索結果"
diff --git a/node_modules/po2json/test/fixtures/pl-jed.json b/node_modules/po2json/test/fixtures/pl-jed.json
new file mode 100644
index 000000000..43f8c4133
--- /dev/null
+++ b/node_modules/po2json/test/fixtures/pl-jed.json
@@ -0,0 +1,40 @@
+{
+ "domain": "messages",
+ "locale_data": {
+ "messages": {
+ "": {
+ "domain": "messages",
+ "plural_forms": "nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);",
+ "lang": "pl"
+ },
+ "Hello, world!\n": [
+ null,
+ "Witaj, świecie!\n"
+ ],
+ "this is the first line\nthis is the next one\nbut this is the last\n": [
+ null,
+ "to jest pierwsza linia\nto jest następny\nale to jest ostatnia\n"
+ ],
+ "one product": [
+ "%d products",
+ "jeden produkt",
+ "%d produkty",
+ "%d produktów"
+ ],
+ "A sentence with \"quotation\" marks.": [
+ null,
+ "Zdanie w \"cudzysłowie\"."
+ ],
+ "string context\u0004the contextual phrase": [
+ null,
+ "zwrot kontekstowe"
+ ],
+ "a product": [
+ "%d products",
+ "",
+ "",
+ ""
+ ]
+ }
+ }
+}
diff --git a/node_modules/po2json/test/fixtures/pl-jed1.x.json b/node_modules/po2json/test/fixtures/pl-jed1.x.json
new file mode 100644
index 000000000..630ac3a77
--- /dev/null
+++ b/node_modules/po2json/test/fixtures/pl-jed1.x.json
@@ -0,0 +1,34 @@
+{
+ "domain": "messages",
+ "locale_data": {
+ "messages": {
+ "": {
+ "domain": "messages",
+ "plural_forms": "nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);",
+ "lang": "pl"
+ },
+ "Hello, world!\n": [
+ "Witaj, świecie!\n"
+ ],
+ "this is the first line\nthis is the next one\nbut this is the last\n": [
+ "to jest pierwsza linia\nto jest następny\nale to jest ostatnia\n"
+ ],
+ "one product": [
+ "jeden produkt",
+ "%d produkty",
+ "%d produktów"
+ ],
+ "A sentence with \"quotation\" marks.": [
+ "Zdanie w \"cudzysłowie\"."
+ ],
+ "string context\u0004the contextual phrase": [
+ "zwrot kontekstowe"
+ ],
+ "a product": [
+ "",
+ "%d products",
+ "%d products"
+ ]
+ }
+ }
+}
diff --git a/node_modules/po2json/test/fixtures/pl-mf.json b/node_modules/po2json/test/fixtures/pl-mf.json
new file mode 100644
index 000000000..19a3550f4
--- /dev/null
+++ b/node_modules/po2json/test/fixtures/pl-mf.json
@@ -0,0 +1,7 @@
+{
+ "Hello, world!\n": "Witaj, świecie!\n",
+ "this is the first line\nthis is the next one\nbut this is the last\n":
+ "to jest pierwsza linia\nto jest następny\nale to jest ostatnia\n",
+ "A sentence with \"quotation\" marks.": "Zdanie w \"cudzysłowie\".",
+ "string context\u0004the contextual phrase": "zwrot kontekstowe"
+} \ No newline at end of file
diff --git a/node_modules/po2json/test/fixtures/pl-mf.po b/node_modules/po2json/test/fixtures/pl-mf.po
new file mode 100644
index 000000000..f954710a8
--- /dev/null
+++ b/node_modules/po2json/test/fixtures/pl-mf.po
@@ -0,0 +1,44 @@
+# Polish translation for po2json text fixture.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: po2json\n"
+"POT-Creation-Date: 2012-10-26 12:00+0000\n"
+"PO-Revision-Date: 2013-11-08 09:09+0200\n"
+"Last-Translator: Illimar Tambek <illimar.tambek@gmail.com>\n"
+"Language-Team: po2json\n"
+"MIME-Version: 1.0\n"
+"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
+"|| n%100>=20) ? 1 : 2);\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: Poedit 1.5.7\n"
+"Language: pl\n"
+
+#: test.js:1
+msgid "Hello, world!\n"
+msgstr "Witaj, świecie!\n"
+
+#: test.js:2
+msgctxt "string context"
+msgid "the contextual phrase"
+msgstr "zwrot kontekstowe"
+
+#: test.js:3
+msgid ""
+"this is the first line\n"
+"this is the next one\n"
+"but this is the last\n"
+msgstr ""
+"to jest pierwsza linia\n"
+"to jest następny\n"
+"ale to jest ostatnia\n"
+
+#: test.js:5
+msgid "A sentence with \"quotation\" marks."
+msgstr "Zdanie w \"cudzysłowie\"."
+
+#: test.js:6
+#, fuzzy
+msgid "A fuzzy translation"
+msgstr "Tłumaczenie rozmyta"
diff --git a/node_modules/po2json/test/fixtures/pl.json b/node_modules/po2json/test/fixtures/pl.json
new file mode 100644
index 000000000..8530ad456
--- /dev/null
+++ b/node_modules/po2json/test/fixtures/pl.json
@@ -0,0 +1,43 @@
+{
+ "": {
+ "project-id-version": "po2json",
+ "pot-creation-date": "2012-10-26 12:00+0000",
+ "po-revision-date": "2013-11-08 09:09+0200",
+ "last-translator": "Illimar Tambek <illimar.tambek@gmail.com>",
+ "language-team": "po2json",
+ "mime-version": "1.0",
+ "plural-forms": "nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);",
+ "content-type": "text/plain; charset=UTF-8",
+ "content-transfer-encoding": "8bit",
+ "x-generator": "Poedit 1.5.7",
+ "language": "pl"
+ },
+ "Hello, world!\n": [
+ null,
+ "Witaj, świecie!\n"
+ ],
+ "this is the first line\nthis is the next one\nbut this is the last\n": [
+ null,
+ "to jest pierwsza linia\nto jest następny\nale to jest ostatnia\n"
+ ],
+ "one product": [
+ "%d products",
+ "jeden produkt",
+ "%d produkty",
+ "%d produktów"
+ ],
+ "A sentence with \"quotation\" marks.": [
+ null,
+ "Zdanie w \"cudzysłowie\"."
+ ],
+ "string context\u0004the contextual phrase": [
+ null,
+ "zwrot kontekstowe"
+ ],
+ "a product": [
+ "%d products",
+ "",
+ "",
+ ""
+ ]
+}
diff --git a/node_modules/po2json/test/fixtures/pl.po b/node_modules/po2json/test/fixtures/pl.po
new file mode 100644
index 000000000..4fda5f7a6
--- /dev/null
+++ b/node_modules/po2json/test/fixtures/pl.po
@@ -0,0 +1,58 @@
+# Polish translation for po2json text fixture.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: po2json\n"
+"POT-Creation-Date: 2012-10-26 12:00+0000\n"
+"PO-Revision-Date: 2013-11-08 09:09+0200\n"
+"Last-Translator: Illimar Tambek <illimar.tambek@gmail.com>\n"
+"Language-Team: po2json\n"
+"MIME-Version: 1.0\n"
+"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
+"|| n%100>=20) ? 1 : 2);\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: Poedit 1.5.7\n"
+"Language: pl\n"
+
+#: test.js:1
+msgid "Hello, world!\n"
+msgstr "Witaj, świecie!\n"
+
+#: test.js:2
+msgctxt "string context"
+msgid "the contextual phrase"
+msgstr "zwrot kontekstowe"
+
+#: test.js:3
+msgid ""
+"this is the first line\n"
+"this is the next one\n"
+"but this is the last\n"
+msgstr ""
+"to jest pierwsza linia\n"
+"to jest następny\n"
+"ale to jest ostatnia\n"
+
+#: test.js:4
+msgid "one product"
+msgid_plural "%d products"
+msgstr[0] "jeden produkt"
+msgstr[1] "%d produkty"
+msgstr[2] "%d produktów"
+
+#: test.js:5
+msgid "A sentence with \"quotation\" marks."
+msgstr "Zdanie w \"cudzysłowie\"."
+
+#: test.js:6
+#, fuzzy
+msgid "A fuzzy translation"
+msgstr "Tłumaczenie rozmyta"
+
+#: test.js:7
+msgid "a product"
+msgid_plural "%d products"
+msgstr[0] ""
+msgstr[1] ""
+msgstr[2] ""
diff --git a/node_modules/po2json/test/po2json_test.js b/node_modules/po2json/test/po2json_test.js
new file mode 100644
index 000000000..18385274c
--- /dev/null
+++ b/node_modules/po2json/test/po2json_test.js
@@ -0,0 +1,144 @@
+var po2json = require(".."),
+ fs = require("fs"),
+ Jed = require("jed");
+
+module.exports["parse"] = {
+ setUp: function(callback){
+ this.po = fs.readFileSync(__dirname + "/fixtures/pl.po");
+ this.json = JSON.parse(fs.readFileSync(__dirname + "/fixtures/pl.json", "utf-8"));
+ callback();
+ },
+
+ parse: function(test){
+ var parsed = po2json.parse(this.po);
+ test.deepEqual(parsed, this.json);
+ test.done();
+ }
+}
+
+module.exports["parse with Jed format"] = {
+ setUp: function(callback){
+ this.po = fs.readFileSync(__dirname + "/fixtures/pl.po");
+ this.json = JSON.parse(fs.readFileSync(__dirname + "/fixtures/pl-jed.json", "utf-8"));
+ callback();
+ },
+
+ parse: function(test){
+ var parsed = po2json.parse(this.po, { format: 'jed' });
+ test.deepEqual(parsed, this.json);
+ test.doesNotThrow(function() { new Jed(parsed) }, Error)
+ test.done();
+ }
+};
+
+module.exports["parse with Jed1.x format"] = {
+ setUp: function(callback){
+ this.po = fs.readFileSync(__dirname + "/fixtures/pl.po");
+ this.json = JSON.parse(fs.readFileSync(__dirname + "/fixtures/pl-jed1.x.json", "utf-8"));
+ callback();
+ },
+
+ parse: function(test){
+ var parsed = po2json.parse(this.po, { format: 'jed1.x' });
+ test.deepEqual(parsed, this.json);
+ test.doesNotThrow(function() { new Jed(parsed) }, Error)
+ test.done();
+ }
+};
+
+module.exports["parse with MessageFormatter format"] = {
+ setUp: function(callback){
+ this.po = fs.readFileSync(__dirname + "/fixtures/pl-mf.po");
+ this.json = JSON.parse(fs.readFileSync(__dirname + "/fixtures/pl-mf.json", "utf-8"));
+ callback();
+ },
+
+ parse: function(test){
+ var parsed = po2json.parse(this.po, { format: 'mf' });
+ test.deepEqual(parsed, this.json);
+ test.done();
+ }
+}
+
+module.exports["parse with MessageFormatter format + fallback-to-msgid"] = {
+ setUp: function(callback){
+ this.po = fs.readFileSync(__dirname + "/fixtures/en-empty.po");
+ this.json = JSON.parse(fs.readFileSync(__dirname + "/fixtures/en-mf-fallback-to-msgid.json", "utf-8"));
+ callback();
+ },
+
+ parse: function(test){
+ var parsed = po2json.parse(this.po, { format: 'mf', 'fallback-to-msgid': true });
+ test.deepEqual(parsed, this.json);
+ test.done();
+ }
+}
+
+module.exports["parse with fallback-to-msgid"] = {
+ setUp: function(callback){
+ this.po = fs.readFileSync(__dirname + "/fixtures/en-empty.po");
+ this.json = JSON.parse(fs.readFileSync(__dirname + "/fixtures/en-empty.json", "utf-8"));
+ callback();
+ },
+
+ parse: function(test){
+ var parsed = po2json.parse(this.po, { 'fallback-to-msgid': true });
+ test.deepEqual(parsed, this.json);
+ test.done();
+ }
+}
+module.exports["parseFile"] = {
+ setUp: function(callback){
+ this.json = JSON.parse(fs.readFileSync(__dirname + "/fixtures/pl.json", "utf-8"));
+ callback();
+ },
+
+ parseFile: function(test){
+ var self = this;
+ po2json.parseFile(__dirname + "/fixtures/pl.po", null, function (err, parsed) {
+ test.deepEqual(parsed, self.json);
+ test.done();
+ });
+ }
+}
+
+module.exports["parseFileSync"] = {
+ setUp: function(callback){
+ this.json = JSON.parse(fs.readFileSync(__dirname + "/fixtures/pl.json", "utf-8"));
+ callback();
+ },
+
+ parseFileSync: function(test){
+ var parsed = po2json.parseFileSync(__dirname + "/fixtures/pl.po");
+ test.deepEqual(parsed, this.json);
+ test.done();
+ }
+}
+
+module.exports["parse with Plural-Forms == nplurals=1; plural=0;"] = {
+ setUp: function(callback){
+ this.po = fs.readFileSync(__dirname + "/fixtures/ja.po");
+ this.json = JSON.parse(fs.readFileSync(__dirname + "/fixtures/ja.json", "utf-8"));
+ callback();
+ },
+
+ parse: function(test){
+ var parsed = po2json.parse(this.po);
+ test.deepEqual(parsed, this.json);
+ test.done();
+ }
+}
+
+module.exports["parse with no headers"] ={
+ setUp: function(callback){
+ this.po = fs.readFileSync(__dirname + "/fixtures/en-no-header.po");
+ this.json = JSON.parse(fs.readFileSync(__dirname + "/fixtures/en-no-header.json", "utf-8"));
+ callback();
+ },
+
+ parse: function(test){
+ var parsed = po2json.parse(this.po);
+ test.deepEqual(parsed, this.json);
+ test.done();
+ }
+}