test-apt-cli-search 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #!/bin/sh
  2. set -e
  3. TESTDIR=$(readlink -f $(dirname $0))
  4. . $TESTDIR/framework
  5. setupenvironment
  6. configarchitecture "i386"
  7. if [ ! -x ${BUILDDIRECTORY}/apt ]; then
  8. msgmsg "No ${BUILDDIRECTORY}/apt"
  9. msgskip
  10. exit 0
  11. fi
  12. DESCR='Some description that has a unusual word xxyyzz and aabbcc and a UPPERCASE'
  13. DESCR2='Some other description with the unusual aabbcc only'
  14. insertpackage 'unstable' 'foo' 'all' '1.0' '' '' "$DESCR"
  15. insertpackage 'testing' 'bar' 'i386' '2.0' '' '' "$DESCR2"
  16. setupaptarchive
  17. APTARCHIVE=$(readlink -f ./aptarchive)
  18. # with OP progress
  19. testequal "Sorting...
  20. Full Text Search...
  21. foo/unstable 1.0 all
  22. $DESCR
  23. " apt search xxyyzz
  24. # without op progress
  25. testequal "foo/unstable 1.0 all
  26. $DESCR
  27. " apt search -qq xxyyzz
  28. testempty apt search -qq --names-only xxyyzz
  29. # search name
  30. testequal "foo/unstable 1.0 all
  31. $DESCR
  32. " apt search -qq foo
  33. testequal "foo/unstable 1.0 all
  34. $DESCR
  35. " apt search -qq --names-only foo
  36. # search with multiple words is a AND search
  37. testequal "foo/unstable 1.0 all
  38. $DESCR
  39. " apt search -qq aabbcc xxyyzz
  40. testequal "foo/unstable 1.0 all
  41. $DESCR
  42. " apt search -qq 'a+b+c+' 'i*xxy{0,2}zz'
  43. # search is not case-sensitive by default
  44. testequal "foo/unstable 1.0 all
  45. $DESCR
  46. " apt search -qq uppercase
  47. testequal "foo/unstable 1.0 all
  48. $DESCR
  49. " apt search -qq 'up[pP]erc[Aa]se'
  50. # output is sorted and search word finds both package
  51. testequal "bar/testing 2.0 i386
  52. $DESCR2
  53. foo/unstable 1.0 all
  54. $DESCR
  55. " apt search -qq aabbcc