|
42 | 42 | /// matchers.
|
43 | 43 | #[macro_export]
|
44 | 44 | macro_rules! unordered_elements_are {
|
45 |
| - ($($matcher:expr),*) => {{ |
| 45 | + ($($matcher:expr),* $(,)?) => {{ |
46 | 46 | #[cfg(google3)]
|
47 | 47 | use $crate::internal::{UnorderedElementsAre, Requirements};
|
48 | 48 | #[cfg(not(google3))]
|
@@ -85,7 +85,7 @@ macro_rules! unordered_elements_are {
|
85 | 85 | /// matchers did not have corresponding unique elements in the container.
|
86 | 86 | #[macro_export]
|
87 | 87 | macro_rules! contains_each {
|
88 |
| - ($($matcher:expr),*) => {{ |
| 88 | + ($($matcher:expr),* $(,)?) => {{ |
89 | 89 | #[cfg(google3)]
|
90 | 90 | use $crate::internal::{UnorderedElementsAre, Requirements};
|
91 | 91 | #[cfg(not(google3))]
|
@@ -130,7 +130,7 @@ macro_rules! contains_each {
|
130 | 130 | /// container elements did not have corresponding matchers.
|
131 | 131 | #[macro_export]
|
132 | 132 | macro_rules! is_contained_in {
|
133 |
| - ($($matcher:expr),*) => {{ |
| 133 | + ($($matcher:expr),* $(,)?) => {{ |
134 | 134 | #[cfg(google3)]
|
135 | 135 | use $crate::internal::{UnorderedElementsAre, Requirements};
|
136 | 136 | #[cfg(not(google3))]
|
@@ -734,6 +734,12 @@ mod tests {
|
734 | 734 | verify_that!(value, unordered_elements_are![eq(1), eq(2), eq(3)])
|
735 | 735 | }
|
736 | 736 |
|
| 737 | + #[google_test] |
| 738 | + fn unordered_elements_are_matches_vector_with_trailing_comma() -> Result<()> { |
| 739 | + let value = vec![1, 2, 3]; |
| 740 | + verify_that!(value, unordered_elements_are![eq(1), eq(2), eq(3),]) |
| 741 | + } |
| 742 | + |
737 | 743 | #[google_test]
|
738 | 744 | fn unordered_elements_are_matches_size() -> Result<()> {
|
739 | 745 | let value = vec![1, 2];
|
@@ -811,6 +817,11 @@ Actual: [1, 4, 3], whose element #1 does not match any expected elements and no
|
811 | 817 | verify_that!(vec![2, 3, 4], contains_each!(eq(2), eq(3), eq(4)))
|
812 | 818 | }
|
813 | 819 |
|
| 820 | + #[google_test] |
| 821 | + fn contains_each_supports_trailing_comma() -> Result<()> { |
| 822 | + verify_that!(vec![2, 3, 4], contains_each!(eq(2), eq(3), eq(4),)) |
| 823 | + } |
| 824 | + |
814 | 825 | #[google_test]
|
815 | 826 | fn contains_each_matches_when_no_matchers_present() -> Result<()> {
|
816 | 827 | verify_that!(vec![2, 3, 4], contains_each!())
|
@@ -867,6 +878,11 @@ Actual: [1, 4, 3], whose element #1 does not match any expected elements and no
|
867 | 878 | verify_that!(vec![2, 3, 4], is_contained_in!(eq(2), eq(3), eq(4)))
|
868 | 879 | }
|
869 | 880 |
|
| 881 | + #[google_test] |
| 882 | + fn is_contained_supports_trailing_comma() -> Result<()> { |
| 883 | + verify_that!(vec![2, 3, 4], is_contained_in!(eq(2), eq(3), eq(4),)) |
| 884 | + } |
| 885 | + |
870 | 886 | #[google_test]
|
871 | 887 | fn is_contained_in_matches_when_container_is_empty() -> Result<()> {
|
872 | 888 | verify_that!(vec![], is_contained_in!(eq(2), eq(3), eq(4)))
|
|
0 commit comments