Skip to content
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
7 changes: 5 additions & 2 deletions src/yetibot/core/commands/collections.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down
9 changes: 8 additions & 1 deletion test/yetibot/core/test/commands/collections.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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"]])))