Skip to content

Instantly share code, notes, and snippets.

@beccasaurus
Last active September 30, 2019 12:00
Show Gist options
  • Save beccasaurus/22d7842d3cbf36643a0c946b06083904 to your computer and use it in GitHub Desktop.
Save beccasaurus/22d7842d3cbf36643a0c946b06083904 to your computer and use it in GitHub Desktop.
sample-tester avec la couleur
sample_tester() {
echo "Running: sample-tester -v detailed $*"
# Escape sequene
local esc=$(printf '\033')
sample-tester -v detailed "$@" 2>&1 | \
sed "s/Tests failed/${esc}[31mTests failed${esc}[0m/g" | \
sed "s/Tests passed/${esc}[32mTests passed${esc}[0m/g" | \
sed "s/# ... call did not succeed \(.*\)/${esc}[90m# ${esc}[31m\`call:\` failed: \1${esc}[0m/g" | \
sed "s/# Calling: \(.*\)/${esc}[33m=> ${esc}[0m${esc}[1;33m\$${esc}[0m ${esc}[33m\1${esc}[0m/g" | \
sed "s/FAILED\(.*\)/${esc}[31mFAILED\1${esc}[0m/g" | \
sed "s/PASSED\(.*\)/${esc}[32mPASSED\1${esc}[0m/g" | \
sed "s/SKIPPED\(.*\)/${esc}[90mSKIPPED\1${esc}[0m/g" | \
sed "s/RUNNING\(.*\)/${esc}[34mRUNNING\1${esc}[0m/g" | \
sed "s/### Test case TEARDOWN/${esc}[96mtearDown()${esc}[0m/g" | \
sed "s/### Test case SETUP/${esc}[96msetUp()${esc}[0m/g" | \
sed "s/### Test case TEST/${esc}[96mtestCase()${esc}[0m/g"
printf "$output"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment