Skip to content

Commit

Permalink
[Fix #544] Correctly parse arguments with multiple separators
Browse files Browse the repository at this point in the history
There was a problem when parsing things like SYM:VER=PATH, which split
arguments by using different separators.
  • Loading branch information
arichiardi committed Jan 9, 2018
1 parent 260fe1d commit 34fc20c
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 16 deletions.
29 changes: 20 additions & 9 deletions boot/core/build.boot
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
(set-env!
:source-paths #{"test"}
:dependencies '[[org.clojure/tools.reader "1.0.0-alpha2"]])
:dependencies '[[org.clojure/tools.reader "1.0.0-alpha2"]
[metosin/boot-alt-test "0.3.2" :scope "test"]])

(ns-unmap 'boot.user 'test)

(require '[boot.test :refer [runtests test-report test-exit]]
'boot.task.built-in-test
'boot.test-test)
'[metosin.boot-alt-test :refer [alt-test]])

(import boot.App)

(ns-unmap 'boot.user 'test)

(deftask test []
(boot.util/info "Testing against version %s\n" (App/config "BOOT_VERSION"))
(comp (runtests)
(deftask integration-test []
(set-env! :source-paths #{"integration-test"})
(comp (with-pass-thru [fs]
(require 'boot.task.built-in-test
'boot.test-test)
(boot.util/info "Testing against version %s\n" (App/config "BOOT_VERSION")))
(runtests)
(test-report)
(test-exit)))

(deftask unit-test []
(set-env! :source-paths #{"src" "unit-test"})
(alt-test))

(deftask test []
(comp (unit-test)
(integration-test)))
File renamed without changes.
File renamed without changes.
7 changes: 0 additions & 7 deletions boot/core/test/boot/core_test.clj

This file was deleted.

17 changes: 17 additions & 0 deletions boot/core/unit-test/boot/cli_test.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
(ns boot.cli-test
(:require [boot.cli :as cli]
[boot.from.clojure.tools.cli :as tools-cli]
[clojure.test :as t]))

(t/deftest cli-tests

(t/testing "parse-cli"
(let [argv ["-a" "test:test1=4"]
cli-args (->> '[[a parent SYM:VER=PATH [sym str str]]]
(mapv (partial apply #'cli/argspec->cli-argspec)))
separate-cli-opts (#'cli/separate-cli-opts (:cli (#'cli/split-args argv)) cli-args)]
(t/is (= "" (#'tools-cli/parse-opts separate-cli-opts cli-args)) "[fix #578] split arguments with two different separators.")
)
)

)

0 comments on commit 34fc20c

Please sign in to comment.