mirror of
https://git.sr.ht/~cismonx/bookmarkfs
synced 2025-06-07 19:58:50 +00:00
test: add tests for tags and keywords
This commit is contained in:
parent
495f8592e6
commit
c1cf9db2a1
3 changed files with 77 additions and 1 deletions
|
@ -9,7 +9,7 @@
|
|||
EXTRA_DIST = package.m4 testsuite.at $(TESTSUITE) $(TESTS_)
|
||||
|
||||
TESTS_ = lib_hash.at lib_prng.at lib_watcher.at lib_sandbox.at \
|
||||
lib_hashmap.at fs_basic.at fs_regrw.at fs_dents.at
|
||||
lib_hashmap.at fs_basic.at fs_regrw.at fs_dents.at fs_assoc.at
|
||||
|
||||
# Helper programs for testing
|
||||
|
||||
|
|
64
tests/fs_assoc.at
Normal file
64
tests/fs_assoc.at
Normal file
|
@ -0,0 +1,64 @@
|
|||
dnl
|
||||
dnl Copyright (C) 2025 CismonX <admin@cismon.net>
|
||||
dnl
|
||||
dnl Copying and distribution of this file, with or without modification,
|
||||
dnl are permitted in any medium without royalty,
|
||||
dnl provided the copyright notice and this notice are preserved.
|
||||
dnl This file is offered as-is, without any warranty.
|
||||
dnl
|
||||
|
||||
AT_SETUP([fs: tags and keywords])
|
||||
AT_KEYWORDS([fs assoc tag keyword])
|
||||
|
||||
ATX_CHECK_FS_NEW_ASSOC([eol], , [
|
||||
ATX_RUN_REPEAT([8], [
|
||||
name=$(ath_fn_rand_u64_hex)
|
||||
tag=$(ath_fn_rand_u64_hex)
|
||||
keyword=$(ath_fn_rand_u64_hex)
|
||||
content=foo:$(ath_fn_rand_u64_hex)
|
||||
|
||||
ATX_RUN([
|
||||
echo "$content/1" > $name-1
|
||||
echo "$content/2" > $name-2
|
||||
echo "$content/3" > $name-3
|
||||
mkdir "$atx_tags/$tag-1" "$atx_tags/$tag-2" "$atx_tags/$tag-3"
|
||||
|
||||
ln $name-1 $name-2 "$atx_tags/$tag-1"
|
||||
ln $name-2 $name-3 "$atx_tags/$tag-2"
|
||||
ln $name-3 $name-1 "$atx_tags/$tag-3"
|
||||
test $name-1 -ef "$atx_tags/$tag-1/$name-1"
|
||||
test $name-1 -ef "$atx_tags/$tag-3/$name-1"
|
||||
test $name-2 -ef "$atx_tags/$tag-1/$name-2"
|
||||
test $name-2 -ef "$atx_tags/$tag-2/$name-2"
|
||||
test $name-3 -ef "$atx_tags/$tag-3/$name-3"
|
||||
test $name-3 -ef "$atx_tags/$tag-2/$name-3"
|
||||
|
||||
ln $name-1 "$atx_keywords/$keyword-2"
|
||||
ln $name-2 "$atx_keywords/$keyword-3"
|
||||
ln $name-3 "$atx_keywords/$keyword-1"
|
||||
test $name-1 -ef "$atx_keywords/$keyword-2"
|
||||
test $name-2 -ef "$atx_keywords/$keyword-3"
|
||||
test $name-3 -ef "$atx_keywords/$keyword-1"
|
||||
|
||||
rm "$atx_tags/$tag-1/$name-1"
|
||||
rm "$atx_tags/$tag-2/$name-2"
|
||||
rm "$atx_tags/$tag-3/$name-3"
|
||||
test ! -e "$atx_tags/$tag-1/$name-1"
|
||||
test ! -e "$atx_tags/$tag-2/$name-2"
|
||||
test ! -e "$atx_tags/$tag-3/$name-3"
|
||||
|
||||
rm "$atx_keywords/$keyword-1"
|
||||
rm "$atx_keywords/$keyword-2"
|
||||
test ! -e "$atx_keywords/$keyword-1"
|
||||
test ! -e "$atx_keywords/$keyword-2"
|
||||
|
||||
rm $name-1 $name-2 $name-3
|
||||
test ! -e "$atx_tags/$tag-1/$name-2"
|
||||
test ! -e "$atx_tags/$tag-2/$name-3"
|
||||
test ! -e "$atx_tags/$tag-3/$name-1"
|
||||
test ! -e "$atx_keywords/$keyword-3"
|
||||
])
|
||||
])
|
||||
])
|
||||
|
||||
AT_CLEANUP
|
|
@ -174,6 +174,17 @@ m4_define([ATX_CHECK_FS_NEW_ANY], [
|
|||
])
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl ATX_CHECK_FS_NEW_ASSOC([options], [prepare], [check])
|
||||
dnl
|
||||
m4_define([ATX_CHECK_FS_NEW_ASSOC], [
|
||||
ATX_CHECK_FS_NEW([firefox], [$1], [mnt.tmp], [$2], [
|
||||
atx_tags=../../tags
|
||||
atx_keywords=../../keywords
|
||||
ATX_RUN_IN_DIR([mnt.tmp/bookmarks/unfiled], [$3])
|
||||
])
|
||||
])
|
||||
|
||||
dnl -- Helper functions --
|
||||
|
||||
AT_TEST_HELPER_FN([rand_u64_hex], , , [
|
||||
|
@ -208,3 +219,4 @@ AT_BANNER([The Filesystem])
|
|||
m4_include([fs_basic.at])
|
||||
m4_include([fs_regrw.at])
|
||||
m4_include([fs_dents.at])
|
||||
m4_include([fs_assoc.at])
|
||||
|
|
Loading…
Add table
Reference in a new issue