assert_eq!
macro with a boolean literal, consider using assert!(..)
76 .wait_with_output()
77 .expect("failed to execute process");
78
79 assert_eq!( 80 output.status.success(), 81 true, 82 "\n\n------ Test Error ------\nProgram {} exited with non-zero status:\n\n{}\n---- End Test Error ----\n------- Test Out -------\nProgram {} exited with non-zero status:\n\n{}\n----- End Test Out -----\n", 83 &name, 84 unsafe { String::from_utf8_unchecked(output.stderr) }, 85 &name, 86 unsafe { String::from_utf8_unchecked(output.stdout) } 87 ); 88 let mut sim = test_bin::get_test_bin("worthc");
89 sim.arg(file).arg("S");
90 if let Some(args) = &args {
assert_eq!
macro with a boolean literal, consider using assert!(..)
47 .arg(&out_file)
48 .output()
49 .expect("failed to execute process");
50 assert_eq!( 51 output.status.success(), 52 true, 53 "\n\n---- Compiler Error ----\nCompiler exited with non-zero status for program {}:\n\n{}\n-- End Compiler Error --\n\n", 54 &name, 55 unsafe { String::from_utf8_unchecked(output.stderr) } 56 ); 57 let mut output = Command::new(&out_file);
58 if let Some(args) = &args {
59 //output.arg("--");
assert_eq!
macro with a boolean literal, consider using assert!(..)
108 .wait_with_output()
109 .expect("failed to wait for process");
110
111 assert_eq!(112 sim_output.status.success(),113 true,114 "\n\n------- Sim Error ------\nSim for {} exited with non-zero status:\n\n{}\n----- End Sim Error ----\n",115 &name,116 unsafe { String::from_utf8_unchecked(sim_output.stderr) }117 );118
119 assert!(
120 sim_output.stdout == output.stdout,
Boolean comparisons in assert_eq
macros are harder to read than assert
.
It is shorter to use the equivalent assert
macro.
assert_eq!("a".is_empty(), false);
assert_eq!(condition, true);
assert!(!"a".is_empty());
assert!(condition);