Merge pull request #933 from matthiasbeyer/add-dep-ismatch

Add dep ismatch
This commit is contained in:
Matthias Beyer 2017-05-04 16:36:01 +02:00 committed by GitHub
commit 4ba19430b7
8 changed files with 9 additions and 46 deletions

View file

@ -21,6 +21,7 @@ semver = "0.5"
url = "1.2"
rust-crypto = "0.2"
env_logger = "0.3"
is-match = "0.1"
[dependencies.libimagstore]
path = "../libimagstore"

View file

@ -37,13 +37,14 @@ extern crate toml;
extern crate semver;
extern crate url;
extern crate crypto;
#[macro_use] extern crate is_match;
#[cfg(test)]
extern crate env_logger;
#[macro_use] extern crate libimagstore;
#[macro_use] extern crate libimagerror;
#[macro_use] extern crate libimagutil;
extern crate libimagutil;
module_entry_path_mod!("links");

View file

@ -19,6 +19,7 @@ log = "0.3"
regex = "0.2"
toml = "^0.4"
itertools = "0.5"
is-match = "0.1"
[dependencies.libimagstore]
path = "../libimagstore"

View file

@ -36,10 +36,11 @@ extern crate itertools;
#[macro_use] extern crate log;
extern crate regex;
extern crate toml;
#[macro_use] extern crate is_match;
extern crate libimagstore;
#[macro_use] extern crate libimagerror;
#[macro_use] extern crate libimagutil;
extern crate libimagutil;
pub mod error;
pub mod exec;

View file

@ -25,6 +25,7 @@ version = "2.0.1"
crossbeam = "0.2.*"
walkdir = "1.0.*"
itertools = "0.6.*"
is-match = "0.1"
[dependencies.libimagerror]
path = "../libimagerror"

View file

@ -43,9 +43,10 @@ extern crate semver;
extern crate crossbeam;
extern crate walkdir;
extern crate itertools;
#[macro_use] extern crate is_match;
#[macro_use] extern crate libimagerror;
#[macro_use] extern crate libimagutil;
extern crate libimagutil;
#[macro_use] mod util;

View file

@ -1,42 +0,0 @@
//
// imag - the personal information management suite for the commandline
// Copyright (C) 2015, 2016 Matthias Beyer <mail@beyermatthias.de> and contributors
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; version
// 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//
#[macro_export]
macro_rules! is_match {
($expression: expr, $($pattern:tt)+) => {
is_match! {tt
match $expression {
$($pattern)+ => true,
_ => false
}
}
};
(tt $value:expr) => ($value);
}
#[test]
fn test_matching() {
let foo = Some("-12");
assert!(is_match!(foo, Some(bar) if
is_match!(bar.as_bytes()[0], b'+' | b'-') &&
is_match!(bar.as_bytes()[1], b'0'...b'9')
));
assert!(!is_match!(foo, None));
}

View file

@ -44,7 +44,6 @@ pub mod cli_validators;
pub mod debug_result;
pub mod edit;
pub mod info_result;
pub mod ismatch;
pub mod iter;
pub mod key_value_split;
pub mod variants;