Skip to content

Apache DataFusion SQL Query Engine

ARROW-4896: [Rust] [DataFusion] Remove all uses of panic! from DataFusion tests

Andy Grovec5f728b47ee3
diff --git a/rust/datafusion/src/datasource/memory.rs b/rust/datafusion/src/datasource/memory.rs
index ebebd4efa7..e5955e5125 100644
--- a/rust/datafusion/src/datasource/memory.rs
+++ b/rust/datafusion/src/datasource/memory.rs
@@ -232,7 +232,7 @@ mod tests {
Err(ExecutionError::General(e)) => {
assert_eq!("\"Projection index out of range\"", format!("{:?}", e))
}
- _ => panic!("Scan should failed on invalid projection"),
+ _ => assert!(false, "Scan should failed on invalid projection"),
};
}
@@ -265,7 +265,10 @@ mod tests {
"\"Mismatch between schema and batches\"",
format!("{:?}", e)
),
- _ => panic!("MemTable::new should have failed due to schema mismatch"),
+ _ => assert!(
+ false,
+ "MemTable::new should have failed due to schema mismatch"
+ ),
}
}
}
diff --git a/rust/datafusion/src/optimizer/projection_push_down.rs b/rust/datafusion/src/optimizer/projection_push_down.rs
index a9d27874bf..2ffdfc9ab8 100644
--- a/rust/datafusion/src/optimizer/projection_push_down.rs
+++ b/rust/datafusion/src/optimizer/projection_push_down.rs
@@ -389,9 +389,9 @@ mod tests {
LogicalPlan::TableScan { ref schema, .. } => {
assert_eq!(2, schema.fields().len());
}
- _ => panic!(),
+ _ => assert!(false),
},
- _ => panic!(),
+ _ => assert!(false),
}
}