Skip to content

Commit ad3f790

Browse files
committed
Add test for small zip files
1 parent 6dd3c1d commit ad3f790

2 files changed

Lines changed: 45 additions & 1 deletion

File tree

cli/tests/cli.rs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use assert_cmd::prelude::*;
22
use insta::Settings;
33
use insta_cmd::assert_cmd_snapshot;
44
use serial_test::serial;
5-
use std::process::Command;
5+
use std::{path::Path, process::Command};
66

77
fn standard_filter() -> Settings {
88
let mut settings = insta::Settings::clone_current();
@@ -88,3 +88,25 @@ fn list_corpora_partially_loaded() -> Result<(), Box<dyn std::error::Error>> {
8888

8989
Ok(())
9090
}
91+
92+
#[test]
93+
#[serial]
94+
fn export_to_zip_file() -> Result<(), Box<dyn std::error::Error>> {
95+
let mut cmd = Command::cargo_bin("annis")?;
96+
97+
cmd.arg("../graphannis/tests/data/")
98+
.arg("-c")
99+
.arg("corpus sample-disk-based-3.3")
100+
.arg("-c")
101+
.arg("export sample-disk-based-3.3.zip");
102+
103+
let settings = standard_filter();
104+
settings.bind(|| assert_cmd_snapshot!(cmd));
105+
106+
// Check that the file has been created
107+
let p = Path::new("sample-disk-based-3.3.zip");
108+
assert_eq!(true, p.is_file());
109+
// Cleanup created file
110+
std::fs::remove_file(p)?;
111+
Ok(())
112+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
source: cli/tests/cli.rs
3+
info:
4+
program: annis
5+
args:
6+
- "../graphannis/tests/data/"
7+
- "-c"
8+
- corpus sample-disk-based-3.3
9+
- "-c"
10+
- export sample-disk-based-3.3.zip
11+
---
12+
success: true
13+
exit_code: 0
14+
----- stdout -----
15+
12:00:00[INFO] Loaded corpus sample-disk-based-3.3
16+
12:00:00[INFO] exporting all available annotation keys
17+
12:00:00[INFO] exporting nodes
18+
12:00:00[INFO] exporting edges
19+
12:00:00[INFO] exported corpora ["sample-disk-based-3.3"] in 0s
20+
graphANNIS says good-bye!
21+
22+
----- stderr -----

0 commit comments

Comments
 (0)