tests/xbps/xbps-digest: create tests.
This commit is contained in:
parent
19f3e519fd
commit
9e812c2d7e
@ -11,3 +11,4 @@ include('xbps-query/Kyuafile')
|
||||
include('xbps-rindex/Kyuafile')
|
||||
include('xbps-uhelper/Kyuafile')
|
||||
include('xbps-remove/Kyuafile')
|
||||
include('xbps-digest/Kyuafile')
|
||||
|
@ -1,5 +1,5 @@
|
||||
-include ../../config.mk
|
||||
|
||||
SUBDIRS = common libxbps xbps-alternatives xbps-checkvers xbps-create xbps-install xbps-query xbps-rindex xbps-uhelper xbps-remove
|
||||
SUBDIRS = common libxbps xbps-alternatives xbps-checkvers xbps-create xbps-install xbps-query xbps-rindex xbps-uhelper xbps-remove xbps-digest
|
||||
|
||||
include ../../mk/subdir.mk
|
||||
|
4
tests/xbps/xbps-digest/Kyuafile
Normal file
4
tests/xbps/xbps-digest/Kyuafile
Normal file
@ -0,0 +1,4 @@
|
||||
syntax("kyuafile", 1)
|
||||
|
||||
test_suite("xbps-digest")
|
||||
atf_test_program{name="basic_test"}
|
8
tests/xbps/xbps-digest/Makefile
Normal file
8
tests/xbps/xbps-digest/Makefile
Normal file
@ -0,0 +1,8 @@
|
||||
TOPDIR = ../../..
|
||||
-include $(TOPDIR)/config.mk
|
||||
|
||||
TESTSHELL = basic_test
|
||||
TESTSSUBDIR = xbps/xbps-digest
|
||||
EXTRA_FILES = Kyuafile
|
||||
|
||||
include $(TOPDIR)/mk/test.mk
|
44
tests/xbps/xbps-digest/basic_test.sh
Normal file
44
tests/xbps/xbps-digest/basic_test.sh
Normal file
@ -0,0 +1,44 @@
|
||||
#! /usr/bin/env atf-sh
|
||||
# Test that xbps-digest(1) works as expected.
|
||||
|
||||
atf_test_case empty_string
|
||||
|
||||
empty_string_head() {
|
||||
atf_set "descr" "xbps-digest(1): check empty string hash"
|
||||
}
|
||||
|
||||
empty_string_body() {
|
||||
result="$(printf "" | xbps-digest)"
|
||||
expected=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
|
||||
rv=0
|
||||
if [ "$result" != "$expected" ]; then
|
||||
echo "result: $result"
|
||||
echo "expected: $expected"
|
||||
rv=1
|
||||
fi
|
||||
atf_check_equal $rv 0
|
||||
}
|
||||
|
||||
atf_test_case small_file
|
||||
|
||||
small_file_head() {
|
||||
atf_set "descr" "xbps-digest(1): check small file hash"
|
||||
}
|
||||
|
||||
small_file_body() {
|
||||
printf "abc\nbca" > file
|
||||
result="$(xbps-digest file)"
|
||||
expected="36749ea1445c9fcb405767cbf67ebb4679dd4f7560a3b5fa977bc288fe15f999"
|
||||
rv=0
|
||||
if [ "$result" != "$expected" ]; then
|
||||
echo "result: $result"
|
||||
echo "expected: $expected"
|
||||
rv=1
|
||||
fi
|
||||
atf_check_equal $rv 0
|
||||
}
|
||||
|
||||
atf_init_test_cases() {
|
||||
atf_add_test_case empty_string
|
||||
atf_add_test_case small_file
|
||||
}
|
Loading…
Reference in New Issue
Block a user