()
| 226 | |
| 227 | #[test] |
| 228 | fn write_output() -> Result<()> { |
| 229 | let instrumented_registry = Arc::new(InstrumentedObjectStoreRegistry::new()); |
| 230 | let mut print_options = PrintOptions { |
| 231 | format: PrintFormat::Automatic, |
| 232 | quiet: true, |
| 233 | maxrows: MaxRows::Unlimited, |
| 234 | color: true, |
| 235 | instrumented_registry: Arc::clone(&instrumented_registry), |
| 236 | }; |
| 237 | |
| 238 | let mut print_output: Vec<u8> = Vec::new(); |
| 239 | let exec_out = String::from("Formatted Exec Output"); |
| 240 | print_options.write_output(&mut print_output, &exec_out)?; |
| 241 | assert!(print_output.is_empty()); |
| 242 | |
| 243 | print_options.quiet = false; |
| 244 | print_options.write_output(&mut print_output, &exec_out)?; |
| 245 | let out_str: String = print_output |
| 246 | .clone() |
| 247 | .try_into() |
| 248 | .expect("Expected successful String conversion"); |
| 249 | assert!(out_str.contains(&exec_out)); |
| 250 | |
| 251 | // clear the previous data from the output so it doesn't pollute the next test |
| 252 | print_output.clear(); |
| 253 | print_options |
| 254 | .instrumented_registry |
| 255 | .set_instrument_mode(InstrumentedObjectStoreMode::Trace); |
| 256 | print_options.write_output(&mut print_output, &exec_out)?; |
| 257 | let out_str: String = print_output |
| 258 | .clone() |
| 259 | .try_into() |
| 260 | .expect("Expected successful String conversion"); |
| 261 | assert!(out_str.contains(&exec_out)); |
| 262 | assert!(out_str.contains(OBJECT_STORE_PROFILING_HEADER)); |
| 263 | |
| 264 | Ok(()) |
| 265 | } |
| 266 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…