#!/bin/sh

black --check js_nullcheck/*.py

if [ $? -ne 0 ]; then
    black js_nullcheck/*.py
    git add js_nullcheck/*.py
fi

black --check tests/*.py

if [ $? -ne 0 ]; then
    black tests/*.py
    git add tests/*.py
fi

python3 -m unittest tests/tests.py

if [ $? -ne 0 ]; then
    echo "unit tests failed!"
    exit 1
fi

mypy js_nullcheck

if [ $? -ne 0 ]; then
    echo "mypy failed!"
    exit 1
fi

