diff --git a/dotnet/tcr b/dotnet/tcr new file mode 100644 index 0000000..518a515 --- /dev/null +++ b/dotnet/tcr @@ -0,0 +1,26 @@ +#!/bin/bash + +set -o nounset + +test_code() { + dotnet test +} + +main() { + test_code + + if [[ $? -eq 0 ]]; then + git add . && git commit -m "$1" + echo "Go ahead!" + else + echo "Tests failed, reverting..." + git reset --hard + fi +} + +if [[ $# -ne 1 ]]; then + echo "Usage: tcr \"commit message\"" + exit 1 +fi + +main "$1" \ No newline at end of file diff --git a/dotnet/tdd b/dotnet/tdd new file mode 100644 index 0000000..aea3da5 --- /dev/null +++ b/dotnet/tdd @@ -0,0 +1,25 @@ +#!/bin/bash + +set -o nounset + +test_code() { + dotnet test +} + +main() { + test_code + + if [[ $? -eq 0 ]]; then + git add . && git commit -m "$1" + echo "Go ahead!" + else + echo "Tests failed" + fi +} + +if [[ $# -ne 1 ]]; then + echo "Usage: tdd \"commit message\"" + exit 1 +fi + +main "$1" \ No newline at end of file