From bf8ec43b7538e3b9906f6adcb3d2297b016b8feb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1aki?= Date: Sun, 8 Nov 2020 13:21:11 +0100 Subject: [PATCH] =?UTF-8?q?A=C3=B1adido=20dotnet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dotnet/tcr | 26 ++++++++++++++++++++++++++ dotnet/tdd | 25 +++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 dotnet/tcr create mode 100644 dotnet/tdd 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