Tiny Bash Desktop Calculator
This is a little desktop calculator. Written in bash. Run it by
running ./calc
or test it by running ./test
.
The point of this little experiment was to play with a fun development workflow I read about here and here, and then extrapolated on to suit my own outside-in London-style TDD habits. Which leads to...
to add a feature
Follow these steps:
- Set the environment variable
GDS_TASK
to a short string describing the feature. - Add an integration test that describes the feature, but keep it
pended (don't begin the function name with
T_
just yet) - Run
./test-and-commit
- See the tests pass, and your pended integration test get committed
- Un-pend your integration test
- Run
./test-and-commit
- See the integration test fail (and magically pend itself)
- Do
- Write a pended unit test that will get you part way to your feature
- Run
./test-and-commit
- See the unit test fail (and magically pend itself)
- Write some code to make the unit test pass
- Run
./test-and-commit
- Either
- See the test pass and commit -- good job!
- See the test fail and revert -- try again.
- Loop until your feature is implemented
- Unpend your integration test
- Run
./test-and-commit
- See the test pass, and commit.
git push
I haven't expermented properly with ./limbo
since I've been soloing,
but it was part of Kent Beck's original intent in the posts above so
I've included a copy.
Anything interesting about the code?
...well, there's a tiny tiny expression parser written in bash, which seems to kinda work. And since bash doesn't have extensible in-memory data structures, I'm using the file system to build my abstract syntax tree.