From faf46c0f0e6fd4e4f8b504d414a3bf02d7d68e4a Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Sat, 18 Apr 2020 13:45:37 -0700 Subject: [PATCH] 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 --- CHANGELOG.md | 3 ++- src/subcommand/torrent/create.rs | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae05608..bb6bdad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 _ +- :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 _ +- :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 _ - :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 _ - :books: [`9098d3684032`](https://github.com/casey/intermodal/commit/9098d368403232a07684cae8c0b9b1f1383dd2ce) Readme improvements - _Casey Rodarmor _ - :art: [`04338e3501af`](https://github.com/casey/intermodal/commit/04338e3501afd155af47d0c4bda2c680d2a7a519) Merge documentation and changelog generation - _Casey Rodarmor _ diff --git a/src/subcommand/torrent/create.rs b/src/subcommand/torrent/create.rs index bea9363..6907633 100644 --- a/src/subcommand/torrent/create.rs +++ b/src/subcommand/torrent/create.rs @@ -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! {