Skip to content
This repository has been archived by the owner on Jun 4, 2022. It is now read-only.

Use cljs.core for cli arguments in cljs.js #237

Merged
merged 2 commits into from
Aug 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ script:
- yarn test
- boot test
- boot release-ci
- ./build/lumo -c test scripts/lumo_test.cljs
- ./build/lumo -c test scripts/lumo_test.cljs --test-cli-option true
after_success:
- chmod a+x build/lumo
- zip -j build/lumo.zip build/lumo
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ test_script:
- yarn test
- cmd: boot test
- cmd: boot release-ci
- cmd: build\lumo.exe --classpath test scripts\lumo_test.cljs
- cmd: build\lumo.exe --classpath test scripts\lumo_test.cljs --test-cli-option true

artifacts:
- path: build
Expand Down
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ test:
- yarn test
- boot test
- boot release-ci
- ./build/lumo -c test scripts/lumo_test.cljs
- ./build/lumo -c test scripts/lumo_test.cljs --test-cli-option true
post:
- chmod a+x build/lumo
- zip -j build/lumo.zip build/lumo
2 changes: 1 addition & 1 deletion src/js/cljs.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ function initClojureScriptEngine(opts: CLIOptsType): void {

if (args != null && args.length > 0) {
// $FlowIssue: context can have globals
ClojureScriptContext.lumo.core._STAR_command_line_args_STAR_ =
ClojureScriptContext.cljs.core._STAR_command_line_args_STAR_ =
// $FlowIssue: context can have globals
ClojureScriptContext.cljs.core.seq(args);
}
Expand Down
8 changes: 8 additions & 0 deletions test/lumo/repl_tests.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,11 @@ Special Form
(is (= () (lumo/apropos ffirst)))
(is (= '(cljs.core/ffirst cljs.core/nfirst) (lumo/apropos #"[a-z]+first")))
(is (= '(cljs.core/aget) (lumo/apropos "aget"))))

(when test-util/lumo-env?
(deftest test-cli-args
;; this requires to run:
;; ./build/lumo -c test scripts/lumo_test.cljs --test-cli-option true
(is (not-any? #(= (.-execPath js/process) %1) cljs.core/*command-line-args*) "It should not contain process.execPath")
(is (not-any? #(= "nexe.js" %1) cljs.core/*command-line-args*) "It should not contain the path to the JavaScript file being executed")
(is (= ["--test-cli-option" "true"] cljs.core/*command-line-args*) "It should contained the expected options (in order)")))