<commit_before>#!/bin/bash

# intended to be executed from base of repo

FAILED_TO_FAIL=0

ARTIFACT_DIR="${OUTPUT_DIR:-$CIRCLE_ARTIFACTS}"
ARTIFACT_DIR="${OUTPUT_DIR:-test/artifacts}"
OUTPUT_DIR="$ARTIFACT_DIR/fail_checks"
rm -rf "$OUTPUT_DIR"
mkdir -p "$OUTPUT_DIR"

for FAIL_SRC in test/failure_examples/*; do
  FAIL_NAME="$(basename "$FAIL_SRC")"
  SRC_PATH="$FAIL_SRC" bats test 2>"$OUTPUT_DIR/$FAIL_NAME.err" >"$OUTPUT_DIR/$FAIL_NAME.out"
  if [ $? -eq 0 ] ; then
    FAILED_TO_FAIL=1
    echo "ERROR: $FAIL_NAME did not cause a test failure"
  else
    echo "$FAIL_NAME fails tests, as expected"
  fi
done

exit $FAILED_TO_FAIL
<commit_msg>colorful output on ensure_failures<commit_after>#!/bin/bash

# intended to be executed from base of repo

FAILED_TO_FAIL=0

ARTIFACT_DIR="${OUTPUT_DIR:-$CIRCLE_ARTIFACTS}"
ARTIFACT_DIR="${OUTPUT_DIR:-test/artifacts}"
OUTPUT_DIR="$ARTIFACT_DIR/fail_checks"
rm -rf "$OUTPUT_DIR"
mkdir -p "$OUTPUT_DIR"

for FAIL_SRC in test/failure_examples/*; do
  FAIL_NAME="$(basename "$FAIL_SRC")"
  SRC_PATH="$FAIL_SRC" bats test 2>"$OUTPUT_DIR/$FAIL_NAME.err" >"$OUTPUT_DIR/$FAIL_NAME.out"
  if [ $? -eq 0 ] ; then
    FAILED_TO_FAIL=1
    printf "\033[0;31mERROR: $FAIL_NAME did not cause a test failure\n"
  else
    printf "\033[0;32m$FAIL_NAME fails tests, as expected\n"
  fi
done

exit $FAILED_TO_FAIL

{'fraction_non_alphanumeric': 0.13571961222967935, 'fraction_numerical': 0.014914243102162566, 'mean_word_length': 5.271028037383178, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5919215', 'n_tokens_mistral': 545, 'n_tokens_neox': 510, 'n_words': 115}