@@ -655,8 +655,6 @@ pub struct Execs {
655655 expect_stdout_unordered : Vec < String > ,
656656 expect_stderr_unordered : Vec < String > ,
657657 expect_stderr_with_without : Vec < ( Vec < String > , Vec < String > ) > ,
658- expect_json : Option < String > ,
659- expect_json_contains_unordered : Option < String > ,
660658 stream_output : bool ,
661659 assert : snapbox:: Assert ,
662660}
@@ -824,56 +822,6 @@ impl Execs {
824822 self . expect_stderr_with_without . push ( ( with, without) ) ;
825823 self
826824 }
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- }
877825}
878826
879827/// # Configure the process
@@ -1050,8 +998,6 @@ impl Execs {
1050998 && self . expect_stdout_unordered . is_empty ( )
1051999 && self . expect_stderr_unordered . is_empty ( )
10521000 && self . expect_stderr_with_without . is_empty ( )
1053- && self . expect_json . is_none ( )
1054- && self . expect_json_contains_unordered . is_none ( )
10551001 {
10561002 panic ! (
10571003 "`with_status()` is used, but no output is checked.\n \
@@ -1175,14 +1121,6 @@ impl Execs {
11751121 for ( with, without) in self . expect_stderr_with_without . iter ( ) {
11761122 compare:: match_with_without ( stderr, with, without, cwd) ?;
11771123 }
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- }
11861124 Ok ( ( ) )
11871125 }
11881126}
@@ -1212,8 +1150,6 @@ pub fn execs() -> Execs {
12121150 expect_stdout_unordered : Vec :: new ( ) ,
12131151 expect_stderr_unordered : Vec :: new ( ) ,
12141152 expect_stderr_with_without : Vec :: new ( ) ,
1215- expect_json : None ,
1216- expect_json_contains_unordered : None ,
12171153 stream_output : false ,
12181154 assert : compare:: assert_e2e ( ) ,
12191155 }
0 commit comments