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:

  1. Set the environment variable GDS_TASK to a short string describing the feature.
  2. Add an integration test that describes the feature, but keep it pended (don't begin the function name with T_ just yet)
  3. Run ./test-and-commit
  4. See the tests pass, and your pended integration test get committed
  5. Un-pend your integration test
  6. Run ./test-and-commit
  7. See the integration test fail (and magically pend itself)
  8. Do
    1. Write a pended unit test that will get you part way to your feature
    2. Run ./test-and-commit
    3. See the unit test fail (and magically pend itself)
    4. Write some code to make the unit test pass
    5. Run ./test-and-commit
    6. Either
      • See the test pass and commit -- good job!
      • See the test fail and revert -- try again.
    7. Loop until your feature is implemented
  9. Unpend your integration test
  10. Run ./test-and-commit
  11. See the test pass, and commit.
  12. 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.