diff --git a/src/yetibot/core/commands/collections.clj b/src/yetibot/core/commands/collections.clj index 030d113c..2e89e5bd 100644 --- a/src/yetibot/core/commands/collections.clj +++ b/src/yetibot/core/commands/collections.clj @@ -670,8 +670,11 @@ ;; - others return an error like {:result/error} ;; - others just return a plain value ;; so look for all 3 forms - values (map (fn [{:result/keys [value error] :as arg}] - (or value error arg)) results) + values (map (fn [arg] + (if (map? arg) + (let [{:result/keys [value error]} arg] + (or value error arg)) + arg)) results) data (map :result/data results) ] (info (pr-str (doall results))) diff --git a/test/yetibot/core/test/commands/collections.clj b/test/yetibot/core/test/commands/collections.clj index 2eff4a55..0b00223e 100644 --- a/test/yetibot/core/test/commands/collections.clj +++ b/test/yetibot/core/test/commands/collections.clj @@ -382,4 +382,11 @@ (fact "using 'unquote' collections command, it should always return 'foo\" bar'; pretty sure this is a bug :)" - value => "foo\" bar"))) + value => "foo\" bar")) + + (let [{{:result/keys [value]} :result} + (ci/command-execution-info "repeat 2 range 5" + {:run-command? true})] + (fact + "using 'repeat' collections command on 'range 5' (an odd number of elements), it should succeed and not throw No value supplied" + value => [["0" "1" "2" "3" "4"] ["0" "1" "2" "3" "4"]])))