Skip to content

Commit c281281

Browse files
committed
make test panic if unexpected error occurred
1 parent 61a9073 commit c281281

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

cpp-linter/tests/paginated_changed_files.rs

+17-11
Original file line numberDiff line numberDiff line change
@@ -139,17 +139,23 @@ async fn get_paginated_changes(lib_root: &Path, test_params: &TestParams) {
139139

140140
let file_filter = FileFilter::new(&[], vec!["cpp".to_string(), "hpp".to_string()]);
141141
let files = client.get_list_of_changed_files(&file_filter).await;
142-
if let Ok(files) = files {
143-
// if !fail_serialization
144-
assert_eq!(files.len(), 2);
145-
for file in files {
146-
assert!(["src/demo.cpp", "src/demo.hpp"].contains(
147-
&file
148-
.name
149-
.as_path()
150-
.to_str()
151-
.expect("Failed to get file name from path")
152-
));
142+
match files {
143+
Err(e) => {
144+
if !test_params.fail_serde_diff {
145+
panic!("Failed to get changed files: {e:?}");
146+
}
147+
}
148+
Ok(files) => {
149+
assert_eq!(files.len(), 2);
150+
for file in files {
151+
assert!(["src/demo.cpp", "src/demo.hpp"].contains(
152+
&file
153+
.name
154+
.as_path()
155+
.to_str()
156+
.expect("Failed to get file name from path")
157+
));
158+
}
153159
}
154160
}
155161
for mock in mocks {

0 commit comments

Comments
 (0)