test-lib: Always print output differences, not just in verbose mode.

Differences in the expected and actual todo.sh output are critical to analyzing the error, so they should always be printed, not just when the -verbose argument is given.

This refactoring moves the test_cmp call from the command under test (as seen from test-lib's perspective) into a new assertion test_expect_output, derived from test_expect_success.
test-lib: Separate function for exit code assertion.

Remove the check for the todo.sh exit code (scripted via "=== N") from the command under test into a separate assertion test_expect_code_and_output. This allows for reporting of expected vs. actual exit code (also in the default non-verbose mode), and unexpected output from the same test is now reported, too.
test-lib: Show full todo.sh output in verbose mode.

Now that differences in the output (and exit code) are already printed by default, we can make the verbose mode actually "verbose" by including all todo.sh output generated during the test run. This may help in reviewing the tests and for troubleshooting.
By moving the redirection to the output file to test_run_(), all testing-related embellishments have been removed from the command under test itself, resulting in much cleaner test messages.
Additionally, also capture stderr in output. todo.sh itself currently prints everything to stdout (but the die() output probably belongs to stderr), so as of now, that has no consequences, but seems to be more consistent and future-proof.
test-report: Use color highlighting as in test-lib.

The test aggregate results are easy to miss when running the entire test suite via "make test", as the status of the last test case is highlighted, but the aggregate results appear in an unformatted, uncolored block of text.
Copy the say_color() function from test-lib.sh. (Sorry for the duplication, I found no simple way to import or share just this piece of functionality without adding much complexity.)
Successes, errors and broken summaries will now be highlighted in the appropriate colors (unless --no-color is given or output is not to a terminal), but only if the number is more than zero.
ENH: Allow listpri filtering with priority ranges.

So far, the listpri action only supports a single priority. Allowing priority ranges (e.g. todo.sh listpri A-C @work) is a simple but useful enhancement.

Note: The syntax extension only clashes with the [TERM] filtering in a few corner cases, and this can be worked around (e.g. "todo.sh listpri A-Z A-Z" lists all prioritized tasks containing the text A-Z).
Get rid of cleanup, only use TMP_FILE in listall.

After the recent refactorings, the temporary file is only needed for the listall action. Therefore, the creation-checks and eventual cleanup can be restricted to the listall action, which should slightly speed up the overall script execution.
Break up _list(), get rid of TMP_FILE.

Extract a new function _format() (and getPadding(), both also exported for add-ons) from _list(), which includes the main formatting and filtering pipeline, without the file handling and verbose summary. This can receive the todo file via stdin, so the listall action is able to format the concatenated files without going through a temporary file.

Eventually, after further refactorings, _format() could be used for actual formatted verbose messages in all commands; currently, the raw, unformatted task is printed.
Also get rid of TMP_FILE in todo.cfg.

There's a slight chance that some add-on has used this (undocumented, unofficial) configuration value for its own purposes (and maybe also relied on the unexposed cleanup() infrastructure), but detecting and fixing that problem (by moving the cleanup into the add-on itself) is pretty straightforward.
Merge pull request #73 from inkarkat/testlib-enhancements

Testlib enhancements

As the vast majority of tests uses the todo.sh output to verify its correctness, output differences should always be shown, not just in verbose mode. 

This change removes the output redirection and check for exit code from the command-under-test, so as another benefit, these "housekeeping commands" are now kept off the test log.

Also, by using a separate function for exit code assertion, this can now report both differences in output and exit code (and not suppress the former any more.)

(Note: To see any of this, you need to temporarily introduce some test failures.)

Finally, I've added color highlighting for the aggregate test report (as in test-lib), because it didn't stood out against the colored test results, so that I often missed the crucial summary.
Merge pull request #74 from inkarkat/listpri-pri-range

ENH: Allow listpri filtering with priority ranges.
Merge pull request #75 from inkarkat/rid-tmp-file

Split up _list() and get rid of $TMP_FILE and cleanup(). 
Revert to safer POSIX AWK regexp.

AWK from Ubuntu 8.04 (mawk) doesn't support [[:space:]]; so for backwards compatibility use a plain ASCII space instead.
Merge pull request #76 from inkarkat/reintroduce-mawk-support

Revert to safer POSIX AWK regexp.
ENH: TODOTXT_SOURCEVAR enables different source file for listcon.

To be used by todo_completion (to offer candidates from done.txt when there are no matches in todo.txt), and maybe by custom addons.
ENH: TODOTXT_SOURCEVAR enables different source file for listproj.
Add testing of todo_completion.

Before adding any more features to todo_completion, I feel like I need test coverage, so this is a first stab at testing the completion results, via a new test function test_todo_completion.
Some basic tests showcase the capabilities.

Note: test-lib.sh now uses arrays, therefore all tests must use /bin/bash, not /bin/sh to avoid errors when sourcing test-lib. For consistency with todo.sh, we should have used Bash everywhere, anyway. Also note that t2000-multiline.sh needs some more quoting to avoid "Bash: ambiguous redirect" errors.
Add tests for project and context completion.
ENH: completion offers projects and contexts from done.txt.

This is useful when there are no open projects/contexts any more, but one wants to re-use an existing name.
Merge duplicate test files for listproj.

t1260-listprj.sh was accidentally created; the tests should be in t1320-listproj.sh.
test-lib: Avoid empty line in diff when no completion.

There should be a trailing newline when there are completions (to avoid diff complaining about "no trailing newline", but not when there are no completions at all.