|
1 | | -/// To activate a doctest locally, remove ",ignore" from the code block. |
2 | | -/// |
3 | | -/// # Comma separator |
4 | | -/// |
| 1 | +// To activate a doctest locally, remove ",ignore" from the code block. |
| 2 | + |
5 | 3 | /// ```compile_fail,ignore |
6 | 4 | /// use macros::hashmap; |
7 | 5 | /// use std::collections::HashMap; |
8 | 6 | /// |
9 | 7 | /// // using only commas is invalid |
10 | 8 | /// let _hm: HashMap<_, _> = hashmap!('a', 1); |
11 | 9 | /// ``` |
12 | | -/// |
13 | | -/// # Double trailing commas |
14 | | -/// |
| 10 | +const _COMMA_SEPARATOR: () = (); |
| 11 | + |
15 | 12 | /// ```compile_fail,ignore |
16 | 13 | /// use macros::hashmap; |
17 | 14 | /// use std::collections::HashMap; |
18 | 15 | /// |
19 | 16 | /// // a single trailing comma is okay, but two is not |
20 | 17 | /// let _hm: HashMap<_, _> = hashmap!('a' => 2, ,); |
21 | 18 | /// ``` |
22 | | -/// |
23 | | -/// # Only comma |
24 | | -/// |
| 19 | +const _DOUBLE_TRAILING_COMMAS: () = (); |
| 20 | + |
25 | 21 | /// ```compile_fail,ignore |
26 | 22 | /// use macros::hashmap; |
27 | 23 | /// use std::collections::HashMap; |
28 | 24 | /// |
29 | 25 | /// // a single random comma is not valid |
30 | 26 | /// let _hm: HashMap<(), ()> = hashmap!(,); |
31 | 27 | /// ``` |
32 | | -/// |
33 | | -/// # Single argument |
34 | | -/// |
| 28 | +const _ONLY_COMMA: () = (); |
| 29 | + |
35 | 30 | /// ```compile_fail,ignore |
36 | 31 | /// use macros::hashmap; |
37 | 32 | /// use std::collections::HashMap; |
38 | 33 | /// |
39 | 34 | /// // a single argument is invalid |
40 | 35 | /// let _hm: HashMap<_, _> = hashmap!('a'); |
41 | 36 | /// ``` |
42 | | -/// |
43 | | -/// # Triple arguments |
44 | | -/// |
| 37 | +const _SINGLE_ARGUMENT: () = (); |
| 38 | + |
45 | 39 | /// ```compile_fail,ignore |
46 | 40 | /// use macros::hashmap; |
47 | 41 | /// use std::collections::HashMap; |
48 | 42 | /// |
49 | 43 | /// // three arguments are invalid |
50 | 44 | /// hashmap!('a' => 1, 'b'); |
51 | 45 | /// ``` |
52 | | -/// |
53 | | -/// # Only arrow |
54 | | -/// |
| 46 | +const _TRIPLE_ARGUMENTS: () = (); |
| 47 | + |
55 | 48 | /// ```compile_fail,ignore |
56 | 49 | /// use macros::hashmap; |
57 | 50 | /// use std::collections::HashMap; |
58 | 51 | /// |
59 | 52 | /// // a single random arrow is not valid |
60 | 53 | /// let _hm: HashMap<(), ()> = hashmap!(=>); |
61 | 54 | /// ``` |
62 | | -/// |
63 | | -/// # Trailing arrow |
64 | | -/// |
| 55 | +const _ONLY_ARROW: () = (); |
| 56 | + |
65 | 57 | /// ```compile_fail,ignore |
66 | 58 | /// use macros::hashmap; |
67 | 59 | /// use std::collections::HashMap; |
68 | 60 | /// |
69 | 61 | /// // a trailing => isn't valid either |
70 | 62 | /// hashmap!('a' => 2, =>); |
71 | 63 | /// ``` |
72 | | -/// |
73 | | -/// # Leading comma |
74 | | -/// |
| 64 | +const _TRAILING_ARROW: () = (); |
| 65 | + |
75 | 66 | /// ```compile_fail,ignore |
76 | 67 | /// use macros::hashmap; |
77 | 68 | /// use std::collections::HashMap; |
78 | 69 | /// |
79 | 70 | /// // leading commas are not valid |
80 | 71 | /// let _hm: HashMap<_, _> = hashmap!(, 'a' => 2); |
81 | 72 | /// ``` |
82 | | -/// |
83 | | -/// # Missing comma |
84 | | -/// |
| 73 | +const _LEADING_COMMA: () = (); |
| 74 | + |
85 | 75 | /// ```compile_fail,ignore |
86 | 76 | /// use macros::hashmap; |
87 | 77 | /// use std::collections::HashMap; |
88 | 78 | /// |
89 | 79 | /// // Key value pairs must be separated by commas |
90 | 80 | /// let _hm: HashMap<_, _> = hashmap!('a' => 1 'b' => 2); |
91 | 81 | /// ``` |
92 | | -/// |
93 | | -/// # Missing argument |
94 | | -/// |
| 82 | +const _MISSING_COMMA: () = (); |
| 83 | + |
95 | 84 | /// ```compile_fail,ignore |
96 | 85 | /// use macros::hashmap; |
97 | 86 | /// use std::collections::HashMap; |
98 | 87 | /// |
99 | 88 | /// // an argument should come between each pair of commas |
100 | 89 | /// let _hm: HashMap<_, _> = hashmap!('a' => 1, , 'b' => 2); |
101 | 90 | /// ``` |
102 | | -/// |
103 | | -const _TESTS: () = (); |
| 91 | +const _MISSING_ARGUMENT: () = (); |
0 commit comments