|
2743 | 2743 | "Have `driver` fill multiple inputs via `q-text`.
|
2744 | 2744 |
|
2745 | 2745 | `q-text` can be:
|
2746 |
| - - a map of `{q1 \"text1\" q2 \"text2\" ...}` |
2747 |
| - - a vector of `[q1 \"text1\" q2 \"text2\" ...]` |
| 2746 | + - a map of `{q1 \"text1\" q2 \"text2\" ...}`. There are no guarantees |
| 2747 | + about the order in which fields are filled. |
| 2748 | + - a vector of `[q1 \"text1\" q2 \"text2\" ...]`. The fields are filled |
| 2749 | + in the order the fields are listed in the vector. |
2748 | 2750 |
|
2749 | 2751 | See [[query]] for details on `q`s."
|
2750 | 2752 | [driver q-text]
|
|
2754 | 2756 | (fill driver q text))
|
2755 | 2757 |
|
2756 | 2758 | (vector? q-text)
|
2757 |
| - (recur driver (apply hash-map q-text)) |
| 2759 | + (if (even? (count q-text)) |
| 2760 | + (doseq [[q text] (partition 2 q-text)] |
| 2761 | + (fill driver q text)) |
| 2762 | + (throw+ {:type :etaoin/argument |
| 2763 | + :message "Vector q-text must have even length" |
| 2764 | + :arg q-text})) |
2758 | 2765 |
|
2759 | 2766 | :else (throw+ {:type :etaoin/argument
|
2760 | 2767 | :message "Wrong argument type"
|
|
2809 | 2816 | "Have `driver` fill multiple elements as if it were a real human being via `q-text` using `opts`.
|
2810 | 2817 |
|
2811 | 2818 | `q-text` can be:
|
2812 |
| - - a map of `{q1 \"text1\" q2 \"text2\" ...}` |
2813 |
| - - a vector of `[q1 \"text1\" q2 \"text2\" ...]` |
| 2819 | + - a map of `{q1 \"text1\" q2 \"text2\" ...}`. There are no guarantees |
| 2820 | + about the order in which fields are filled. |
| 2821 | + - a vector of `[q1 \"text1\" q2 \"text2\" ...]`. The fields are filled |
| 2822 | + in the order the fields are listed in the vector. |
2814 | 2823 |
|
2815 | 2824 | See [[query]] for details on `q`s.
|
2816 | 2825 |
|
|
2823 | 2832 | (fill-human driver q text opts))
|
2824 | 2833 |
|
2825 | 2834 | (vector? q-text)
|
2826 |
| - (recur driver (apply hash-map q-text) opts) |
| 2835 | + (if (even? (count q-text)) |
| 2836 | + (doseq [[q text] (partition 2 q-text)] |
| 2837 | + (fill driver q text)) |
| 2838 | + (throw+ {:type :etaoin/argument |
| 2839 | + :message "Vector q-text must have even length" |
| 2840 | + :arg q-text})) |
2827 | 2841 |
|
2828 | 2842 | :else (throw+ {:type :etaoin/argument
|
2829 | 2843 | :message "Wrong argument type"
|
|
0 commit comments