Skip to content

Commit 7a6f52b

Browse files
committed
rm old example and add simple test to run module
1 parent 053f691 commit 7a6f52b

File tree

2 files changed

+55
-27
lines changed

2 files changed

+55
-27
lines changed

cpp-linter-lib/examples/diff.rs

-27
This file was deleted.

cpp-linter-lib/src/run.rs

+55
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,58 @@ pub async fn run_main(args: Vec<String>) -> i32 {
170170
end_log_group();
171171
0
172172
}
173+
174+
#[cfg(test)]
175+
mod test {
176+
use super::run_main;
177+
178+
#[tokio::test]
179+
async fn run() {
180+
assert_eq!(
181+
run_main(vec![
182+
"cpp-linter".to_string(),
183+
"-l".to_string(),
184+
"false".to_string()
185+
])
186+
.await,
187+
0
188+
);
189+
}
190+
191+
#[tokio::test]
192+
async fn run_version_command() {
193+
assert_eq!(
194+
run_main(vec!["cpp-linter".to_string(), "version".to_string()]).await,
195+
0
196+
);
197+
}
198+
199+
#[tokio::test]
200+
async fn run_force_debug_output() {
201+
assert_eq!(
202+
run_main(vec![
203+
"cpp-linter".to_string(),
204+
"-l".to_string(),
205+
"false".to_string(),
206+
"-v".to_string(),
207+
"debug".to_string(),
208+
])
209+
.await,
210+
0
211+
);
212+
}
213+
214+
#[tokio::test]
215+
async fn run_bad_version_input() {
216+
assert_eq!(
217+
run_main(vec![
218+
"cpp-linter".to_string(),
219+
"-l".to_string(),
220+
"false".to_string(),
221+
"-V".to_string()
222+
])
223+
.await,
224+
1
225+
);
226+
}
227+
}

0 commit comments

Comments
 (0)