diff options
author | Philip Chimento <philip@endlessm.com> | 2015-06-04 09:20:31 -0700 |
---|---|---|
committer | Philip Chimento <philip@endlessm.com> | 2015-06-04 14:27:31 -0700 |
commit | f17a6ff5c41215701b822ccc4d46e89832fbd033 (patch) | |
tree | 32e80569771061e8948903002c694dafc3514ea1 /test/tools | |
parent | fbc49cb284067838416c6022d5c7dcb64899e030 (diff) |
Add eos-html-extractor and m4 file
This is taken almost directly from the existing version in eos-english.
Cleanups to follow in subsequent commits. Previously the m4 code was in
two separate macros, but since they were much the same, I combined them
into one macro.
This also adds a very minimal test for eos-html-extractor; basically as
a very quick regression test for the cleanups to follow.
[endlessm/eos-sdk#3245]
Diffstat (limited to 'test/tools')
-rw-r--r-- | test/tools/test.html | 20 | ||||
-rw-r--r-- | test/tools/testHtmlExtractor.js | 30 |
2 files changed, 50 insertions, 0 deletions
diff --git a/test/tools/test.html b/test/tools/test.html new file mode 100644 index 0000000..4dfda70 --- /dev/null +++ b/test/tools/test.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html dir="ltr" lang="en-US" class="no-js"> + <head> + <meta charset="utf-8"> + <title><span name="translatable">Finance Builder</span></title> + <meta name="description" content="Finance Builder"> + <meta name="author" content="Endless Mobile"> + </head> + <body> + <section id="choose" class="section"> + <!-- TRANSLATORS: This is a test of UTF-8 encoded characters --> + <div class="Intro"><span name="translatable">My Bü∂get</span></div> + <div class="subtitle"><span name="translatable">Choose a template</span></div> + <div id="mi-slider" class="mi-slider"> + <nav id="finance-nav"> + </nav> + </div> + </section> + </body> +</html> diff --git a/test/tools/testHtmlExtractor.js b/test/tools/testHtmlExtractor.js new file mode 100644 index 0000000..4f46706 --- /dev/null +++ b/test/tools/testHtmlExtractor.js @@ -0,0 +1,30 @@ +const Gio = imports.gi.Gio; +const GLib = imports.gi.GLib; + +const EXPECTED_OUTPUT = '#line 5 "test/tools/test.html"\n\ +_("Finance Builder");\n\ +#line 12 "test/tools/test.html"\n\ +// TRANSLATORS: This is a test of UTF-8 encoded characters\n\ +_("My Bü∂get");\n\ +#line 13 "test/tools/test.html"\n\ +_("Choose a template");\n'; + +describe('eos-html-extractor', function () { + it('works correctly at a minimum', function () { + let srcdir = GLib.getenv('TOP_SRCDIR'); + if (!srcdir) + srcdir = '.'; + let executable = GLib.build_filenamev([srcdir, + 'tools/eos-html-extractor']); + let operand = GLib.build_filenamev([srcdir, 'test/tools/test.html']); + let process = new Gio.Subprocess({ + argv: [executable, operand, srcdir], + flags: Gio.SubprocessFlags.STDOUT_PIPE | Gio.SubprocessFlags.STDERR_MERGE, + }); + process.init(null); + let [success, stdout] = process.communicate_utf8(null, null); + expect(process.get_if_exited()).toBeTruthy(); + expect(process.get_exit_status()).toBe(0); + expect(stdout).toEqual(EXPECTED_OUTPUT); + }); +}); |