From 8de3908458ed8928e4aaed287fc62bf637fa45dc Mon Sep 17 00:00:00 2001 From: Kevin K Date: Thu, 26 Mar 2015 14:20:55 -0400 Subject: [PATCH] Fixed tests makefile and script --- claptests/Cargo.toml | 2 +- claptests/Makefile | 21 +++++++++++---------- claptests/run_test.py | 19 ------------------- claptests/src/main.rs | 2 ++ 4 files changed, 14 insertions(+), 30 deletions(-) delete mode 100755 claptests/run_test.py diff --git a/claptests/Cargo.toml b/claptests/Cargo.toml index 17ad0388..19d5ebb1 100644 --- a/claptests/Cargo.toml +++ b/claptests/Cargo.toml @@ -6,4 +6,4 @@ authors = ["Kevin K. "] [dependencies.clap] git = "https://github.com/kbknapp/clap-rs" -branch = "dev" +branch = "master" diff --git a/claptests/Makefile b/claptests/Makefile index 78e81f0b..dc6a08d4 100644 --- a/claptests/Makefile +++ b/claptests/Makefile @@ -1,5 +1,7 @@ THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd) +URL:= +BRANCH:= build: cargo update @@ -8,18 +10,17 @@ build: 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 + @read -p "Fork URL: " URL; \ + sed "/^git/c\git = \"$$URL\"" cargo.bak > Cargo.toml + @read -p "Branch [master]: " BRANCH; \ + $(if $(strip $(BRANCH)), \ + sed -i "/^branch/c\branch = \"master\"" Cargo.toml, \ + sed -i "/^branch/c\branch = \"$$BRANCH\"" Cargo.toml) (make clean) || (make clean && false) + cd "$(THIS_DIR)" (make build) || (make clean && false) - ./run_tests.py || (make clean && false) - echo "All tests pass!" + cd "$(THIS_DIR)" + (./run_tests.py) || (make clean && false) mv cargo.bak Cargo.toml make clean diff --git a/claptests/run_test.py b/claptests/run_test.py deleted file mode 100755 index 076dbfc1..00000000 --- a/claptests/run_test.py +++ /dev/null @@ -1,19 +0,0 @@ -#!/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()) \ No newline at end of file diff --git a/claptests/src/main.rs b/claptests/src/main.rs index f3fc8725..010090b8 100644 --- a/claptests/src/main.rs +++ b/claptests/src/main.rs @@ -67,6 +67,8 @@ fn main() { if let Some(p) = matches.value_of("positional") { println!("positional present with value: {}", p); + } else { + println!("positional NOT present"); } if matches.is_present("subcmd") {