From e801913f71f03db3c3a9855a3ab512facb3836a8 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Thu, 16 Apr 2015 17:53:59 -0700 Subject: Remove eos-jasmine submodule [endlessm/eos-sdk#3054] --- .gitmodules | 3 --- test/Makefile.am.inc | 3 --- test/jasmine | 1 - 3 files changed, 7 deletions(-) delete mode 100644 .gitmodules delete mode 160000 test/jasmine diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index beb3d46..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "test/jasmine"] - path = test/jasmine - url = git@github.com:endlessm/eos-jasmine.git diff --git a/test/Makefile.am.inc b/test/Makefile.am.inc index 921700b..1146eb7 100644 --- a/test/Makefile.am.inc +++ b/test/Makefile.am.inc @@ -35,9 +35,6 @@ AM_JS_LOG_FLAGS = \ LOG_COMPILER = gtester AM_LOG_FLAGS = -k --verbose -JASMINE_SUBMODULE_PATH = $(top_srcdir)/test/jasmine -include test/jasmine/Makefile-jasmine.am.inc - # Use locally built versions of Endless-0.gir and libraries; this may need to be # changed to AM_TESTS_ENVIRONMENT in a future version of Automake # Set XDG_CONFIG_HOME so as to avoid cluttering the user's actual config diff --git a/test/jasmine b/test/jasmine deleted file mode 160000 index 4ffce45..0000000 --- a/test/jasmine +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4ffce45612f0c03d756dc37ae9a66050d3f891d0 -- cgit v1.2.3 From ea1e63bb221257f3792a419149349bba7a43a393 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Thu, 16 Apr 2015 18:14:49 -0700 Subject: Remove ancient test runner This test runner dates from even before eos-jasmine, and is not used anywhere. [endlessm/eos-sdk#3054] --- .gitignore | 1 - configure.ac | 1 - test/tools/eos-run-test/sanitycheck.js | 3 - tools/Makefile.am.inc | 1 - tools/eos-run-test.in | 147 --------------------------------- 5 files changed, 153 deletions(-) delete mode 100644 test/tools/eos-run-test/sanitycheck.js delete mode 100644 tools/eos-run-test.in diff --git a/.gitignore b/.gitignore index 3c8c7a1..bf152f8 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,6 @@ Endless-0.gir Endless-0.typelib endless/eosresource.c endless/eosresource-private.h -tools/eos-run-test tools/eos-application-manifest/eos-application-manifest tools/eos-json-extractor/eos-json-extractor diff --git a/configure.ac b/configure.ac index 2be3f63..df1519a 100644 --- a/configure.ac +++ b/configure.ac @@ -220,7 +220,6 @@ AC_CONFIG_FILES([ $EOS_SDK_API_NAME.pc tools/eos-json-extractor/eos-json-extractor ]) -AC_CONFIG_FILES([tools/eos-run-test], [chmod +x tools/eos-run-test]) AC_CONFIG_HEADERS([config.h]) dnl Header with system-dependent #defines # Make docs/reference/webhelper/eos.css available in the build tree as well as # the source tree diff --git a/test/tools/eos-run-test/sanitycheck.js b/test/tools/eos-run-test/sanitycheck.js deleted file mode 100644 index 4bb3a80..0000000 --- a/test/tools/eos-run-test/sanitycheck.js +++ /dev/null @@ -1,3 +0,0 @@ -function testNothing() { - assertEquals(2, 2); -} \ No newline at end of file diff --git a/tools/Makefile.am.inc b/tools/Makefile.am.inc index 47744b2..5c53d72 100644 --- a/tools/Makefile.am.inc +++ b/tools/Makefile.am.inc @@ -1,7 +1,6 @@ # Copyright 2013 Endless Mobile, Inc. bin_SCRIPTS = \ - tools/eos-run-test \ tools/eos-application-manifest/eos-application-manifest \ tools/eos-json-extractor/eos-json-extractor \ $(NULL) diff --git a/tools/eos-run-test.in b/tools/eos-run-test.in deleted file mode 100644 index d58bd5e..0000000 --- a/tools/eos-run-test.in +++ /dev/null @@ -1,147 +0,0 @@ -#!/usr/bin/env gjs -const Format = imports.format; -const Gio = imports.gi.Gio; -const GLib = imports.gi.GLib; -const JsUnit = imports.jsUnit; -const Lang = imports.lang; -const System = imports.system; - -String.prototype.format = Format.format; - -const PACKAGE_VERSION = '@PACKAGE_VERSION@'; -const JS_EXTENSION = '.js'; - -/** - * usage: - * - * Print command-line help message. - */ -function usage() { - print('Run a jsUnit unit test.\n'); - print('Usage: %s [options] TEST_FILES\n'.format( - System.programInvocationName)); - print('Options:'); - print(' --help This help message'); - print(' --version Print version and exit'); - System.exit(0); -} - -/** - * version: - * - * Print command-line version output. - */ -function version() { - print('%s %s - Run jsUnit tests in a GJS source file'.format( - System.programInvocationName, PACKAGE_VERSION)); - System.exit(0); -} - -if(ARGV.indexOf('--help') != -1) - usage(); -if(ARGV.indexOf('--version') != -1) - version(); -if(ARGV.length < 1) - usage(); - -// Import JsUnit into global namespace -if(!('assertEquals' in this)) - Lang.copyPublicProperties(JsUnit, this); - -function printError(error) { - const SYNTAX_ERROR = '[object Error]'; - print(" " + error.message); - - if(error.stackTrace) { - let stackTrace = error.stackTrace.split('\n'); - stackTrace.forEach(function(line) { - if(line.length > 0){ - let prefix = ' --'; - if (error.type == SYNTAX_ERROR) - prefix += '> '; - - print(prefix + line); - } - }); - } -} - -function executeTest(testModule, test) { - let result = { name: test }; - print("Running:", test); - if(testModule.setUp) { - testModule.setUp(); - } - let startTime = GLib.get_real_time(); - try { - testModule[test](); - } catch(e) { - print(" ERROR! >>>>>", test, "<<<<<"); - - result.error = { - type: Object.toString(e), - message: e.message || e.jsUnitMessage, - stackTrace: e.stack || e.stackTrace - }; - printError(result.error); - print('\n'); - } finally { - if(testModule.tearDown) { - testModule.tearDown(); - } - } - - result.time = GLib.get_real_time() - startTime; - return result; -} - -function executeTestsForFile(file) { - let testFile = file.get_basename(); - let testModuleName = testFile.slice(0, testFile.indexOf('.js')); - print('File:', testFile); - let oldSearchPath = imports.searchPath; - imports.searchPath.unshift(file.get_parent().get_path()); - let testModule = imports[testModuleName]; - imports.searchPath = oldSearchPath; - - let results = []; - Object.keys(testModule).forEach(function(key) { - if(key.indexOf('test') === 0) { - results.push(executeTest(testModule, key)); - } - }); - - return results; -} - -function getTotalsFromResults(results) { - let testsRunCount = 0; - let testsFailedCount = 0; - let testsPassedCount = 0; - - results.forEach(function(result) { - if ('error' in result) { - testsFailedCount++; - } - testsRunCount++; - }); - - testsPassedCount = testsRunCount - testsFailedCount; - return { - testsRunCount: testsRunCount, - testsFailedCount: testsFailedCount, - testsPassedCount: testsPassedCount - }; -} - -let fileToTest = Gio.File.new_for_path(ARGV[0]); -let results = executeTestsForFile(fileToTest); -let totals = getTotalsFromResults(results); -let totalsString = "Ran %d tests (%d Passed, %d Failed)".format( - totals.testsRunCount, totals.testsPassedCount, totals.testsFailedCount); -print(totalsString); - -if (totals.testsFailedCount > 0){ - printerr("Test(s) did not complete successfully"); - System.exit(1); -} -- cgit v1.2.3 From 57bd893ffbd81f0be919affb83f2aa46cd1cc04e Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Fri, 17 Apr 2015 11:42:03 -0700 Subject: Port eos-application-manifest tests to Jasmine This somehow escaped Sam's big switcheroo last year. [endlessm/eos-sdk#3054] --- test/tools/eos-application-manifest/testInit.js | 552 ++++++++++++------------ 1 file changed, 285 insertions(+), 267 deletions(-) diff --git a/test/tools/eos-application-manifest/testInit.js b/test/tools/eos-application-manifest/testInit.js index 70801ac..89c91d6 100644 --- a/test/tools/eos-application-manifest/testInit.js +++ b/test/tools/eos-application-manifest/testInit.js @@ -1,291 +1,309 @@ const Module = imports.tools['eos-application-manifest'].commands.init; -function testParseOneArgumentWithoutValue() { - let input = ['--parameter']; - let expected = { parameter: null }; - let actual = Module.parseRemainingArgs(input); - assertEquals(JSON.stringify(expected), JSON.stringify(actual)); -} +describe('eos-application-manifest init', function () { + describe('argument parser', function () { + it('parses one argument without a value', function () { + let input = ['--parameter']; + let expected = { + parameter: null, + }; + let actual = Module.parseRemainingArgs(input); + expect(JSON.stringify(actual)).toEqual(JSON.stringify(expected)); + }); -function testParseOneArgumentWithValue() { - let input = ['--parameter=value']; - let expected = { parameter: "value" }; - let actual = Module.parseRemainingArgs(input); - assertEquals(JSON.stringify(expected), JSON.stringify(actual)); -} + it('parses one argument with a value', function () { + let input = ['--parameter=value']; + let expected = { + parameter: 'value', + }; + let actual = Module.parseRemainingArgs(input); + expect(JSON.stringify(actual)).toEqual(JSON.stringify(expected)); + }); -function testParseOneArgumentFollowedByValue() { - let input = ['--parameter', 'value']; - let expected = { parameter: "value" }; - let actual = Module.parseRemainingArgs(input); - assertEquals(JSON.stringify(expected), JSON.stringify(actual)); -} + it('parses one argument followed by a value', function () { + let input = ['--parameter', 'value']; + let expected = { + parameter: 'value', + }; + let actual = Module.parseRemainingArgs(input); + expect(JSON.stringify(actual)).toEqual(JSON.stringify(expected)); + }); -function testParseTwoArgumentsWithoutValue() { - let input = ['--parameter-one', '--parameter-two']; - let expected = { 'parameter-one': null, 'parameter-two': null }; - let actual = Module.parseRemainingArgs(input); - assertEquals(JSON.stringify(expected), JSON.stringify(actual)); -} + it('parses two arguments without a value', function () { + let input = ['--parameter-one', '--parameter-two']; + let expected = { + 'parameter-one': null, + 'parameter-two': null, + }; + let actual = Module.parseRemainingArgs(input); + expect(JSON.stringify(actual)).toEqual(JSON.stringify(expected)); + }); -function testParseArgumentWithValueFollowedByArgument() { - let input = ['--parameter-one=value', '--parameter-two']; - let expected = { 'parameter-one': 'value', 'parameter-two': null }; - let actual = Module.parseRemainingArgs(input); - assertEquals(JSON.stringify(expected), JSON.stringify(actual)); -} + it('parses an argument with a value followed by an argument', function () { + let input = ['--parameter-one=value', '--parameter-two']; + let expected = { + 'parameter-one': 'value', + 'parameter-two': null, + }; + let actual = Module.parseRemainingArgs(input); + expect(JSON.stringify(actual)).toEqual(JSON.stringify(expected)); + }); -function testParseArgumentFollowedByValueFollowedByArgument() { - let input = ['--parameter-one', 'value', '--parameter-two']; - let expected = { 'parameter-one': 'value', 'parameter-two': null }; - let actual = Module.parseRemainingArgs(input); - assertEquals(JSON.stringify(expected), JSON.stringify(actual)); -} + it('parses an argument followed by a value followed by an argument', function () { + let input = ['--parameter-one', 'value', '--parameter-two']; + let expected = { + 'parameter-one': 'value', + 'parameter-two': null, + }; + let actual = Module.parseRemainingArgs(input); + expect(JSON.stringify(actual)).toEqual(JSON.stringify(expected)); + }); + }); -function testValidateMinimalCorrectArgumentsWithAppclass() { - let input = { - appname: 'Smoke Grinder', - author: 'Joe Coder ', - appversion: '1.0', - appclass: 'SmokeGrinder.App' - }; - assertTrue(Module.validateRemainingArgs(input)); -} + it('validates minimal correct arguments with appclass', function () { + let input = { + appname: 'Smoke Grinder', + author: 'Joe Coder ', + appversion: '1.0', + appclass: 'SmokeGrinder.App', + }; + expect(Module.validateRemainingArgs(input)).toBeTruthy(); + }); -function testValidateMinimalCorrectArgumentsWithExec() { - let input = { - appname: 'Smoke Grinder', - author: 'Joe Coder ', - appversion: '1.0', - exec: 'bin/smoke-grinder-launch' - }; - assertTrue(Module.validateRemainingArgs(input)); -} + it('validates minimal correct arguments with exec', function () { + let input = { + appname: 'Smoke Grinder', + author: 'Joe Coder ', + appversion: '1.0', + exec: 'bin/smoke-grinder-launch', + }; + expect(Module.validateRemainingArgs(input)).toBeTruthy(); + }); -function testValidateMaximalCorrectArguments() { - let input = { - appname: 'Smoke Grinder', - author: 'Joe Coder ', - appversion: '1.0', - appclass: 'SmokeGrinder.App', - 'manifest-version': '0', - website: 'http://coder.example.com', - description: 'An app that does exciting things', - locale: 'en', - license: 'GPL' - }; - assertTrue(Module.validateRemainingArgs(input)); -} + it('validates maximal correct arguments', function () { + let input = { + appname: 'Smoke Grinder', + author: 'Joe Coder ', + appversion: '1.0', + appclass: 'SmokeGrinder.App', + 'manifest-version': '0', + website: 'http://coder.example.com', + description: 'An app that does exciting things', + locale: 'en', + license: 'GPL', + }; + expect(Module.validateRemainingArgs(input)).toBeTruthy(); + }); -function testValidateBadArgumentsAppnameMissing() { - let input = { - author: 'Joe Coder ', - appversion: '1.0', - appclass: 'SmokeGrinder.App' - }; - assertFalse(Module.validateRemainingArgs(input)); -} + it('requires an appname', function () { + let input = { + author: 'Joe Coder ', + appversion: '1.0', + appclass: 'SmokeGrinder.App', + }; + expect(Module.validateRemainingArgs(input)).toBeFalsy(); + }); -function testValidateBadArgumentsAuthorMissing() { - let input = { - appname: 'Smoke Grinder', - appversion: '1.0', - appclass: 'SmokeGrinder.App' - }; - assertFalse(Module.validateRemainingArgs(input)); -} + it('requires an author', function () { + let input = { + appname: 'Smoke Grinder', + appversion: '1.0', + appclass: 'SmokeGrinder.App', + }; + expect(Module.validateRemainingArgs(input)).toBeFalsy(); + }); -function testValidateBadArgumentsAppversionMissing() { - let input = { - appname: 'Smoke Grinder', - author: 'Joe Coder ', - appclass: 'SmokeGrinder.App' - }; - assertFalse(Module.validateRemainingArgs(input)); -} + it('requires an app version', function () { + let input = { + appname: 'Smoke Grinder', + author: 'Joe Coder ', + appclass: 'SmokeGrinder.App', + }; + expect(Module.validateRemainingArgs(input)).toBeFalsy(); + }); -function testValidateBadArgumentsLauncherMissing() { - let input = { - appname: 'Smoke Grinder', - author: 'Joe Coder ', - appversion: '1.0', - }; - assertFalse(Module.validateRemainingArgs(input)); -} + it('requires a launcher item', function () { + let input = { + appname: 'Smoke Grinder', + author: 'Joe Coder ', + appversion: '1.0', + }; + expect(Module.validateRemainingArgs(input)).toBeFalsy(); + }); -function testValidateBadArgumentsTooManyLaunchers() { - let input = { - appname: 'Smoke Grinder', - author: 'Joe Coder ', - appversion: '1.0', - appclass: 'SmokeGrinder.App', - exec: 'bin/smoke-grinder-launch' - }; - assertFalse(Module.validateRemainingArgs(input)); -} + it('does not allow more than one launcher item', function () { + let input = { + appname: 'Smoke Grinder', + author: 'Joe Coder ', + appversion: '1.0', + appclass: 'SmokeGrinder.App', + exec: 'bin/smoke-grinder-launch', + }; + expect(Module.validateRemainingArgs(input)).toBeFalsy(); + }); -function testValidateBadUnknownArgument() { - let input = { - appname: 'Smoke Grinder', - author: 'Joe Coder ', - appversion: '1.0', - appclass: 'SmokeGrinder.App', - unrecognized_argument: 'a value' - }; - assertFalse(Module.validateRemainingArgs(input)); -} + it('chokes on unknown arguments', function () { + let input = { + appname: 'Smoke Grinder', + author: 'Joe Coder ', + appversion: '1.0', + appclass: 'SmokeGrinder.App', + unrecognized_argument: 'a value', + }; + expect(Module.validateRemainingArgs(input)).toBeFalsy(); + }); -function testValidateBadArgumentsWithoutValues() { - let input = { - appname: null, - author: null, - appversion: null, - appclass: null - }; - assertFalse(Module.validateRemainingArgs(input)); -} + it('knows when arguments should have values', function () { + let input = { + appname: null, + author: null, + appversion: null, + appclass: null, + }; + expect(Module.validateRemainingArgs(input)).toBeFalsy(); + }); -function testValidateBadManifestVersion() { - let input = { - appname: 'Smoke Grinder', - author: 'Joe Coder ', - appversion: '1.0', - appclass: 'SmokeGrinder.App', - 'manifest-version': 'FF' - }; - assertFalse(Module.validateRemainingArgs(input)); -} + it('rejects a bad manifest version', function () { + let input = { + appname: 'Smoke Grinder', + author: 'Joe Coder ', + appversion: '1.0', + appclass: 'SmokeGrinder.App', + 'manifest-version': 'FF', + }; + expect(Module.validateRemainingArgs(input)).toBeFalsy(); + }); -function testValidateTooHighManifestVersion() { - let input = { - appname: 'Smoke Grinder', - author: 'Joe Coder ', - appversion: '1.0', - appclass: 'SmokeGrinder.App', - 'manifest-version': 99999 - }; - assertFalse(Module.validateRemainingArgs(input)); -} + it('rejects a manifest version that is too high', function () { + let input = { + appname: 'Smoke Grinder', + author: 'Joe Coder ', + appversion: '1.0', + appclass: 'SmokeGrinder.App', + 'manifest-version': 99999, + }; + expect(Module.validateRemainingArgs(input)).toBeFalsy(); + }); -function testCreateFilenameForManifest() { - let input = { - applicationId: 'com.endlessm.smoke-grinder' - }; - let expected = 'com.endlessm.smoke-grinder.json'; - let actual = Module.createFilenameForManifest(input); -} + it('creates the correct filename for the manifest', function () { + let input = { + applicationId: 'com.endlessm.smoke-grinder', + }; + expect(Module.createFilenameForManifest(input)) + .toEqual('com.endlessm.smoke-grinder.json'); + }); -function testCreateManifestFromMinimalArgsWithAppclass() { - let inputApplicationId = 'com.coder.smoke-grinder'; - let inputArgDict = { - appname: 'Smoke Grinder', - author: 'Joe Coder ', - appversion: '1.0.1', - appclass: 'SmokeGrinder.App' - }; - let expected = { - manifestVersion: 1, - applicationId: "com.coder.smoke-grinder", - applicationName: { - en: "Smoke Grinder" - }, - authorName: "Joe Coder ", - authorWebsite: "", - description: { - en: "" - }, - version: "1.0.1", - changes: { - en: [], - }, - license: "", - resources: [], - applicationClass: "SmokeGrinder.App", - icons: {}, - categories: [], - permissions: [], - metadata: {} - }; - let actual = Module.createManifest(inputApplicationId, inputArgDict); - assertEquals(JSON.stringify(expected), JSON.stringify(actual)); -} + it('creates a whole manifest from minimal args, with appclass', function () { + let inputApplicationId = 'com.coder.smoke-grinder'; + let inputArgDict = { + appname: 'Smoke Grinder', + author: 'Joe Coder ', + appversion: '1.0.1', + appclass: 'SmokeGrinder.App', + }; + let expected = { + manifestVersion: 1, + applicationId: 'com.coder.smoke-grinder', + applicationName: { + en: 'Smoke Grinder', + }, + authorName: 'Joe Coder ', + authorWebsite: '', + description: { + en: '', + }, + version: '1.0.1', + changes: { + en: [], + }, + license: '', + resources: [], + applicationClass: 'SmokeGrinder.App', + icons: {}, + categories: [], + permissions: [], + metadata: {}, + }; + let actual = Module.createManifest(inputApplicationId, inputArgDict); + expect(JSON.stringify(actual)).toEqual(JSON.stringify(expected)); + }); -function testCreateManifestFromMinimalArgsWithExec() { - let inputApplicationId = 'com.coder.smoke-grinder'; - let inputArgDict = { - appname: 'Smoke Grinder', - author: 'Joe Coder ', - appversion: '1.0.1', - exec: 'bin/smoke-grinder-launch' - }; - let expected = { - manifestVersion: 1, - applicationId: "com.coder.smoke-grinder", - applicationName: { - en: "Smoke Grinder" - }, - authorName: "Joe Coder ", - authorWebsite: "", - description: { - en: "" - }, - version: "1.0.1", - changes: { - en: [], - }, - license: "", - resources: [], - exec: "bin/smoke-grinder-launch", - icons: {}, - categories: [], - permissions: [], - metadata: {} - }; - let actual = Module.createManifest(inputApplicationId, inputArgDict); - assertEquals(JSON.stringify(expected), JSON.stringify(actual)); -} + it('creates a whole manifest from minimal args, with exec', function () { + let inputApplicationId = 'com.coder.smoke-grinder'; + let inputArgDict = { + appname: 'Smoke Grinder', + author: 'Joe Coder ', + appversion: '1.0.1', + exec: 'bin/smoke-grinder-launch', + }; + let expected = { + manifestVersion: 1, + applicationId: 'com.coder.smoke-grinder', + applicationName: { + en: 'Smoke Grinder', + }, + authorName: 'Joe Coder ', + authorWebsite: '', + description: { + en: '', + }, + version: '1.0.1', + changes: { + en: [], + }, + license: '', + resources: [], + exec: 'bin/smoke-grinder-launch', + icons: {}, + categories: [], + permissions: [], + metadata: {}, + }; + let actual = Module.createManifest(inputApplicationId, inputArgDict); + expect(JSON.stringify(actual)).toEqual(JSON.stringify(expected)); + }); -function testCreateManifestFromMaximalArgs() { - let inputApplicationId = 'com.coder.smoke-grinder'; - let inputArgDict = { - appname: 'Smoke Grinder', - author: 'Joe Coder ', - appversion: '1.0.1', - appclass: 'SmokeGrinder.App', - 'manifest-version': '0', - website: 'http://coder.example.com', - description: 'An app that does exciting things', - locale: 'pt_BR', - license: 'GPL' - }; - let expected = { - manifestVersion: 0, - applicationId: "com.coder.smoke-grinder", - applicationName: { - pt_BR: "Smoke Grinder" - }, - authorName: "Joe Coder ", - authorWebsite: "http://coder.example.com", - description: { - pt_BR: "An app that does exciting things" - }, - version: "1.0.1", - changes: { - pt_BR: [], - }, - license: "GPL", - resources: [], - applicationClass: "SmokeGrinder.App", - icons: {}, - categories: [], - permissions: [], - metadata: {} - }; - let actual = Module.createManifest(inputApplicationId, inputArgDict); - assertEquals(JSON.stringify(expected), JSON.stringify(actual)); -} + it('creates a whole manifest from maximal args', function () { + let inputApplicationId = 'com.coder.smoke-grinder'; + let inputArgDict = { + appname: 'Smoke Grinder', + author: 'Joe Coder ', + appversion: '1.0.1', + appclass: 'SmokeGrinder.App', + 'manifest-version': '0', + website: 'http://coder.example.com', + description: 'An app that does exciting things', + locale: 'pt_BR', + license: 'GPL' + }; + let expected = { + manifestVersion: 0, + applicationId: 'com.coder.smoke-grinder', + applicationName: { + pt_BR: 'Smoke Grinder' + }, + authorName: 'Joe Coder ', + authorWebsite: 'http://coder.example.com', + description: { + pt_BR: 'An app that does exciting things' + }, + version: '1.0.1', + changes: { + pt_BR: [], + }, + license: 'GPL', + resources: [], + applicationClass: 'SmokeGrinder.App', + icons: {}, + categories: [], + permissions: [], + metadata: {} + }; + let actual = Module.createManifest(inputApplicationId, inputArgDict); + expect(JSON.stringify(actual)).toEqual(JSON.stringify(expected)); + }); -function testSummary() { - let summary = Module.summary(); - assertTrue(typeof summary == 'string'); -} + it('reports a subcommand summary for use in help', function () { + expect(typeof Module.summary()).toEqual('string'); + }); +}); -- cgit v1.2.3 From 9910f0c3752b5e5150299cbedf0277bbee08a82c Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Fri, 17 Apr 2015 12:43:34 -0700 Subject: Add Jasmine config file This sets the options so that you get a nice default output when you run "jasmine" in the repo's root directory. --- jasmine.json | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 jasmine.json diff --git a/jasmine.json b/jasmine.json new file mode 100644 index 0000000..aebe0bd --- /dev/null +++ b/jasmine.json @@ -0,0 +1,5 @@ +{ + "include_paths": ["webhelper", "."], + "options": "--verbose", + "spec_files": ["test/webhelper", "test/tools/eos-application-manifest"] +} -- cgit v1.2.3 From 3c46d4730428b7f503d3d9df9c1d465ab22848fa Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Fri, 17 Apr 2015 12:42:37 -0700 Subject: Integrate Jasmine with Automake This runs the tests during "make check" using jasmine-gjs, and outputs results in the TAP format that Automake understands. [endlessm/eos-sdk#3054] --- .gitignore | 1 + configure.ac | 2 ++ test/Makefile.am.inc | 7 ++++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index bf152f8..525f885 100644 --- a/.gitignore +++ b/.gitignore @@ -44,6 +44,7 @@ stamp* /m4/ltsugar.m4 /m4/ltversion.m4 /m4/serial-tests.m4 +/tap-driver.sh /test-driver .dirstamp diff --git a/configure.ac b/configure.ac index df1519a..4f6fe4e 100644 --- a/configure.ac +++ b/configure.ac @@ -114,6 +114,8 @@ GTK_DOC_CHECK([1.18], [--flavour no-tmpl]) # GObject Introspection GOBJECT_INTROSPECTION_REQUIRE([1.30]) # Various tools +AC_PROG_AWK # needed for TAP driver +AC_REQUIRE_AUX_FILE([tap-driver.sh]) AC_PATH_PROG([GIRDOCTOOL], [g-ir-doc-tool], [notfound]) AC_ARG_VAR([GIRDOCTOOL], [Path to g-ir-doc-tool]) AC_PATH_PROG([YELPBUILD], [yelp-build], [notfound]) diff --git a/test/Makefile.am.inc b/test/Makefile.am.inc index 1146eb7..7244a85 100644 --- a/test/Makefile.am.inc +++ b/test/Makefile.am.inc @@ -27,10 +27,15 @@ TESTS = \ test/endless/run-tests \ $(javascript_tests) \ $(NULL) -TEST_EXTENSIONS = +JS_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/tap-driver.sh +JS_LOG_DRIVER_FLAGS = --comments +TEST_EXTENSIONS = .js +JS_LOG_COMPILER = jasmine AM_JS_LOG_FLAGS = \ --include-path=$(top_srcdir)/webhelper \ --include-path=$(top_srcdir) \ + --tap \ + --no-config \ $(NULL) LOG_COMPILER = gtester AM_LOG_FLAGS = -k --verbose -- cgit v1.2.3 From 3fc99841e7b72cd664939fce5a67359da1eab82b Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Fri, 17 Apr 2015 12:48:28 -0700 Subject: Remove defunct flexy-grid demo EosFlexyGrid is deprecated, so we don't want a demo of it in our tests. [endlessm/eos-sdk#3054] --- test/Makefile.am.inc | 3 +- test/demos/Makefile.am.inc | 5 --- test/demos/flexy-grid.c | 107 --------------------------------------------- 3 files changed, 1 insertion(+), 114 deletions(-) delete mode 100644 test/demos/Makefile.am.inc delete mode 100644 test/demos/flexy-grid.c diff --git a/test/Makefile.am.inc b/test/Makefile.am.inc index 7244a85..5b3128a 100644 --- a/test/Makefile.am.inc +++ b/test/Makefile.am.inc @@ -7,7 +7,7 @@ ENDLESS_TESTS_DIRECTORY = $(top_srcdir)/test noinst_PROGRAMS = \ test/endless/run-tests \ test/smoke-tests/hello \ - test/demos/flexy-grid + $(NULL) # This variable will be updated in Makefile subdirs (test/endless/Makefile.am.inc) javascript_tests = \ @@ -19,7 +19,6 @@ javascript_tests = \ EXTRA_DIST += $(javascript_tests) include test/endless/Makefile.am.inc -include test/demos/Makefile.am.inc include test/smoke-tests/Makefile.am.inc # Run tests when running 'make check' diff --git a/test/demos/Makefile.am.inc b/test/demos/Makefile.am.inc deleted file mode 100644 index 797cfd3..0000000 --- a/test/demos/Makefile.am.inc +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright 2013 Endless Mobile, Inc. - -test_demos_flexy_grid_SOURCES = $(ENDLESS_TESTS_DIRECTORY)/demos/flexy-grid.c -test_demos_flexy_grid_CPPFLAGS = $(TEST_FLAGS) -test_demos_flexy_grid_LDADD = $(TEST_LIBS) diff --git a/test/demos/flexy-grid.c b/test/demos/flexy-grid.c deleted file mode 100644 index 2008af4..0000000 --- a/test/demos/flexy-grid.c +++ /dev/null @@ -1,107 +0,0 @@ -#include - -static const char *icons[] = { - "applications-accessories", - "applications-development", - "applications-engineering", - "applications-games", - "applications-graphics", - "applications-internet", - "applications-multimedia", - "applications-office", - "applications-other", - "applications-science", - "applications-system", - "applications-utilities", -}; - -#define CHAR(r,g,b) { r / 255.0, g / 255.0, b / 255.0, 1.0 } - -static GdkRGBA colors[] = { - CHAR (0xff, 0x00, 0x00), - CHAR (0x80, 0x00, 0x00), - CHAR (0x00, 0xff, 0x00), - CHAR (0x00, 0x80, 0x00), - CHAR (0x00, 0x00, 0xff), - CHAR (0x00, 0x00, 0x80), - CHAR (0x00, 0xff, 0xff), - CHAR (0x00, 0x80, 0x80), - CHAR (0xff, 0x00, 0xff), - CHAR (0x80, 0x00, 0x80), - CHAR (0xff, 0xff, 0x00), - CHAR (0x80, 0x80, 0x00), - CHAR (0xa0, 0xa0, 0xa4), - CHAR (0x80, 0x80, 0x80), - CHAR (0xc0, 0xc0, 0xc0), -}; - -static EosFlexyShape shapes[] = { - EOS_FLEXY_SHAPE_MEDIUM_HORIZONTAL, - EOS_FLEXY_SHAPE_MEDIUM_VERTICAL, - EOS_FLEXY_SHAPE_SMALL, - EOS_FLEXY_SHAPE_SMALL, - EOS_FLEXY_SHAPE_SMALL, - EOS_FLEXY_SHAPE_MEDIUM_VERTICAL, - EOS_FLEXY_SHAPE_MEDIUM_HORIZONTAL, - EOS_FLEXY_SHAPE_SMALL, -}; - -static void -on_cell_selected (EosFlexyGrid *grid, EosFlexyGridCell *cell) -{ - g_print ("Cell %p selected\n", cell); -} - -static void -on_cell_activated (EosFlexyGrid *grid, EosFlexyGridCell *cell) -{ - g_print ("Cell %p activated\n", cell); -} - -int -main (int argc, char *argv[]) -{ - gtk_init (NULL, NULL); - - GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_window_set_default_size (GTK_WINDOW (window), 800, 600); - g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL); - gtk_widget_show (window); - - GtkWidget *scroll = gtk_scrolled_window_new (NULL, NULL); - gtk_container_add (GTK_CONTAINER (window), scroll); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll), - GTK_POLICY_NEVER, - GTK_POLICY_AUTOMATIC); - gtk_widget_show (scroll); - - GtkWidget *grid = eos_flexy_grid_new (); - g_signal_connect (grid, "cell-selected", G_CALLBACK (on_cell_selected), NULL); - g_signal_connect (grid, "cell-activated", G_CALLBACK (on_cell_activated), NULL); - gtk_container_add (GTK_CONTAINER (scroll), grid); - gtk_widget_show (grid); - - for (guint i = 0; i < 8; i++) - { - GtkWidget *cell = eos_flexy_grid_cell_new (); - eos_flexy_grid_cell_set_shape (EOS_FLEXY_GRID_CELL (cell), shapes[i]); - gtk_container_add (GTK_CONTAINER (grid), cell); - gtk_widget_show (cell); - - GtkWidget *frame = gtk_event_box_new (); - gtk_widget_override_background_color (frame, GTK_STATE_FLAG_NORMAL, &colors[i]); - gtk_container_add (GTK_CONTAINER (cell), frame); - gtk_widget_show (frame); - - GtkWidget *image = gtk_image_new (); - gtk_image_set_from_icon_name (GTK_IMAGE (image), icons[i], GTK_ICON_SIZE_DIALOG); - gtk_container_add (GTK_CONTAINER (frame), image); - gtk_widget_set_hexpand (image, TRUE); - gtk_widget_set_vexpand (image, TRUE); - gtk_widget_show (image); - } - - gtk_main (); - - return 0; -} -- cgit v1.2.3 From e9e71b98bbb4d1b31322488a6ef051e022635ad4 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Fri, 17 Apr 2015 13:08:00 -0700 Subject: Switch to subdir-objects This requires removing the $(ENDLESS_TESTS_DIRECTORY) variable, which wasn't really necessary anyway. Subdir-objects would like you to specify your directories directly in the rule target names. [endlessm/eos-sdk#3054] --- configure.ac | 4 +++- test/Makefile.am.inc | 1 - test/endless/Makefile.am.inc | 18 +++++++++--------- test/smoke-tests/Makefile.am.inc | 2 +- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/configure.ac b/configure.ac index 4f6fe4e..c71973e 100644 --- a/configure.ac +++ b/configure.ac @@ -40,7 +40,9 @@ dnl AC_CONFIG_SRCDIR([src/hello.c]) # Unlike serial-tests, this option is accepted by Automake 1.11 # tar-ustar is required because there may be files whose entire paths exceed # 99 characters. -AM_INIT_AUTOMAKE([-Wall -Wno-portability foreign 1.11 parallel-tests tar-ustar]) +# subdir-objects is for forward compatibility with Automake 2.0 and can be +# removed when we upgrade to that version. +AM_INIT_AUTOMAKE([-Wall -Wno-portability foreign 1.11 parallel-tests tar-ustar subdir-objects]) # Avoid spewing garbage over the terminal ('make V=1' to see the garbage) AM_SILENT_RULES([yes]) # Initialize Libtool; don't build static libraries diff --git a/test/Makefile.am.inc b/test/Makefile.am.inc index 5b3128a..c18defd 100644 --- a/test/Makefile.am.inc +++ b/test/Makefile.am.inc @@ -2,7 +2,6 @@ TEST_FLAGS = @EOS_SDK_CFLAGS@ -I$(top_srcdir) -DCOMPILING_EOS_SDK TEST_LIBS = @EOS_SDK_LIBS@ $(top_builddir)/libendless-@EOS_SDK_API_VERSION@.la -ENDLESS_TESTS_DIRECTORY = $(top_srcdir)/test noinst_PROGRAMS = \ test/endless/run-tests \ diff --git a/test/endless/Makefile.am.inc b/test/endless/Makefile.am.inc index 5e83d2f..628ad0f 100644 --- a/test/endless/Makefile.am.inc +++ b/test/endless/Makefile.am.inc @@ -1,15 +1,15 @@ # Copyright 2013 Endless Mobile, Inc. test_endless_run_tests_SOURCES = \ - $(ENDLESS_TESTS_DIRECTORY)/endless/run-tests.c \ - $(ENDLESS_TESTS_DIRECTORY)/endless/run-tests.h \ - $(ENDLESS_TESTS_DIRECTORY)/endless/test-init.c \ - $(ENDLESS_TESTS_DIRECTORY)/endless/test-hello.c \ - $(ENDLESS_TESTS_DIRECTORY)/endless/test-application.c \ - $(ENDLESS_TESTS_DIRECTORY)/endless/test-page-manager.c \ - $(ENDLESS_TESTS_DIRECTORY)/endless/test-window.c \ - $(ENDLESS_TESTS_DIRECTORY)/endless/test-flexy-grid.c \ - $(ENDLESS_TESTS_DIRECTORY)/endless/test-custom-container.c \ + test/endless/run-tests.c \ + test/endless/run-tests.h \ + test/endless/test-init.c \ + test/endless/test-hello.c \ + test/endless/test-application.c \ + test/endless/test-page-manager.c \ + test/endless/test-window.c \ + test/endless/test-flexy-grid.c \ + test/endless/test-custom-container.c \ $(NULL) test_endless_run_tests_CPPFLAGS = $(TEST_FLAGS) test_endless_run_tests_LDADD = $(TEST_LIBS) diff --git a/test/smoke-tests/Makefile.am.inc b/test/smoke-tests/Makefile.am.inc index 170b335..5ee5ac2 100644 --- a/test/smoke-tests/Makefile.am.inc +++ b/test/smoke-tests/Makefile.am.inc @@ -1,6 +1,6 @@ # Copyright 2013 Endless Mobile, Inc. -test_smoke_tests_hello_SOURCES = $(ENDLESS_TESTS_DIRECTORY)/smoke-tests/hello.c +test_smoke_tests_hello_SOURCES = test/smoke-tests/hello.c test_smoke_tests_hello_CPPFLAGS = $(TEST_FLAGS) test_smoke_tests_hello_LDADD = $(TEST_LIBS) -- cgit v1.2.3 From 912da5ca8c4e5689a10fad256b1bf634516c3180 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Fri, 17 Apr 2015 13:20:53 -0700 Subject: Lose one level of Makefile includery Having these tiny included Makefiles is confusing and vulnerable to mistakenly overwriting variables. [endlessm/eos-sdk#3054] --- test/Makefile.am.inc | 39 +++++++++++++++++++++++++++++++++++---- test/endless/Makefile.am.inc | 20 -------------------- test/smoke-tests/Makefile.am.inc | 20 -------------------- 3 files changed, 35 insertions(+), 44 deletions(-) delete mode 100644 test/endless/Makefile.am.inc delete mode 100644 test/smoke-tests/Makefile.am.inc diff --git a/test/Makefile.am.inc b/test/Makefile.am.inc index c18defd..d070b95 100644 --- a/test/Makefile.am.inc +++ b/test/Makefile.am.inc @@ -8,18 +8,49 @@ noinst_PROGRAMS = \ test/smoke-tests/hello \ $(NULL) -# This variable will be updated in Makefile subdirs (test/endless/Makefile.am.inc) +test_endless_run_tests_SOURCES = \ + test/endless/run-tests.c \ + test/endless/run-tests.h \ + test/endless/test-init.c \ + test/endless/test-hello.c \ + test/endless/test-application.c \ + test/endless/test-page-manager.c \ + test/endless/test-window.c \ + test/endless/test-flexy-grid.c \ + test/endless/test-custom-container.c \ + $(NULL) +test_endless_run_tests_CPPFLAGS = $(TEST_FLAGS) +test_endless_run_tests_LDADD = $(TEST_LIBS) + +test_smoke_tests_hello_SOURCES = test/smoke-tests/hello.c +test_smoke_tests_hello_CPPFLAGS = $(TEST_FLAGS) +test_smoke_tests_hello_LDADD = $(TEST_LIBS) + +credits_resource_files = \ + test/smoke-tests/images/test1.jpg \ + test/smoke-tests/images/test2.jpg \ + test/smoke-tests/images/test3.jpg \ + test/smoke-tests/images/attribution.json \ + $(NULL) +test/smoke-tests/images/credits.gresource: test/smoke-tests/images/credits.gresource.xml $(credits_resource_files) + $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir)/test/smoke-tests/images $< +dist_noinst_DATA = test/smoke-tests/images/credits.gresource +CLEANFILES += test/smoke-tests/images/credits.gresource +EXTRA_DIST += \ + test/smoke-tests/images/credits.gresource.xml \ + $(credits_resource_files) \ + $(NULL) + javascript_tests = \ test/tools/eos-application-manifest/testInit.js \ test/webhelper/testTranslate.js \ test/webhelper/testWebActions.js \ test/webhelper/testUpdateFontSize.js \ + test/endless/testCustomContainer.js \ + test/endless/testTopbarNavButton.js \ $(NULL) EXTRA_DIST += $(javascript_tests) -include test/endless/Makefile.am.inc -include test/smoke-tests/Makefile.am.inc - # Run tests when running 'make check' TESTS = \ test/endless/run-tests \ diff --git a/test/endless/Makefile.am.inc b/test/endless/Makefile.am.inc deleted file mode 100644 index 628ad0f..0000000 --- a/test/endless/Makefile.am.inc +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2013 Endless Mobile, Inc. - -test_endless_run_tests_SOURCES = \ - test/endless/run-tests.c \ - test/endless/run-tests.h \ - test/endless/test-init.c \ - test/endless/test-hello.c \ - test/endless/test-application.c \ - test/endless/test-page-manager.c \ - test/endless/test-window.c \ - test/endless/test-flexy-grid.c \ - test/endless/test-custom-container.c \ - $(NULL) -test_endless_run_tests_CPPFLAGS = $(TEST_FLAGS) -test_endless_run_tests_LDADD = $(TEST_LIBS) - -javascript_tests += \ - test/endless/testCustomContainer.js \ - test/endless/testTopbarNavButton.js \ - $(NULL) diff --git a/test/smoke-tests/Makefile.am.inc b/test/smoke-tests/Makefile.am.inc deleted file mode 100644 index 5ee5ac2..0000000 --- a/test/smoke-tests/Makefile.am.inc +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2013 Endless Mobile, Inc. - -test_smoke_tests_hello_SOURCES = test/smoke-tests/hello.c -test_smoke_tests_hello_CPPFLAGS = $(TEST_FLAGS) -test_smoke_tests_hello_LDADD = $(TEST_LIBS) - -credits_resource_files = \ - test/smoke-tests/images/test1.jpg \ - test/smoke-tests/images/test2.jpg \ - test/smoke-tests/images/test3.jpg \ - test/smoke-tests/images/attribution.json \ - $(NULL) -test/smoke-tests/images/credits.gresource: test/smoke-tests/images/credits.gresource.xml $(credits_resource_files) - $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir)/test/smoke-tests/images $< -dist_noinst_DATA = test/smoke-tests/images/credits.gresource -CLEANFILES += test/smoke-tests/images/credits.gresource -EXTRA_DIST += \ - test/smoke-tests/images/credits.gresource.xml \ - $(credits_resource_files) \ - $(NULL) -- cgit v1.2.3 From a7ec9a08a19c80ed48aacabff8fa330d70800574 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Fri, 17 Apr 2015 13:23:51 -0700 Subject: Don't define dist_noinst_DATA in included Makefile This is vulnerable to being overwritten. Instead, define it in the top level Makefile and append to it in the included Makefile. [endlessm/eos-sdk#3054] --- Makefile.am | 2 ++ test/Makefile.am.inc | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 51f1d7c..9e3aa02 100644 --- a/Makefile.am +++ b/Makefile.am @@ -16,6 +16,8 @@ ACLOCAL_AMFLAGS = -I m4 # Extra files to distribute in the tarball EXTRA_DIST = README.md @EOS_SDK_API_NAME@.pc.in +# As above, but files in dist_noinst_DATA also need to be built by make +dist_noinst_DATA = # Compiler flags DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ diff --git a/test/Makefile.am.inc b/test/Makefile.am.inc index d070b95..dc90227 100644 --- a/test/Makefile.am.inc +++ b/test/Makefile.am.inc @@ -34,7 +34,7 @@ credits_resource_files = \ $(NULL) test/smoke-tests/images/credits.gresource: test/smoke-tests/images/credits.gresource.xml $(credits_resource_files) $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir)/test/smoke-tests/images $< -dist_noinst_DATA = test/smoke-tests/images/credits.gresource +dist_noinst_DATA += test/smoke-tests/images/credits.gresource CLEANFILES += test/smoke-tests/images/credits.gresource EXTRA_DIST += \ test/smoke-tests/images/credits.gresource.xml \ -- cgit v1.2.3 From d37251d6e005f3b965d9c08b1476c98731b0ffee Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Fri, 17 Apr 2015 13:24:39 -0700 Subject: Address warning about rule being overwritten There are two dist-hook rules, so a double-colon rule is appropriate. That means both will get executed when required, instead of only one. [endlessm/eos-sdk#3054] --- Makefile.am | 4 ++-- docs/reference/webhelper/Makefile.am.inc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index 9e3aa02..467f047 100644 --- a/Makefile.am +++ b/Makefile.am @@ -33,9 +33,9 @@ DISTCLEANFILES = # Make sure that 'make dist' includes documentation if CAN_MAKE_DIST -dist-hook: +dist-hook:: else -dist-hook: +dist-hook:: @echo "***" @echo "*** You must configure with --enable-gtk-doc, --enable-gir-doc, and" @echo "*** --enable-js-doc to run make dist or make distcheck." diff --git a/docs/reference/webhelper/Makefile.am.inc b/docs/reference/webhelper/Makefile.am.inc index 3b47e19..55caccf 100644 --- a/docs/reference/webhelper/Makefile.am.inc +++ b/docs/reference/webhelper/Makefile.am.inc @@ -24,7 +24,7 @@ DISTCLEANFILES += \ distclean-local: @rm -rf docs/reference/webhelper/html -dist-hook: +dist-hook:: @mkdir -p $(distdir)/docs/reference/webhelper/html @cp -r docs/reference/webhelper/html/* $(distdir)/docs/reference/webhelper/html -- cgit v1.2.3