From 6e4d9dfc0ff1abd6325dfa764585386c550cc972 Mon Sep 17 00:00:00 2001 From: Thomas von Dein Date: Fri, 21 Nov 2025 14:01:55 +0100 Subject: [PATCH] add more tests --- .woodpecker/build.yaml | 43 +++++++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 7 deletions(-) diff --git a/.woodpecker/build.yaml b/.woodpecker/build.yaml index a06150b..5e7c56f 100644 --- a/.woodpecker/build.yaml +++ b/.woodpecker/build.yaml @@ -24,15 +24,29 @@ steps: - apk update - apk add --no-cache bash build-base pcre2 pcre2-dev db db-dev - rm -f test.db - - build/dbtool -d test.db -i -k "test" -v "blah" - - build/dbtool -d test.db -i -k "foo" -v "bar" + # insert keys + - build/dbtool -d test.db -i -k test -v blah + - build/dbtool -d test.db -i -k foo -v bar + # look if the appear in the dump - build/dbtool -d test.db -D | grep blah + # count 'em - build/dbtool -d test.db -D | wc -l | grep 2 + # search for key - build/dbtool -d test.db -s -k test + # search for key regex - build/dbtool -d test.db -S -k 't$' - # deletion doesn't work with berkeley currently? - #- build/dbtool -d test.db -r -k foo - #- build/dbtool -d test.db -D | wc -l | grep 1 + # remove key + - build/dbtool -d test.db -r -k foo + # count must match + - build/dbtool -d test.db -D | wc -l | grep 1 + # modify a key + - build/dbtool -d test.db -u -k test -v modified + # check modified key + - build/dbtool -d test.db -s -k test | grep modified + # use splitting with regex + - printf "today:100\nyesterday:500\n" | build/dbtool -d test.db -i -f -t '^([^:]*):([^:]*)' + # check if it works + - cat /etc/passwd | build/dbtool -d test.db -s -k today | grep 100 build-gdbm: @@ -56,12 +70,27 @@ steps: - apk update - apk add --no-cache bash build-base pcre2 pcre2-dev gdbm gdbm-dev - rm -f test.db - - build/dbtool -d test.db -i -k "test" -v "blah" - - build/dbtool -d test.db -i -k "foo" -v "bar" + # insert keys + - build/dbtool -d test.db -i -k test -v blah + - build/dbtool -d test.db -i -k foo -v bar + # look if the appear in the dump - build/dbtool -d test.db -D | grep blah + # count 'em - build/dbtool -d test.db -D | wc -l | grep 2 + # search for key - build/dbtool -d test.db -s -k test + # search for key regex - build/dbtool -d test.db -S -k 't$' + # remove key - build/dbtool -d test.db -r -k foo + # count must match - build/dbtool -d test.db -D | wc -l | grep 1 + # modify a key + - build/dbtool -d test.db -u -k test -v modified + # check modified key + - build/dbtool -d test.db -s -k test | grep modified + # use splitting with regex + - printf "today:100\nyesterday:500\n" | build/dbtool -d test.db -i -f -t '^([^:]*):([^:]*)' + # check if it works + - cat /etc/passwd | build/dbtool -d test.db -s -k today | grep 100