diff options
author | Bryan Drewery <bryan@shatow.net> | 2016-06-23 02:24:41 +0300 |
---|---|---|
committer | Bryan Drewery <bryan@shatow.net> | 2017-02-22 09:46:44 +0300 |
commit | 8f6b68c6fe89fc4c42eaaf21e61515da63a54057 (patch) | |
tree | f904d56d7a1a4517eaa10423f4b3cc4ab7acda48 /test/shash_basic.sh | |
parent | 4724e0b881bf304231f327769c53ecffeaedd33b (diff) |
Add a "shared hash" that uses files on the system for KV storage
This is intended to replace the current pkgname/origin caching
mechanisms.
Diffstat (limited to 'test/shash_basic.sh')
-rw-r--r-- | test/shash_basic.sh | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/shash_basic.sh b/test/shash_basic.sh new file mode 100644 index 00000000..b4bc9203 --- /dev/null +++ b/test/shash_basic.sh @@ -0,0 +1,25 @@ +#! /bin/sh + +. $(realpath $(dirname $0))/common.sh +. ${SCRIPTPREFIX}/include/util.sh +. ${SCRIPTPREFIX}/include/hash.sh +. ${SCRIPTPREFIX}/include/shared_hash.sh + +MASTERMNT=$(mktemp -d) + +echo "Working on ${MASTERMNT}" +mkdir -p "${MASTERMNT}/.p/var/cache/" +assert_ret 1 shash_remove pkgname-origin "pkg-1.7" value +assert_ret 0 shash_unset pkgname-origin "pkg-1.7" +assert_ret 1 shash_get pkgname-origin "pkg-1.7" value +assert_ret 0 shash_set pkgname-origin "pkg-1.7" "ports-mgmt/pkg" +assert_ret 0 shash_get pkgname-origin "pkg-1.7" value +assert "ports-mgmt/pkg" "${value}" "Removed value should match" +value= +assert_ret 0 shash_remove pkgname-origin "pkg-1.7" value +assert "ports-mgmt/pkg" "${value}" "Removed value should match" +value= +assert_ret 1 shash_get pkgname-origin "pkg-1.7" value + +rm -rf "${MASTERMNT}" +exit 0 |