aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMenny Even Danan <menny@evendanan.net>2020-02-26 18:47:13 +0000
committerMenny Even Danan <menny@evendanan.net>2020-02-26 20:56:23 +0000
commit870cb389c8e3d116eab9cd03d096efb034565eee (patch)
treed5080b3f34aa036800fbeed41284c600666daa6e /scripts
parent834f60360dca737714d6977db8032e1e8ed34255 (diff)
downloadAnySoftKeyboard-870cb389c8e3d116eab9cd03d096efb034565eee.tar.gz
AnySoftKeyboard-870cb389c8e3d116eab9cd03d096efb034565eee.tar.bz2
Support pre-release version tools
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/verify-third-party-update-greps.sh40
1 files changed, 40 insertions, 0 deletions
diff --git a/scripts/verify-third-party-update-greps.sh b/scripts/verify-third-party-update-greps.sh
new file mode 100755
index 000000000..29d5667a7
--- /dev/null
+++ b/scripts/verify-third-party-update-greps.sh
@@ -0,0 +1,40 @@
+#!/usr/bin/env bash
+GREP_VERSION_CLASSES="$1"
+
+TESTS=0
+PASSED=0
+function testRegex {
+ local text="$1"
+ local expected="$2"
+ local actual
+ actual=$(echo "$text" | grep -o "${GREP_VERSION_CLASSES}")
+ TESTS=$((TESTS+1))
+ if [[ "${actual}" == "${expected}" ]]; then
+ echo "'${text}' passed."
+ PASSED=$((PASSED+1))
+ else
+ echo "'${text}' failed! expected '${expected}' but was '${actual}'"
+ fi
+}
+
+echo "Testing grep regex '${GREP_VERSION_CLASSES}':"
+testRegex "1.2.3" "1.2.3"
+testRegex "1.12" "1.12"
+testRegex "11.2" "11.2"
+testRegex "1.2.32" "1.2.32"
+testRegex "1.22.2" "1.22.2"
+testRegex "11.2.4" "11.2.4"
+testRegex "13.12.2" "13.12.2"
+testRegex "1.2-rc3" "1.2-rc3"
+testRegex "1.2.1-rc3" "1.2.1-rc3"
+testRegex "1.2.1-beta" "1.2.1-beta"
+testRegex "1.2-beta" "1.2-beta"
+testRegex " 1.2.32 " "1.2.32"
+testRegex ":1.22.2" "1.22.2"
+testRegex "11.2.4 " "11.2.4"
+testRegex "v13.12.2" "13.12.2"
+
+echo "${PASSED} tests passed out of ${TESTS}."
+if [[ "$PASSED" != "$TESTS" ]]; then
+ exit 1
+fi