Skip to content

Conversation

@mbland
Copy link
Owner

@mbland mbland commented Jan 15, 2017

Closes #40. Future PRs may add to or tweak the lib/bats and lib/testing modules, but the existing functions are now completely exported and tested.

In addition to extracting the lib/testing/log module, this PR contains simplifications to lib/log and replaces echo with printf in several places.

Also moves `test-go` from `lib/testing/log` to
`lib/testing/environment`, as it may prove generally useful.
The updates to `lib/format` from #107 make this function much shorter.
Also, the logic to check the file descriptors was sort of confused and
not really doing anything, at least not anything helpful, since the
decision to print or strip formatting codes is now made per log level
file descriptor in `@go.log`.
Seems a little easier to understand the message format this way, and
using `%b` in the `printf -v` statement seems less subtle than using it
in the `printf` that actually generates the output.
It occurred to me that `@go.log_command` should not try to only convert
unexpanded formatting code sequences if they exist in the output, but
should strip them out entirely whether they're expanded or not.
This also precipitated a refactor of `assert_log_equals` and its
implementation functions to handle the expanded code, which actually
simplified the logic a bit.

By the same token, it's no longer required that `format_log_label` be
called before other `lib/log` functions, as `__GO_LOG_LEVELS_FORMATTED`
will always contain expanded format codes and `@go.log` will strip them
out if need be.
@mbland mbland added this to the v1.3.0 milestone Jan 15, 2017
@mbland mbland self-assigned this Jan 15, 2017
@coveralls
Copy link

Coverage Status

Coverage increased (+0.3%) to 95.154% when pulling 7a24d78 on log-test-helpers-#40 into 4b562d9 on master.

@mbland mbland merged commit 0d5841b into master Jan 15, 2017
@mbland mbland deleted the log-test-helpers-#40 branch January 15, 2017 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants