@@ -655,8 +655,6 @@ pub struct Execs {
655
655
expect_stdout_unordered : Vec < String > ,
656
656
expect_stderr_unordered : Vec < String > ,
657
657
expect_stderr_with_without : Vec < ( Vec < String > , Vec < String > ) > ,
658
- expect_json : Option < String > ,
659
- expect_json_contains_unordered : Option < String > ,
660
658
stream_output : bool ,
661
659
assert : snapbox:: Assert ,
662
660
}
@@ -824,56 +822,6 @@ impl Execs {
824
822
self . expect_stderr_with_without . push ( ( with, without) ) ;
825
823
self
826
824
}
827
-
828
- /// Verifies the JSON output matches the given JSON.
829
- ///
830
- /// This is typically used when testing cargo commands that emit JSON.
831
- /// Each separate JSON object should be separated by a blank line.
832
- /// Example:
833
- ///
834
- /// ```rust,ignore
835
- /// assert_that(
836
- /// p.cargo("metadata"),
837
- /// execs().with_json(r#"
838
- /// {"example": "abc"}
839
- ///
840
- /// {"example": "def"}
841
- /// "#)
842
- /// );
843
- /// ```
844
- ///
845
- /// - Objects should match in the order given.
846
- /// - The order of arrays is ignored.
847
- /// - Strings support patterns described in [`compare`].
848
- /// - Use `"{...}"` to match any object.
849
- #[ deprecated(
850
- note = "replaced with `Execs::with_stdout_data(expected.is_json().against_jsonlines())`"
851
- ) ]
852
- pub fn with_json ( & mut self , expected : & str ) -> & mut Self {
853
- self . expect_json = Some ( expected. to_string ( ) ) ;
854
- self
855
- }
856
-
857
- /// Verifies JSON output contains the given objects (in any order) somewhere
858
- /// in its output.
859
- ///
860
- /// CAUTION: Be very careful when using this. Make sure every object is
861
- /// unique (not a subset of one another). Also avoid using objects that
862
- /// could possibly match multiple output lines unless you're very sure of
863
- /// what you are doing.
864
- ///
865
- /// See `with_json` for more detail.
866
- #[ deprecated]
867
- pub fn with_json_contains_unordered ( & mut self , expected : & str ) -> & mut Self {
868
- match & mut self . expect_json_contains_unordered {
869
- None => self . expect_json_contains_unordered = Some ( expected. to_string ( ) ) ,
870
- Some ( e) => {
871
- e. push_str ( "\n \n " ) ;
872
- e. push_str ( expected) ;
873
- }
874
- }
875
- self
876
- }
877
825
}
878
826
879
827
/// # Configure the process
@@ -1050,8 +998,6 @@ impl Execs {
1050
998
&& self . expect_stdout_unordered . is_empty ( )
1051
999
&& self . expect_stderr_unordered . is_empty ( )
1052
1000
&& self . expect_stderr_with_without . is_empty ( )
1053
- && self . expect_json . is_none ( )
1054
- && self . expect_json_contains_unordered . is_none ( )
1055
1001
{
1056
1002
panic ! (
1057
1003
"`with_status()` is used, but no output is checked.\n \
@@ -1175,14 +1121,6 @@ impl Execs {
1175
1121
for ( with, without) in self . expect_stderr_with_without . iter ( ) {
1176
1122
compare:: match_with_without ( stderr, with, without, cwd) ?;
1177
1123
}
1178
-
1179
- if let Some ( ref expect_json) = self . expect_json {
1180
- compare:: match_json ( expect_json, stdout, cwd) ?;
1181
- }
1182
-
1183
- if let Some ( ref expected) = self . expect_json_contains_unordered {
1184
- compare:: match_json_contains_unordered ( expected, stdout, cwd) ?;
1185
- }
1186
1124
Ok ( ( ) )
1187
1125
}
1188
1126
}
@@ -1212,8 +1150,6 @@ pub fn execs() -> Execs {
1212
1150
expect_stdout_unordered : Vec :: new ( ) ,
1213
1151
expect_stderr_unordered : Vec :: new ( ) ,
1214
1152
expect_stderr_with_without : Vec :: new ( ) ,
1215
- expect_json : None ,
1216
- expect_json_contains_unordered : None ,
1217
1153
stream_output : false ,
1218
1154
assert : compare:: assert_e2e ( ) ,
1219
1155
}
0 commit comments