You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2015/09/17 00:17:02 UTC

[11/12] cordova-browser git commit: added create spec

added create spec


Project: http://git-wip-us.apache.org/repos/asf/cordova-browser/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-browser/commit/a7a409f1
Tree: http://git-wip-us.apache.org/repos/asf/cordova-browser/tree/a7a409f1
Diff: http://git-wip-us.apache.org/repos/asf/cordova-browser/diff/a7a409f1

Branch: refs/heads/master
Commit: a7a409f18c330032776ca2d1f489e923eef69e4c
Parents: a6c388a
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Wed Sep 16 14:56:31 2015 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Wed Sep 16 14:56:31 2015 -0700

----------------------------------------------------------------------
 tests/spec/create.spec.js | 99 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 99 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/a7a409f1/tests/spec/create.spec.js
----------------------------------------------------------------------
diff --git a/tests/spec/create.spec.js b/tests/spec/create.spec.js
new file mode 100644
index 0000000..66b84d2
--- /dev/null
+++ b/tests/spec/create.spec.js
@@ -0,0 +1,99 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+var shell = require('shelljs'),
+    spec = __dirname,
+    path = require('path'),
+    util = require('util');
+
+    var cordova_bin = path.join(spec, '../..', 'bin');
+    var tmp = require('tmp').dirSync().name;
+
+function createAndBuild(projectname, projectid) {
+    var return_code = 0;
+    var command;
+
+    // remove existing folder
+    command =  path.join(tmp, projectname);
+    shell.rm('-rf', command);
+
+    // create the project
+    command = util.format('"%s/create" "%s/%s" %s "%s"', cordova_bin, tmp, projectname, projectid, projectname);
+    shell.echo(command);
+    return_code = shell.exec(command).code;
+    expect(return_code).toBe(0);
+
+    // build the project
+    command = util.format('"%s/cordova/build"', path.join(tmp, projectname));
+    shell.echo(command);
+    return_code = shell.exec(command, { silent: true }).code;
+    expect(return_code).toBe(0);
+
+    // clean-up
+    command =  path.join(tmp, projectname);
+    shell.rm('-rf', command);
+}
+
+
+describe('create', function() {
+
+    it('create project with ascii name, no spaces', function() {
+        var projectname = 'testcreate';
+        var projectid = 'com.test.app1';
+
+        createAndBuild(projectname, projectid);
+    });
+
+    it('create project with ascii name, and spaces', function() {
+        var projectname = 'test create';
+        var projectid = 'com.test.app2';
+
+        createAndBuild(projectname, projectid);
+    });
+
+    it('create project with unicode name, no spaces', function() {
+        var projectname = '応応応応用用用用';
+        var projectid = 'com.test.app3';
+
+        createAndBuild(projectname, projectid);
+    });
+
+    it('create project with unicode name, and spaces', function() {
+        var projectname = '応応応応 用用用用';
+        var projectid = 'com.test.app4';
+
+        createAndBuild(projectname, projectid);
+    });
+
+    it('create project with ascii+unicode name, no spaces', function() {
+        var projectname = '応応応応hello用用用用';
+        var projectid = 'com.test.app5';
+
+        createAndBuild(projectname, projectid);
+    });
+
+    it('create project with ascii+unicode name, and spaces', function() {
+        var projectname = '応応応応 hello 用用用用';
+        var projectid = 'com.test.app6';
+
+        createAndBuild(projectname, projectid);
+    });
+
+});
+


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org