Test arguments with spaces and quotes in nsIProcess. r=robstrong

This commit is contained in:
Dave Townsend 2009-06-23 11:33:41 +01:00
Родитель 5c69014ee8
Коммит 99b44d9574
2 изменённых файлов: 9 добавлений и 5 удалений

Просмотреть файл

@ -1,7 +1,7 @@
#include <string.h>
int main(int argc, char* argv[]) {
if (argc != 7)
if (argc != 9)
return -1;
if (strcmp("mozilla", argv[1]) != 0)
@ -16,6 +16,10 @@ int main(int argc, char* argv[]) {
return 5;
if (strcmp("bar", argv[6]) != 0)
return 6;
if (strcmp("argument with spaces", argv[7]) != 0)
return 7;
if (strcmp("\"argument with quotes\"", argv[8]) != 0)
return 8;
return 0;
}

Просмотреть файл

@ -34,6 +34,8 @@
*
* ***** END LICENSE BLOCK ***** */
// nsIProcess unit test
const TEST_ARGS = ["mozilla", "firefox", "thunderbird", "seamonkey", "foo",
"bar", "argument with spaces", "\"argument with quotes\""];
var isWindows = ("@mozilla.org/windows-registry-key;1" in Components.classes);
@ -120,9 +122,7 @@ function test_arguments()
.createInstance(Components.interfaces.nsIProcess);
process.init(file);
var args= ["mozilla", "firefox", "thunderbird", "seamonkey", "foo", "bar"];
process.run(true, args, args.length);
process.run(true, TEST_ARGS, TEST_ARGS.length);
do_check_eq(process.exitValue, 0);
}
@ -155,7 +155,7 @@ function test_notify_nonblocking()
.createInstance(Components.interfaces.nsIProcess);
process.init(file);
process.runAsync(["mozilla", "firefox", "thunderbird", "seamonkey", "foo", "bar"], 6, {
process.runAsync(TEST_ARGS, TEST_ARGS.length, {
observe: function(subject, topic, data) {
process = subject.QueryInterface(Components.interfaces.nsIProcess);
do_check_eq(topic, "process-finished");