@@ -19,7 +19,6 @@ use std::{
1919} ;
2020
2121use enum_map:: { Enum , EnumMap , enum_map} ;
22- use similar_asserts:: SimpleDiff ;
2322use snapbox:: { IntoData , RedactedValue , Redactions , assert_data_eq} ;
2423use tempfile:: TempDir ;
2524use url:: Url ;
@@ -315,150 +314,6 @@ impl Config {
315314 Assert :: new ( output)
316315 }
317316
318- /// Expect an ok status
319- #[ deprecated( note = "use `.expect().await.is_ok()` instead" ) ]
320- #[ allow( deprecated) ]
321- pub async fn expect_ok ( & mut self , args : & [ & str ] ) {
322- self . expect_ok_env ( args, & [ ] ) . await
323- }
324-
325- /// Expect an ok status with extra environment variables
326- #[ deprecated( note = "use `.expect_with_env().await.is_ok()` instead" ) ]
327- pub async fn expect_ok_env ( & self , args : & [ & str ] , env : & [ ( & str , & str ) ] ) {
328- let out = self . run ( args[ 0 ] , & args[ 1 ..] , env) . await ;
329- if !out. ok {
330- print_command ( args, & out) ;
331- println ! ( "expected.ok: true" ) ;
332- panic ! ( ) ;
333- }
334- }
335-
336- /// Expect an err status and a string in stderr
337- #[ deprecated( note = "use `.expect().await.is_err()` instead" ) ]
338- #[ allow( deprecated) ]
339- pub async fn expect_err ( & self , args : & [ & str ] , expected : & str ) {
340- self . expect_err_env ( args, & [ ] , expected) . await
341- }
342-
343- /// Expect an err status and a string in stderr, with extra environment variables
344- #[ deprecated( note = "use `.expect_with_env().await.is_err()` instead" ) ]
345- pub async fn expect_err_env ( & self , args : & [ & str ] , env : & [ ( & str , & str ) ] , expected : & str ) {
346- let out = self . run ( args[ 0 ] , & args[ 1 ..] , env) . await ;
347- if out. ok || !out. stderr . contains ( expected) {
348- print_command ( args, & out) ;
349- println ! ( "expected.ok: false" ) ;
350- print_indented ( "expected.stderr.contains" , expected) ;
351- panic ! ( ) ;
352- }
353- }
354-
355- /// Expect an ok status and a string in stdout
356- #[ deprecated( note = "use `.expect().await.is_ok().with_stdout()` instead" ) ]
357- pub async fn expect_stdout_ok ( & self , args : & [ & str ] , expected : & str ) {
358- let out = self . run ( args[ 0 ] , & args[ 1 ..] , & [ ] ) . await ;
359- if !out. ok || !out. stdout . contains ( expected) {
360- print_command ( args, & out) ;
361- println ! ( "expected.ok: true" ) ;
362- print_indented ( "expected.stdout.contains" , expected) ;
363- panic ! ( ) ;
364- }
365- }
366-
367- #[ deprecated( note = "use `.expect().await.is_ok().without_stdout()` instead" ) ]
368- pub async fn expect_not_stdout_ok ( & self , args : & [ & str ] , expected : & str ) {
369- let out = self . run ( args[ 0 ] , & args[ 1 ..] , & [ ] ) . await ;
370- if !out. ok || out. stdout . contains ( expected) {
371- print_command ( args, & out) ;
372- println ! ( "expected.ok: true" ) ;
373- print_indented ( "expected.stdout.does_not_contain" , expected) ;
374- panic ! ( ) ;
375- }
376- }
377-
378- #[ deprecated( note = "use `.expect().await.is_ok().without_stderr()` instead" ) ]
379- pub async fn expect_not_stderr_ok ( & self , args : & [ & str ] , expected : & str ) {
380- let out = self . run ( args[ 0 ] , & args[ 1 ..] , & [ ] ) . await ;
381- if !out. ok || out. stderr . contains ( expected) {
382- print_command ( args, & out) ;
383- println ! ( "expected.ok: false" ) ;
384- print_indented ( "expected.stderr.does_not_contain" , expected) ;
385- panic ! ( ) ;
386- }
387- }
388-
389- #[ deprecated( note = "use `.expect().await.is_err().without_stderr()` instead" ) ]
390- pub async fn expect_not_stderr_err ( & self , args : & [ & str ] , expected : & str ) {
391- let out = self . run ( args[ 0 ] , & args[ 1 ..] , & [ ] ) . await ;
392- if out. ok || out. stderr . contains ( expected) {
393- print_command ( args, & out) ;
394- println ! ( "expected.ok: false" ) ;
395- print_indented ( "expected.stderr.does_not_contain" , expected) ;
396- panic ! ( ) ;
397- }
398- }
399-
400- /// Expect an ok status and a string in stderr
401- #[ deprecated( note = "use `.expect().await.is_ok().with_stderr()` instead" ) ]
402- pub async fn expect_stderr_ok ( & self , args : & [ & str ] , expected : & str ) {
403- let out = self . run ( args[ 0 ] , & args[ 1 ..] , & [ ] ) . await ;
404- if !out. ok || !out. stderr . contains ( expected) {
405- print_command ( args, & out) ;
406- println ! ( "expected.ok: true" ) ;
407- print_indented ( "expected.stderr.contains" , expected) ;
408- panic ! ( ) ;
409- }
410- }
411-
412- /// Expect an exact strings on stdout/stderr with an ok status code
413- #[ deprecated( note = "use `.expect().await.is_ok().with_stdout().with_stderr()` instead" ) ]
414- #[ allow( deprecated) ]
415- pub async fn expect_ok_ex ( & mut self , args : & [ & str ] , stdout : & str , stderr : & str ) {
416- self . expect_ok_ex_env ( args, & [ ] , stdout, stderr) . await ;
417- }
418-
419- /// Expect an exact strings on stdout/stderr with an ok status code,
420- /// with extra environment variables
421- #[ deprecated(
422- note = "use `.expect_with_env().await.is_ok().with_stdout().with_stderr()` instead"
423- ) ]
424- pub async fn expect_ok_ex_env (
425- & mut self ,
426- args : & [ & str ] ,
427- env : & [ ( & str , & str ) ] ,
428- stdout : & str ,
429- stderr : & str ,
430- ) {
431- let out = self . run ( args[ 0 ] , & args[ 1 ..] , env) . await ;
432- if !out. ok || out. stdout != stdout || out. stderr != stderr {
433- print_command ( args, & out) ;
434- print_diff ( stdout, & out. stdout ) ;
435- print_diff ( stderr, & out. stderr ) ;
436- panic ! (
437- "expected OK, differences found: ok = {}, stdout = {}, stderr = {}" ,
438- out. ok,
439- out. stdout == stdout,
440- out. stderr == stderr
441- ) ;
442- }
443- }
444-
445- /// Expect an exact strings on stdout/stderr with an error status code
446- #[ deprecated( note = "use `.expect().await.is_err().with_stdout().with_stderr()` instead" ) ]
447- pub async fn expect_err_ex ( & self , args : & [ & str ] , stdout : & str , stderr : & str ) {
448- let out = self . run ( args[ 0 ] , & args[ 1 ..] , & [ ] ) . await ;
449- if out. ok || out. stdout != stdout || out. stderr != stderr {
450- print_command ( args, & out) ;
451- print_diff ( stdout, & out. stdout ) ;
452- print_diff ( stderr, & out. stderr ) ;
453- panic ! (
454- "expected error, differences found: ok = {}, stdout = {}, stderr = {}" ,
455- out. ok,
456- out. stdout == stdout,
457- out. stderr == stderr
458- ) ;
459- }
460- }
461-
462317 pub async fn expect_ok_contains ( & self , args : & [ & str ] , stdout : & str , stderr : & str ) {
463318 let out = self . run ( args[ 0 ] , & args[ 1 ..] , & [ ] ) . await ;
464319 if !out. ok || !out. stdout . contains ( stdout) || !out. stderr . contains ( stderr) {
@@ -624,17 +479,6 @@ impl Config {
624479 }
625480}
626481
627- fn print_diff ( expected : & str , actual : & str ) {
628- if expected == actual {
629- return ;
630- }
631-
632- println ! (
633- "{}" ,
634- SimpleDiff :: from_str( expected, actual, "expected" , "actual" )
635- ) ;
636- }
637-
638482// Describes all the features of the mock dist server.
639483// Building the mock server is slow, so use simple scenario when possible.
640484#[ derive( Copy , Clone , Debug , Eq , PartialEq , Enum ) ]
0 commit comments