Test that globs match torrent contents

Globs should match paths within the torrent root, not including the
torrent root. Test that this is the case.

type: testing
fixes:
- https://github.com/casey/intermodal/issues/377
This commit is contained in:
Casey Rodarmor 2020-04-18 13:45:37 -07:00
parent 0a754d0bcf
commit faf46c0f0e
No known key found for this signature in database
GPG Key ID: 556186B153EC6FE0
2 changed files with 34 additions and 1 deletions

View File

@ -4,7 +4,8 @@ Changelog
UNRELEASED - 2020-04-18
-----------------------
- :books: [`xxxxxxxxxxxx`](https://github.com/casey/intermodal/commits/master) Add manual Arch install link - Fixes [#373](https://github.com/casey/intermodal/issues/373) - _Casey Rodarmor <casey@rodarmor.com>_
- :white_check_mark: [`xxxxxxxxxxxx`](https://github.com/casey/intermodal/commits/master) Test that globs match torrent contents - Fixes [#377](https://github.com/casey/intermodal/issues/377) - _Casey Rodarmor <casey@rodarmor.com>_
- :books: [`0a754d0bcfcf`](https://github.com/casey/intermodal/commit/0a754d0bcfcfd65127d7b6e78d41852df78d3ea2) Add manual Arch install link - Fixes [#373](https://github.com/casey/intermodal/issues/373) - _Casey Rodarmor <casey@rodarmor.com>_
- :art: [`0a870ed2ee2c`](https://github.com/casey/intermodal/commit/0a870ed2ee2cca79fddb9940fb879354468deb4d) Get current time early when creating torrents - Fixes [#207](https://github.com/casey/intermodal/issues/207) - _Casey Rodarmor <casey@rodarmor.com>_
- :books: [`9098d3684032`](https://github.com/casey/intermodal/commit/9098d368403232a07684cae8c0b9b1f1383dd2ce) Readme improvements - _Casey Rodarmor <casey@rodarmor.com>_
- :art: [`04338e3501af`](https://github.com/casey/intermodal/commit/04338e3501afd155af47d0c4bda2c680d2a7a519) Merge documentation and changelog generation - _Casey Rodarmor <casey@rodarmor.com>_

View File

@ -2115,6 +2115,38 @@ Content Size 9 bytes
assert_eq!(metainfo.info.pieces, PieceList::from_pieces(&["yyy"]));
}
#[test]
fn glob_torrent_root() {
let mut env = test_env! {
args: [
"torrent",
"create",
"--input",
"foo",
"--announce",
"http://bar",
"--glob",
"foo*",
],
tree: {
foo: {
a: "a",
foo: {
y: "yyy",
},
c: "c",
},
}
};
env.assert_ok();
let metainfo = env.load_metainfo("foo.torrent");
assert_matches!(
metainfo.info.mode,
Mode::Multiple { files } if files.len() == 1
);
assert_eq!(metainfo.info.pieces, PieceList::from_pieces(&["yyy"]));
}
#[test]
fn glob_precedence() {
let mut env = test_env! {