Sha256: 86e3256c19026a89e8ef9ec5627ec2a7b690dcfa1bff2738b8fa96d1209fcf94

Contents?: true

Size: 1.91 KB

Versions: 114

Compression:

Stored size: 1.91 KB

Contents

#!/usr/bin/env bash

# FORMAT

echo '-------------------------------------------------------'
echo "Checking Formatting"

if [ ! -f "bin/elm-format" ] || [[ ! $(bin/elm-format --help | grep "elm-format-0.18 0.6.1-alpha") ]]; then
  echo "Installing local copy of elm-format"
  bin/install-elm-format
fi

bin/elm-format --yes --validate exercises/**/*.example.elm  exercises/**/tests/Tests.elm

if [ $? -ne 0 ]; then
    echo "*******************************************************************"
    echo "*******************************************************************"
    echo "**                       elm-format failed                       **"
    echo "**        perhaps some of your changes are not formatted?        **"
    echo "**             Please run elm-format before pushing.             **"
    echo "*******************************************************************"
    echo "*******************************************************************"
    exit 1
else
  echo "Formatting looks good!"
fi

# TEST

declare -i TEST_RESULT=0
FAILED_EXERCISES=''

mkdir -p build/tests

for example_file in exercises/**/*.example.elm
do
  # clean up generated code from last run
  rm -rf build/tests/elm-stuff/generated-code/

  exercise_dir=$(dirname $example_file)
  exercise_name=$(basename $example_file .example.elm)
  cp "$exercise_dir/$exercise_name.example.elm" "build/$exercise_name.elm"
  cp "$exercise_dir/tests/elm-package.json" build/tests/
  cat "$exercise_dir/tests/Tests.elm" | sed 's/skip <|//g' > build/tests/Tests.elm

  echo '-------------------------------------------------------'
  echo "Testing $exercise_name"


  npm test -- build/tests/Tests.elm

  # capture result from last command (elm-test)
  if [ $? -ne 0 ]; then
      TEST_RESULT=1
      FAILED_EXERCISES+="$exercise_name\n"
  fi
done

if [ $TEST_RESULT -ne 0 ]; then
  echo "The following exercises failed"
  printf $FAILED_EXERCISES
  exit $TEST_RESULT
fi

Version data entries

114 entries across 114 versions & 1 rubygems

Version Path
trackler-2.2.1.44 tracks/elm/bin/build.sh
trackler-2.2.1.43 tracks/elm/bin/build.sh
trackler-2.2.1.42 tracks/elm/bin/build.sh
trackler-2.2.1.41 tracks/elm/bin/build.sh
trackler-2.2.1.40 tracks/elm/bin/build.sh
trackler-2.2.1.39 tracks/elm/bin/build.sh
trackler-2.2.1.38 tracks/elm/bin/build.sh
trackler-2.2.1.37 tracks/elm/bin/build.sh
trackler-2.2.1.36 tracks/elm/bin/build.sh
trackler-2.2.1.35 tracks/elm/bin/build.sh
trackler-2.2.1.34 tracks/elm/bin/build.sh
trackler-2.2.1.33 tracks/elm/bin/build.sh
trackler-2.2.1.32 tracks/elm/bin/build.sh
trackler-2.2.1.31 tracks/elm/bin/build.sh
trackler-2.2.1.30 tracks/elm/bin/build.sh
trackler-2.2.1.29 tracks/elm/bin/build.sh
trackler-2.2.1.28 tracks/elm/bin/build.sh
trackler-2.2.1.27 tracks/elm/bin/build.sh
trackler-2.2.1.26 tracks/elm/bin/build.sh
trackler-2.2.1.25 tracks/elm/bin/build.sh