Working on adding tests

This commit is contained in:
Kevin K 2015-03-25 21:45:53 -04:00
parent 28a89b8ec2
commit bf28d969f8
3 changed files with 4 additions and 44 deletions

View file

@ -6,4 +6,4 @@ authors = ["Kevin K. <kbknapp@gmail.com>"]
[dependencies.clap]
git = "https://github.com/kbknapp/clap-rs"
branch = "dev"
branch = "master"

View file

@ -1,21 +0,0 @@
claptests 0.0.1
Kevin K. <kbknapp@gmail.com>
tests clap library
USAGE:
claptests [FLAGS] [OPTIONS] [POSITIONAL] [SUBCOMMANDS]
FLAGS:
-f,--flag tests flags
-v,--version Prints version information
-h,--help Prints this message
OPTIONS:
-o ,--option=option tests options
POSITIONAL ARGUMENTS:
positional tests positionals
SUBCOMMANDS:
help Prints this message
subcmd tests subcommands

View file

@ -1,8 +1,8 @@
#!/usr/bin/env python
#!/usr/bin/env python2
import hashlib
import sys
import subprocess
failed = False
def pass_fail(good, check):
@ -13,26 +13,7 @@ def pass_fail(good, check):
return "Fail"
def main():
cmd_help = [['./target/release/claptests', '-h'],
['./target/release/claptests', '--help'],
['./target/release/claptests', 'help']]
proc = subprocess.Popen(cmd_help[0], stdout=subprocess.PIPE)
proc.wait()
out = proc.communicate()[0].decode('utf-8')
print("Help Flag:")
print("\tshort: {}".format(pass_fail(GOOD_HELP_HASH, out)))
proc = subprocess.Popen(cmd_help[1], stdout=subprocess.PIPE)
proc.wait()
out = proc.communicate()[0].decode('utf-8')
print("\tlong: {}".format(pass_fail(GOOD_HELP_HASH, out)))
proc = subprocess.Popen(cmd_help[2], stdout=subprocess.PIPE)
proc.wait()
out = proc.communicate()[0].decode('utf-8')
print("\tlong: {}".format(pass_fail(GOOD_HELP_HASH, out)))
pass
if failed:
return 1
if __name__ == '__main__':
sys.exit(main())