@@ -570,6 +570,7 @@ pub struct Execs {
570
570
expect_stdout_contains_n : Vec < ( String , usize ) > ,
571
571
expect_stdout_not_contains : Vec < String > ,
572
572
expect_stderr_not_contains : Vec < String > ,
573
+ expect_stdout_unordered : Vec < String > ,
573
574
expect_stderr_unordered : Vec < String > ,
574
575
expect_stderr_with_without : Vec < ( Vec < String > , Vec < String > ) > ,
575
576
expect_json : Option < String > ,
@@ -671,6 +672,15 @@ impl Execs {
671
672
self
672
673
}
673
674
675
+ /// Verifies that all of the stdout output is equal to the given lines,
676
+ /// ignoring the order of the lines.
677
+ ///
678
+ /// See [`Execs::with_stderr_unordered`] for more details.
679
+ pub fn with_stdout_unordered < S : ToString > ( & mut self , expected : S ) -> & mut Self {
680
+ self . expect_stdout_unordered . push ( expected. to_string ( ) ) ;
681
+ self
682
+ }
683
+
674
684
/// Verifies that all of the stderr output is equal to the given lines,
675
685
/// ignoring the order of the lines.
676
686
///
@@ -932,6 +942,7 @@ impl Execs {
932
942
&& self . expect_stdout_contains_n . is_empty ( )
933
943
&& self . expect_stdout_not_contains . is_empty ( )
934
944
&& self . expect_stderr_not_contains . is_empty ( )
945
+ && self . expect_stdout_unordered . is_empty ( )
935
946
&& self . expect_stderr_unordered . is_empty ( )
936
947
&& self . expect_stderr_with_without . is_empty ( )
937
948
&& self . expect_json . is_none ( )
@@ -1036,6 +1047,9 @@ impl Execs {
1036
1047
for expect in self . expect_stderr_not_contains . iter ( ) {
1037
1048
compare:: match_does_not_contain ( expect, stderr, cwd) ?;
1038
1049
}
1050
+ for expect in self . expect_stdout_unordered . iter ( ) {
1051
+ compare:: match_unordered ( expect, stdout, cwd) ?;
1052
+ }
1039
1053
for expect in self . expect_stderr_unordered . iter ( ) {
1040
1054
compare:: match_unordered ( expect, stderr, cwd) ?;
1041
1055
}
@@ -1075,6 +1089,7 @@ pub fn execs() -> Execs {
1075
1089
expect_stdout_contains_n : Vec :: new ( ) ,
1076
1090
expect_stdout_not_contains : Vec :: new ( ) ,
1077
1091
expect_stderr_not_contains : Vec :: new ( ) ,
1092
+ expect_stdout_unordered : Vec :: new ( ) ,
1078
1093
expect_stderr_unordered : Vec :: new ( ) ,
1079
1094
expect_stderr_with_without : Vec :: new ( ) ,
1080
1095
expect_json : None ,
0 commit comments