From ea1aca5c9c4eec40eabb2fe273303d7b330ae613 Mon Sep 17 00:00:00 2001 From: Andreas Guldstrand Date: Sun, 28 Apr 2019 00:51:37 +0200 Subject: sbofind: really fix exact matches Closes #71. --- t/17-find.t | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) (limited to 't/17-find.t') diff --git a/t/17-find.t b/t/17-find.t index 2be2a56..c911d4c 100755 --- a/t/17-find.t +++ b/t/17-find.t @@ -10,7 +10,7 @@ use lib $RealBin; use Test::Sbotools qw/ make_slackbuilds_txt set_lo sbofind replace_tags_txt set_repo sbosnap /; use File::Temp 'tempdir'; -plan tests => 7; +plan tests => 10; make_slackbuilds_txt(); set_lo("$RealBin/LO"); @@ -41,9 +41,18 @@ cd $tempdir git init mkdir -p test cp -a "$RealBin/LO/nonexistentslackbuild" test/ +cp -a "$RealBin/LO-R/R" test/ +cp -a "$RealBin/LO-R/foo" test/ +cp -a "$RealBin/LO-R/bar" test/ echo "SLACKBUILD NAME: nonexistentslackbuild" > SLACKBUILDS.TXT echo "SLACKBUILD FOO: bar" >> SLACKBUILDS.TXT echo "SLACKBUILD LOCATION: ./test/nonexistentslackbuild" >> SLACKBUILDS.TXT +echo "SLACKBUILD NAME: R" >> SLACKBUILDS.TXT +echo "SLACKBUILD LOCATION: ./test/R" >> SLACKBUILDS.TXT +echo "SLACKBUILD NAME: foo" >> SLACKBUILDS.TXT +echo "SLACKBUILD LOCATION: ./test/foo" >> SLACKBUILDS.TXT +echo "SLACKBUILD NAME: bar" >> SLACKBUILDS.TXT +echo "SLACKBUILD LOCATION: ./test/bar" >> SLACKBUILDS.TXT git add test SLACKBUILDS.TXT git commit -m 'initial' GIT @@ -52,3 +61,35 @@ set_lo('FALSE'); sbosnap 'fetch', { test => 0, note => 1 }; sbofind 'nonexistentslackbuild', { expected => qr!\Q/usr/sbo/repo/test/nonexistentslackbuild! }; + +replace_tags_txt("R: r\nfoo: r\nbar: rar"); + +# 8: non-restricted search finds a lot +sbofind qw/R/, { expected => <<"END" }; +SBo: R 1.0 +Path: /usr/sbo/repo/test/R + +SBo: foo 1.0 +Path: /usr/sbo/repo/test/foo + +SBo: bar 1.0 +Path: /usr/sbo/repo/test/bar + +END + +# 9: checking for exact matches (including tags) +sbofind qw/ -e R /, { expected => <<"END" }; +SBo: R 1.0 +Path: /usr/sbo/repo/test/R + +SBo: foo 1.0 +Path: /usr/sbo/repo/test/foo + +END + +# 10: exact matches (excluding tags) +sbofind qw/ -et R /, { expected => <<"END" }; +SBo: R 1.0 +Path: /usr/sbo/repo/test/R + +END -- cgit v1.2.3