Last active
April 8, 2018 08:20
-
-
Save stvhwrd/c8f90171d61fc4b523c6b435354960b6 to your computer and use it in GitHub Desktop.
Super basic test scripts for modifications to Homebrew's `brew search`. Run from directory as `./test-setup.sh && ./test-search.sh`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
ORIGINAL="Homebrew-brew" | |
MY_FORK="stvhwrd-brew" | |
# --------------------------------Setup------------------------------------ # | |
rm -rf /tmp/${MY_FORK}.txt && \ | |
rm -rf /tmp/${MY_FORK} && \ | |
git clone https://github.com/SENG480-18/brew.git /tmp/${MY_FORK} | |
/tmp/${MY_FORK}/bin/brew tap homebrew/core | |
rm -rf /tmp/${ORIGINAL}.txt && \ | |
rm -rf /tmp/${ORIGINAL} && \ | |
git clone https://github.com/Homebrew/brew.git /tmp/${ORIGINAL} | |
/tmp/${ORIGINAL}/bin/brew tap homebrew/core |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
ORIGINAL="Homebrew-brew" | |
MY_FORK="stvhwrd-brew" | |
# ------------------------------ Testing ----------------------------------- # | |
echo | |
echo "==> Testing five POPULAR packages:" | |
array=(node git python wget yarn) | |
for i in "${array[@]}" | |
do | |
echo "$i..." | |
/tmp/${MY_FORK}/bin/brew search "$i" >>/tmp/${MY_FORK}.txt 2>&1 | |
/tmp/${ORIGINAL}/bin/brew search "$i" >>/tmp/${ORIGINAL}.txt 2>&1 | |
done | |
echo | |
echo "==> Testing five RANDOM packages:" | |
array=(gobject-introspection sdl2_mixer libtiff exercism xhyve) | |
for i in "${array[@]}" | |
do | |
echo "$i..." | |
/tmp/${MY_FORK}/bin/brew search "$i" >>/tmp/${MY_FORK}.txt 2>&1 | |
/tmp/${ORIGINAL}/bin/brew search "$i" >>/tmp/${ORIGINAL}.txt 2>&1 | |
done | |
echo | |
echo "==> Testing five NONEXISTENT packages:" | |
array=(nozxzde gzxzit pytzxzhon wgzxzet yazxzrn) | |
for i in "${array[@]}" | |
do | |
echo "$i..." | |
/tmp/${MY_FORK}/bin/brew search "$i" >>/tmp/${MY_FORK}.txt 2>&1 | |
/tmp/${ORIGINAL}/bin/brew search "$i" >>/tmp/${ORIGINAL}.txt 2>&1 | |
done | |
# ----------------------------- Verification ------------------------------- # | |
if diff -q /tmp/${ORIGINAL}.txt /tmp/${MY_FORK}.txt | |
then | |
echo | |
echo "✅ -- PASS -- output identical." | |
exit 0 | |
else | |
echo | |
echo "❌ -- FAIL -- output differs." | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment