From f735d75d15279fafa037d64b0965a9311bd8df85 Mon Sep 17 00:00:00 2001 From: "Fuji, Goro" Date: Thu, 5 Sep 2013 22:37:37 +0900 Subject: [PATCH] add --executable raw to pass just [] which may be useful for vanilla JavaScript environments such as JSFL, MongoDB, spidermonkey, or rhino --- src/jsx-command.jsx | 5 ++--- t/006.jsx.t | 4 +++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/jsx-command.jsx b/src/jsx-command.jsx index 98971a05..d3a69130 100644 --- a/src/jsx-command.jsx +++ b/src/jsx-command.jsx @@ -46,7 +46,7 @@ class JSXCommand { "Options:\n" + " --add-search-path path adds a path to library search paths\n" + " --executable RUNENV adds launcher to call _Main.main(:string[]):void\n" + - " supported RUNENV is node, commonjs and web.\n" + + " RUNENV is raw, node, commonjs, and web.\n" + " --run runs _Main.main(:string[]):void after compiling\n" + " --test runs _Test#test*():void after compiling\n" + " --output file output file (default:stdout)\n" + @@ -263,10 +263,9 @@ class JSXCommand { return 1; } switch (optarg) { + case "raw": // implies JavaScriptEmitter case "web": // implies JavaScriptEmitter - break; case "commonjs": // implies JavaScriptEmitter - break; case "node": // implies JavaScriptEmitter break; default: diff --git a/t/006.jsx.t b/t/006.jsx.t index 5fdf6aa4..6a7b4430 100644 --- a/t/006.jsx.t +++ b/t/006.jsx.t @@ -2,7 +2,7 @@ use strict; use warnings; use tool::Util; -use Test::More tests => 106; +use Test::More tests => 112; note "testing jsx(1)"; @@ -65,6 +65,8 @@ foreach my $jsx(qw(bin/jsx bin/jsx-with-server)) { jsx_ok("--run t/006.jsx/dump-args.jsx 'foo bar'", qq{["foo bar"]\n}); jsx_ok("--run t/006.jsx/dump-args.jsx '/@~_+&=;'", qq{["/@~_+&=;"]\n}); + jsx_ok("--executable raw --run t/006.jsx/dump-args.jsx foo bar", qq{[]\n}); + # real command is scalar(`$jsx --run --input-filename t/006.jsx/hello.jsx -- - < t/006.jsx/hello.jsx`), "Hello, world!\n", "jsx --run -- - (input from stdin)";