<commit_before>#!/bin/sh

. ${BUILDPACK_TEST_RUNNER_HOME}/lib/test_utils.sh

testCaching()
{
  cache_dir=$(sed '/^\#/d' ${BUILDPACK_TEST_RUNNER_HOME}/lib/magic_curl/conf/cache.conf | grep 'cache_dir'  | tail -n 1 | cut -d "=" -f2-)
  url="http://repo1.maven.org/maven2/com/force/api/force-wsc/23.0.0/force-wsc-23.0.0.jar"
  cached_file="${cache_dir}/repo1.maven.org/maven2/com/force/api/force-wsc/23.0.0/force-wsc-23.0.0.jar"
  local_file=${OUTPUT_DIR}/the.jar

  rm ${cached_file} &>/dev/null
  assertFalse "[ -f ${cached_file} ]"

  capture ${BUILDPACK_TEST_RUNNER_HOME}/lib/magic_curl/bin/curl ${url}
  
  assertTrue "[ -f ${cached_file} ]"
  assertFileMD5 "57e2997c35da552ede220f118d1fa941" ${cached_file}
  assertFileMD5 "57e2997c35da552ede220f118d1fa941" ${STD_OUT}
}
<commit_msg>only remove file if it exists<commit_after>#!/bin/sh

. ${BUILDPACK_TEST_RUNNER_HOME}/lib/test_utils.sh

testCaching()
{
  cache_dir=$(sed '/^\#/d' ${BUILDPACK_TEST_RUNNER_HOME}/lib/magic_curl/conf/cache.conf | grep 'cache_dir'  | tail -n 1 | cut -d "=" -f2-)
  url="http://repo1.maven.org/maven2/com/force/api/force-wsc/23.0.0/force-wsc-23.0.0.jar"
  cached_file="${cache_dir}/repo1.maven.org/maven2/com/force/api/force-wsc/23.0.0/force-wsc-23.0.0.jar"
  local_file=${OUTPUT_DIR}/the.jar

  if [ -f ${cached_file} ]; then
    rm ${cached_file}
  fi
  assertFalse "[ -f ${cached_file} ]"

  capture ${BUILDPACK_TEST_RUNNER_HOME}/lib/magic_curl/bin/curl ${url}
  
  assertTrue "[ -f ${cached_file} ]"
  assertFileMD5 "57e2997c35da552ede220f118d1fa941" ${cached_file}
  assertFileMD5 "57e2997c35da552ede220f118d1fa941" ${STD_OUT}
}

{'fraction_non_alphanumeric': 0.1813118811881188, 'fraction_numerical': 0.08168316831683169, 'mean_word_length': 4.48135593220339, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '4299677', 'n_tokens_mistral': 791, 'n_tokens_neox': 706, 'n_words': 79}