mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 22:32:33 +00:00
Working on adding tests
This commit is contained in:
parent
28a89b8ec2
commit
bf28d969f8
3 changed files with 4 additions and 44 deletions
|
@ -6,4 +6,4 @@ authors = ["Kevin K. <kbknapp@gmail.com>"]
|
|||
|
||||
[dependencies.clap]
|
||||
git = "https://github.com/kbknapp/clap-rs"
|
||||
branch = "dev"
|
||||
branch = "master"
|
||||
|
|
|
@ -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
|
|
@ -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())
|
Loading…
Reference in a new issue