mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2025-01-11 17:38:47 +00:00
create and use compare_sorted test
This commit is contained in:
parent
d70656db68
commit
de21079d2f
@ -11,7 +11,7 @@
|
||||
# This file is public domain in the USA and all free countries.
|
||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||
#
|
||||
#### $$VERSION$$ v0.96-pre-31-ge64d066
|
||||
#### $$VERSION$$ v0.96-pre-32-gd70656d
|
||||
#
|
||||
# Exit Codes:
|
||||
# - 0 sucess (hopefully)
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#### $$VERSION$$ v0.96-dev3-0-gdddd1ce
|
||||
#### $$VERSION$$ v0.96-pre-32-gd70656d
|
||||
|
||||
# common variables
|
||||
export TESTME DIRME TESTDIR LOGFILE REFDIR TESTNAME
|
||||
@ -49,6 +49,15 @@ print_array() {
|
||||
}
|
||||
|
||||
|
||||
compare_sorted() {
|
||||
local ret=0
|
||||
sort -d -o "${1}.sort" "${1}"
|
||||
sort -d -o "${2}.sort" "${2}"
|
||||
diff -c "${1}.sort" "${2}.sort" || ret=1
|
||||
rm -f "${1}.sort" "${2}.sort"
|
||||
return "$ret"
|
||||
}
|
||||
|
||||
######
|
||||
# lets go ...
|
||||
echo "Running ${TESTNAME#? } ..."
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#### $$VERSION$$ v0.96-pre-31-ge64d066
|
||||
#### $$VERSION$$ v0.96-pre-32-gd70656d
|
||||
|
||||
# include common functions and definitions
|
||||
# shellcheck source=test/ALL-tests.inc.sh
|
||||
@ -37,9 +37,7 @@ do
|
||||
|
||||
# output processed input
|
||||
print_array "iQUERY" >"${OUTPUTFILE}"
|
||||
sort -d -o "${OUTPUTFILE}.sort" "${OUTPUTFILE}"
|
||||
sort -d -o "${REFFILE}.sort" "${REFFILE}"
|
||||
diff -c "${REFFILE}.sort" "${OUTPUTFILE}.sort" || exit 1
|
||||
compare_sorted "${REFFILE}" "${OUTPUTFILE}" || exit 1
|
||||
echo "${SUCCESS}"
|
||||
done
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
iQUERY: 0 message
|
||||
iQUERY: FIRST_NAME Kay
|
||||
iQUERY: LAST_NAME M
|
||||
iQUERY: USER_ID 123456789
|
||||
iQUERY: USERNAME Gnadelwartz
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#### $$VERSION$$ v0.96-pre-31-ge64d066
|
||||
#### $$VERSION$$ v0.96-pre-32-gd70656d
|
||||
|
||||
# include common functions and definitions
|
||||
# shellcheck source=test/ALL-tests.inc.sh
|
||||
@ -35,9 +35,7 @@ CHAT[ID]="123456789"
|
||||
|
||||
# output processed input
|
||||
print_array "USER" "CHAT" "REPLYTO" "FORWARD" "URLS" "CONTACT" "CAPTION" "LOCATION" "MESSAGE" "VENUE" "SERVICE">"${OUTPUTFILE}"
|
||||
sort -d -o "${OUTPUTFILE}.sort" "${OUTPUTFILE}"
|
||||
sort -d -o "${REFFILE}.sort" "${REFFILE}"
|
||||
diff -c "${REFFILE}.sort" "${OUTPUTFILE}.sort" || exit 1
|
||||
compare_sorted "${REFFILE}" "${OUTPUTFILE}" || exit 1
|
||||
echo "${SUCCESS}"
|
||||
|
||||
cd "${DIRME}" || exit 1
|
||||
|
@ -1,50 +0,0 @@
|
||||
CAPTION: 0
|
||||
CHAT: ALL_ADMIN
|
||||
CHAT: ALL_MEMBERS_ARE_ADMINISTRATORS
|
||||
CHAT: FIRST_NAME Test
|
||||
CHAT: ID 123456789
|
||||
CHAT: LAST_NAME Bot
|
||||
CHAT: TITLE BotTestTitle
|
||||
CHAT: TYPE private
|
||||
CHAT: USERNAME BotTest
|
||||
CONTACT: FIRST_NAME ADAC
|
||||
CONTACT: LAST_NAME Pannenhilfe
|
||||
CONTACT: NUMBER 222222
|
||||
CONTACT: USER_ID
|
||||
CONTACT: VCARD BEGIN:VCARD\nVERSION:2.1\nN:Pannenhilfe;ADAC;;;\nFN:ADAC Pannenhilfe\nTEL;CELL;PREF:+49179222222\nTEL;X-Mobil:222222\nEND:VCARD
|
||||
FORWARD: FIRST_NAME Kay
|
||||
FORWARD: ID 6541
|
||||
FORWARD: LAST_NAME M
|
||||
FORWARD: UID 123456789
|
||||
FORWARD: USERNAME Gnadelwartz
|
||||
LOCATION: LATITUDE 49.631824
|
||||
LOCATION: LONGITUDE 8.377072
|
||||
MESSAGE: 0 😂😝👌☺❤😕😈#⃣🌏🎉🙊🙉☕🚀✈🚂💯✔〽🔚
|
||||
MESSAGE: ID 6541
|
||||
REPLYTO: 0 Ich bin der Deal-O-Mat Bot. Für eine Liste der Befehle sende /help
|
||||
REPLYTO: FIRST_NAME dealzbot
|
||||
REPLYTO: ID 6542
|
||||
REPLYTO: LAST_NAME
|
||||
REPLYTO: UID 987654321
|
||||
REPLYTO: USERNAME Deal_O_Mat_bot
|
||||
SERVICE: 0 yes
|
||||
SERVICE: LEFTMEMBER 123456789
|
||||
SERVICE: NEWMEMBER 123456789
|
||||
SERVICE: NEWPHOTO
|
||||
SERVICE: NEWTILE
|
||||
SERVICE: PINNED
|
||||
URLS: AUDIO audio-AgADAgADL6oxG-Gw4EndCWGl2WUfUo1pXw8ABOusSilDGzAYa
|
||||
URLS: DOCUMENT document-AgADAgADL6oxG-Gw4EndCWGl2WUfUo1pXw8ABOusSilDGzAYa
|
||||
URLS: PHOTO photo-AgADAgADL6oxG-Gw4EndCWGl2WUfUo1pXw8ABOusSilDGzAYa
|
||||
URLS: STICKER sticker-AgADAgADL6oxG-Gw4EndCWGl2WUfUo1pXw8ABOusSilDGzAYa
|
||||
URLS: VIDEO video-AgADAgADL6oxG-Gw4EndCWGl2WUfUo1pXw8ABOusSilDGzAYa
|
||||
URLS: VOICE voice-AgADAgADL6oxG-Gw4EndCWGl2WUfUo1pXw8ABOusSilDGzAYa
|
||||
USER: FIRST_NAME Kay
|
||||
USER: ID 123456789
|
||||
USER: LAST_NAME M
|
||||
USER: USERNAME Gnadelwartz
|
||||
VENUE: ADDRESS Am Rhein 1
|
||||
VENUE: FOURSQUARE 4c4321afce54e21eee980d1a
|
||||
VENUE: LATITUDE 49.631824
|
||||
VENUE: LONGITUDE 8.377072
|
||||
VENUE: TITLE Kolb's Biergarten
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#### $$VERSION$$ v0.96-dev3-1-g2a66ee9
|
||||
#### $$VERSION$$ v0.96-pre-32-gd70656d
|
||||
|
||||
# include common functions and definitions
|
||||
# shellcheck source=test/ALL-tests.inc.sh
|
||||
@ -54,10 +54,7 @@ done < "${INPUTFILE}" 2>>"${LOGFILE}"
|
||||
|
||||
echo " done."
|
||||
|
||||
sort -d -o "${OUTPUTFILE}.sort" "${OUTPUTFILE}"
|
||||
sort -d -o "${REFFILE}.sort" "${REFFILE}"
|
||||
|
||||
{ diff -c "${REFFILE}.sort" "${OUTPUTFILE}.sort" || exit 1; } | cat -v
|
||||
{ compare_sorted "${REFFILE}" "${OUTPUTFILE}" || exit 1; } | cat -v
|
||||
rm -f "${REFFILE}.sort"
|
||||
|
||||
echo " ... all \"send_message\" functions seems to work as expected."
|
||||
|
Loading…
Reference in New Issue
Block a user