mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Test arguments with spaces and quotes in nsIProcess. r=robstrong
This commit is contained in:
parent
5c69014ee8
commit
99b44d9574
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user