move contents of taskchampion repo to tc/

This commit is contained in:
Dustin J. Mitchell
2022-05-08 19:01:20 +00:00
parent 73baefa0a5
commit 2a92b2a4b9
219 changed files with 0 additions and 0 deletions

40
rust/cli/src/macros.rs Normal file
View File

@@ -0,0 +1,40 @@
#![macro_use]
/// create a &[&str] from vec notation
#[cfg(test)]
macro_rules! argv {
() => (
&[][..]
);
($($x:expr),* $(,)?) => (
&[$($x),*][..]
);
}
/// Create a hashset, similar to vec!
// NOTE: in Rust 1.56.0, this can be changed to HashSet::from([..])
#[cfg(test)]
macro_rules! set(
{ $($key:expr),* $(,)? } => {
{
#[allow(unused_mut)]
let mut s = ::std::collections::HashSet::new();
$(
s.insert($key);
)*
s
}
};
);
/// Create a String from an &str; just a testing shorthand
#[cfg(test)]
macro_rules! s(
{ $s:expr } => { $s.to_owned() };
);
/// Create a Tag from an &str; just a testing shorthand
#[cfg(test)]
macro_rules! tag(
{ $s:expr } => { { use std::convert::TryFrom; taskchampion::Tag::try_from($s).unwrap() } };
);