mirror of
https://github.com/clap-rs/clap
synced 2025-03-04 15:27:16 +00:00
Adding tests
This commit is contained in:
commit
83b1ee8c3a
4 changed files with 53 additions and 9 deletions
|
@ -5,5 +5,10 @@ version = "0.0.1"
|
|||
authors = ["Kevin K. <kbknapp@gmail.com>"]
|
||||
|
||||
[dependencies.clap]
|
||||
<<<<<<< HEAD
|
||||
git = "file:/home/kevin/Projects/clap-rs"
|
||||
branch = "dev"
|
||||
=======
|
||||
git = "https://github.com/kbknapp/clap-rs"
|
||||
branch = "master"
|
||||
>>>>>>> tests
|
||||
|
|
29
claptests/Makefile
Normal file
29
claptests/Makefile
Normal file
|
@ -0,0 +1,29 @@
|
|||
THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
|
||||
THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd)
|
||||
|
||||
build:
|
||||
cargo update
|
||||
cargo build --release
|
||||
|
||||
test:
|
||||
cd "$(THIS_DIR)"
|
||||
cp Cargo.toml cargo.bak
|
||||
read -p "fork url: " FORK
|
||||
read -p "branch [master]: " BRANCH
|
||||
sed "s/^git/git = \"$FORK\"/" cargo.bak > Cargo.toml
|
||||
if [ "$BRANCH" == "" ]; then
|
||||
sed -i "s/^git/branch = \"master\"/" Cargo.toml
|
||||
else
|
||||
sed -i "s/^branch/branch = \"$BRANCH\"/" Cargo.toml
|
||||
fi
|
||||
(make clean) || (make clean && false)
|
||||
(make build) || (make clean && false)
|
||||
./run_tests.py || (make clean && false)
|
||||
echo "All tests pass!"
|
||||
mv cargo.bak Cargo.toml
|
||||
make clean
|
||||
|
||||
|
||||
clean:
|
||||
cd "$(THIS_DIR)"
|
||||
cargo clean
|
19
claptests/run_test.py
Executable file
19
claptests/run_test.py
Executable file
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/env python2
|
||||
import hashlib
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
failed = False
|
||||
|
||||
def pass_fail(good, check):
|
||||
print(good)
|
||||
if check == good:
|
||||
return "Pass"
|
||||
failed = True
|
||||
return "Fail"
|
||||
|
||||
def main():
|
||||
pass
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
|
@ -481,15 +481,6 @@ impl<'a, 'v, 'ab, 'u> App<'a, 'v, 'ab, 'u>{
|
|||
if !pos_only {
|
||||
if let Some(nvo) = needs_val_of {
|
||||
if let Some(ref opt) = self.opts.get(nvo) {
|
||||
// if self.blacklist.contains(opt.name) {
|
||||
// self.report_error(
|
||||
// format!("The argument {} is mutually exclusive with one or more other arguments",
|
||||
// if let Some(long) = opt.long {
|
||||
// format!("--{}",long)
|
||||
// }else{
|
||||
// format!("-{}",opt.short.unwrap())
|
||||
// }),true, true);
|
||||
// }
|
||||
if let Some(ref mut o) = matches.opts.get_mut(opt.name) {
|
||||
o.values.push(arg.clone());
|
||||
o.occurrences = if opt.multiple { o.occurrences + 1 } else { 1 };
|
||||
|
|
Loading…
Add table
Reference in a new issue