<commit_before>#!/usr/bin/env bash
#
# Copyright (c) 2015 GemTalk Systems, LLC. All Rights Reserved <<EMAIL>>.
#

set -x  # print commands

# the exit status should be 1 for all error conditions
#   the error message should either be 
#     "The appropriate install script has not been run..."
#     "The stone travis2 does not exist..."
#     "Perhaps a stone has not been created..."
#     "the GsDevKit_server project has not bee installed..."
#     "The reqewst client: tode1 does not exist"
run_test() {
  local status

  bash -c "$1" &> /tmp/gsDevKit_test
  status=$?
  cat /tmp/gsDevKit_test | grep "Error on or near line"
  if [ "$?" -ne 1 ] ; then
    # should not get an 'Error on or near line' during these tests
    cat /tmp/gsDevKit_test
    echo "Unexpected unhandled error"
    exit 1
  fi
  cat /tmp/gsDevKit_test
  test_exit_status $status
}

test_exit_status() {
  local ansi_red="\033[91;1m"
  local ansi_reset="\033[0m"

  status="$1"
  if [ "$status" -ne 1 ] ;  then
    printf "${ansi_red}Unexpected exit status (%s)${ansi_reset}\n" "$status"
    exit 1
  fi
}
# test that these commands fail gracefully if installServer has not been run yet
set +e
run_test "createStone ${STONENAME2} $GS_VERSION"
run_test "createClient tode"
run_test "devKitCommandLine --list"
run_test "devKitCommandLine --list"
run_test "$GS_HOME/bin/status"
run_test "startStatmonitor ${STONENAME2}"
run_test "startStone ${STONENAME2}"
run_test "startNetldi ${STONENAME2}"
run_test "stopStone ${STONENAME2}"
run_test "updateGsDevKit"
run_test "newExtent ${STONENAME2}"
run_test "stopNetldi ${STONENAME2}"<commit_msg>#95 detecting unexpected errors, now need way to expect the unexpected<commit_after>#!/usr/bin/env bash
#
# Copyright (c) 2015 GemTalk Systems, LLC. All Rights Reserved <<EMAIL>>.
#

set -x  # print commands

# the exit status should be 1 for all error conditions
#   the error message should either be 
#     "The appropriate install script has not been run..."
#     "The stone travis2 does not exist..."
#     "Perhaps a stone has not been created..."
#     "the GsDevKit_server project has not bee installed..."
#     "The reqewst client: tode1 does not exist"
run_test() {
  local status

  bash -c "$1" &> /tmp/gsDevKit_test
  status=$?
  cat /tmp/gsDevKit_test | grep "Error on or near line"
  if [ "$?" -ne 1 ] ; then
    # should not get an 'Error on or near line' during these tests
    cat /tmp/gsDevKit_test
    echo "Unexpected unhandled error"
    exit 1
  fi
  cat /tmp/gsDevKit_test
  test_exit_status $status
}

run_simple_test() {
  $1
  test_exit_status $?
}

test_exit_status() {
  local ansi_red="\033[91;1m"
  local ansi_reset="\033[0m"

  status="$1"
  if [ "$status" -ne 1 ] ;  then
    printf "${ansi_red}Unexpected exit status (%s)${ansi_reset}\n" "$status"
    exit 1
  fi
}
# test that these commands fail gracefully if installServer has not been run yet
set +e
run_test "createStone ${STONENAME2} $GS_VERSION"
run_test "createClient tode"
run_simple_test "devKitCommandLine --list"
run_test "$GS_HOME/bin/status"
run_test "startStatmonitor ${STONENAME2}"
run_test "startStone ${STONENAME2}"
run_test "startNetldi ${STONENAME2}"
run_test "stopStone ${STONENAME2}"
run_test "updateGsDevKit"
run_test "newExtent ${STONENAME2}"
run_test "stopNetldi ${STONENAME2}"
{'fraction_non_alphanumeric': 0.11431170406306852, 'fraction_numerical': 0.01910248635536689, 'mean_word_length': 3.9460269865067468, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '5680095', 'n_tokens_mistral': 1199, 'n_tokens_neox': 1124, 'n_words': 373}