All python related stuff has been removed, excepted language_agnostic_tester.py
.
If you want to clone this repository and hack docopts
:
You will need to install bats-core
in your PATH.
These are only required for testing with bats
, you may omit it if you dont plan to use
make test
Fetch the extra golang version of docopt-go
(required for building docopts
)
go get github.com/docopt/docopt-go
Current folder structure looks like:
.
├── docopts.go - main source code
├── docopts_test.go - go unit tests
├── docopts.sh - library wrapper and helpers
├── examples - many ported examples in bash, all must be working
├── language_agnostic_tester.py - old python JSON tester still used with testee.sh
├── LICENSE-MIT - original docopts license
├── README.md - our main documentation
├── testcases.docopt - agnostic testcases copied from python's docopt
├── testee.sh - bash wrapper to convert docopts output to JSON (now uses docopts.sh)
├── tests - unit and functional testing written in bats
└── TODO.md - Some todo list on this golang version of docopts
[...] - other file are helpers or current hack, not documented
Some tests are coded along with this code base:
- bats - bash unit tests and functional testing.
language_agnostic_tester.py
- old python wrapper, full docopt compatibility tests.- See also: docopt.go has its own tests in golang.
docopts_test.go
- go unit test fordocopts.go
make test
Bats is a unittest / functional testing framework for bash.
All our tests expect to run from ./tests/
directory and the docopts
binary in ../docopts
.
Ensure bats is in your PATH.
cd ./tests
bats .
This script was provided with the original docopts
. I fixed number/string output parsing failure with an extra function
for bash in docopts.sh
docopt_get_raw_value()
. This is a hack to get 100% pass, and it is not very efficient.
Run these tests from top of repo:
python language_agnostic_tester.py ./testee.sh
This lib is outside this project, but it is the base of the docopt
language parsing for this wrapper.
cd PATH/to/go/src/github.com/docopt/docopt-go/
go test -v .
cd PATH/to/go/src/github.com/docopt/docopts
go test -v