Commit 3d25e2d3 authored by Vitaly Lipatov's avatar Vitaly Lipatov

improve test for eget, add check for globbing

parent 187dff80
......@@ -3,6 +3,11 @@
#EGET="bash -x /srv/danil/Projects/eget/eget"
EGET="$(pwd)/../eget"
check()
{
[ "$2" != "$3" ] && echo "FATAL with '$1': result '$3' do not match with '$2'" || echo "OK for '$1' with '$2'"
}
test_download(){
local URL="$1"
#echo "Download $URL"
......@@ -37,7 +42,18 @@ test_download ftp:$UPATH/test01.txt test01.txt
test_download http:$UPATH/test01.txt test01.txt
test_download ftp:$UPATH/* test01.txt test02.txt
test_download http:$UPATH/* test01.txt test02.txt
test_download http:$UPATH/ test01.txt test02.txt
#echo "List: from http:$UPATH/*"
#$EGET --list http:$UPATH/*
L1=$($EGET --list http:$UPATH/*)
L2="test01.txt
test02.txt
test03.txt"
check "http:$UPATH/*" "$L1" "$L2"
#test_download http:$UPATH/ test01.txt test02.txt
#test_download http://updates.etersoft.ru/pub/people/danil/eget_test2/vm-profile.scm
#test_download http://updates.etersoft.ru/pub/people/danil/eget_test2/ #Download index file like a wget #FAIL norm - file name index
#test_download ftp://updates.etersoft.ru/pub/people/danil/eget_test2/ #FAIL norm - file name index
......
#!/bin/sh
check()
{
[ "$2" != "$3" ] && echo "FATAL with '$1': result '$3' do not match with '$2'" || echo "OK for '$1' with '$2'"
}
# check man glob
filter_glob()
{
grep "^$(echo "$1" | sed -e "s|\*|.*|g" -e "s|\?|.|g")$"
}
test_glob()
{
local R1=$(ls -1 | filter_glob "$1")
local R2=$(ls $1)
check "$1" "$R1" "$R2"
}
L=$(mktemp -d)
cd "$L" || exit
touch testA.txt
touch test0.txt
touch test1.txt
touch test2.txt
touch est2.txt
touch test2.tx
ls -l
test_glob "est?.txt"
test_glob "test?.txt"
test_glob "test?.tx"
#test_glob "test.*"
test_glob "test*.txt"
test_glob "*1.txt"
rm -rf "$L"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment