Skip to content

Commit 6546d34

Browse files
committed
Split out cli tests for 'conserve versions'
1 parent 288dd0f commit 6546d34

File tree

2 files changed

+63
-45
lines changed

2 files changed

+63
-45
lines changed

tests/cli/main.rs

Lines changed: 2 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ use predicates::prelude::*;
2525

2626
use conserve::test_fixtures::{ScratchArchive, TreeFixture};
2727

28+
mod versions;
29+
2830
lazy_static! {
2931
// This doesn's pass `.current_target()` because it doesn't seem
3032
// necessary for typical cases (cross-builds won't work with this)
@@ -483,48 +485,3 @@ fn size_exclude() {
483485
.success()
484486
.stdout("10\n");
485487
}
486-
487-
#[test]
488-
fn versions() {
489-
run_conserve()
490-
.args(&["versions", "testdata/archive/simple/v0.6.10"])
491-
.assert()
492-
.success()
493-
.stdout(
494-
"\
495-
b0000 complete 2021-03-04 05:21:15 0:00
496-
b0001 complete 2021-03-04 05:21:30 0:00
497-
b0002 complete 2021-03-04 05:27:28 0:00
498-
",
499-
);
500-
}
501-
502-
#[test]
503-
fn versions_short() {
504-
run_conserve()
505-
.args(&["versions", "--short", "testdata/archive/simple/v0.6.10"])
506-
.assert()
507-
.success()
508-
.stdout(
509-
"\
510-
b0000
511-
b0001
512-
b0002
513-
",
514-
);
515-
}
516-
517-
#[test]
518-
fn versions_sizes() {
519-
run_conserve()
520-
.args(&["versions", "--sizes", "testdata/archive/simple/v0.6.10"])
521-
.assert()
522-
.success()
523-
.stdout(
524-
"\
525-
b0000 complete 2021-03-04 05:21:15 0:00 0 MB
526-
b0001 complete 2021-03-04 05:21:30 0:00 0 MB
527-
b0002 complete 2021-03-04 05:27:28 0:00 0 MB
528-
",
529-
);
530-
}

tests/cli/versions.rs

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// Conserve backup system.
2+
// Copyright 2021 Martin Pool.
3+
4+
// This program is free software; you can redistribute it and/or modify
5+
// it under the terms of the GNU General Public License as published by
6+
// the Free Software Foundation; either version 2 of the License, or
7+
// (at your option) any later version.
8+
//
9+
// This program is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU General Public License for more details.
13+
14+
use assert_cmd::prelude::*;
15+
16+
use crate::run_conserve;
17+
18+
#[test]
19+
fn versions() {
20+
run_conserve()
21+
.args(&["versions", "testdata/archive/simple/v0.6.10"])
22+
.assert()
23+
.success()
24+
.stdout(
25+
"\
26+
b0000 complete 2021-03-04 05:21:15 0:00
27+
b0001 complete 2021-03-04 05:21:30 0:00
28+
b0002 complete 2021-03-04 05:27:28 0:00
29+
",
30+
);
31+
}
32+
33+
#[test]
34+
fn versions_short() {
35+
run_conserve()
36+
.args(&["versions", "--short", "testdata/archive/simple/v0.6.10"])
37+
.assert()
38+
.success()
39+
.stdout(
40+
"\
41+
b0000
42+
b0001
43+
b0002
44+
",
45+
);
46+
}
47+
48+
#[test]
49+
fn versions_sizes() {
50+
run_conserve()
51+
.args(&["versions", "--sizes", "testdata/archive/simple/v0.6.10"])
52+
.assert()
53+
.success()
54+
.stdout(
55+
"\
56+
b0000 complete 2021-03-04 05:21:15 0:00 0 MB
57+
b0001 complete 2021-03-04 05:21:30 0:00 0 MB
58+
b0002 complete 2021-03-04 05:27:28 0:00 0 MB
59+
",
60+
);
61+
}

0 commit comments

Comments
 (0)