summaryrefslogtreecommitdiff
path: root/src/couchdb/priv/couch_js/main.c
diff options
context:
space:
mode:
authorPaul Joseph Davis <davisp@apache.org>2009-11-26 19:32:08 +0000
committerPaul Joseph Davis <davisp@apache.org>2009-11-26 19:32:08 +0000
commit627b7d2d90c7cfcec2c8bb6e5b5e2b53ea60d217 (patch)
treec8b09655791ba3e5bc8a34344709ded81f8dc73e /src/couchdb/priv/couch_js/main.c
parent95ee619df135a4c8b3ecefe65503c6d1cc7c36da (diff)
Setup JavaScript command line runner.
All JS tests can now be run from the command line using the cURL adapter. In the future I would like to rework this and provide better TAP output. For now, each test is a single TAP assert. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@884675 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/priv/couch_js/main.c')
-rw-r--r--src/couchdb/priv/couch_js/main.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/couchdb/priv/couch_js/main.c b/src/couchdb/priv/couch_js/main.c
index ee0e42c9..f8578375 100644
--- a/src/couchdb/priv/couch_js/main.c
+++ b/src/couchdb/priv/couch_js/main.c
@@ -306,13 +306,21 @@ main(int argc, const char * argv[])
JS_SetGlobalObject(cx, global);
- if(argc != 2) {
+ if(argc > 2)
+ {
fprintf(stderr, "incorrect number of arguments\n\n");
fprintf(stderr, "usage: %s <scriptfile>\n", argv[0]);
return 2;
}
- execute_script(cx, global, argv[1]);
+ if(argc == 0)
+ {
+ execute_script(cx, global, NULL);
+ }
+ else
+ {
+ execute_script(cx, global, argv[1]);
+ }
FINISH_REQUEST(cx);