Provide a mechanism to compose type definitions

This extends the syntax of the --type-add flag to allow including the globs of
other already defined types.

Fixes #83.
This commit is contained in:
Ian Kerins
2017-01-01 19:32:46 -05:00
committed by Andrew Gallant
parent 8f7b9be356
commit ed01e80a79
5 changed files with 166 additions and 16 deletions

View File

@@ -308,6 +308,17 @@ sherlock!(file_type_add, "Sherlock", ".", |wd: WorkDir, mut cmd: Command| {
assert_eq!(lines, "file.wat:Sherlock\n");
});
sherlock!(file_type_add_compose, "Sherlock", ".", |wd: WorkDir, mut cmd: Command| {
wd.create("file.py", "Sherlock");
wd.create("file.rs", "Sherlock");
wd.create("file.wat", "Sherlock");
cmd.arg("--type-add").arg("wat:*.wat");
cmd.arg("--type-add").arg("combo:include:wat,py").arg("-t").arg("combo");
let lines: String = wd.stdout(&mut cmd);
println!("{}", lines);
assert_eq!(lines, "file.py:Sherlock\nfile.wat:Sherlock\n");
});
sherlock!(glob, "Sherlock", ".", |wd: WorkDir, mut cmd: Command| {
wd.create("file.py", "Sherlock");
wd.create("file.rs", "Sherlock");