test-apt-cli-search 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture "i386"
  7. DESCR='Some description that has a unusual word xxyyzz and aabbcc and a UPPERCASE'
  8. DESCR2='Some other description with the unusual aabbcc only'
  9. insertpackage 'unstable' 'foo' 'all' '1.0' '' '' "$DESCR
  10. Long description of stuff and such, with lines
  11. .
  12. and paragraphs and everything."
  13. insertpackage 'testing' 'bar' 'i386' '2.0' '' '' "$DESCR2"
  14. setupaptarchive
  15. APTARCHIVE="$(readlink -f ./aptarchive)"
  16. testfailureequal 'E: You must give at least one search pattern' aptcache search
  17. testfailureequal 'E: You must give at least one search pattern' apt search
  18. # with OP progress
  19. testsuccessequal "Sorting...
  20. Full Text Search...
  21. foo/unstable 1.0 all
  22. $DESCR
  23. " apt search xxyyzz
  24. # without op progress
  25. testsuccessequal "foo/unstable 1.0 all
  26. $DESCR
  27. " apt search -qq xxyyzz
  28. testempty apt search -qq --names-only xxyyzz
  29. # search name
  30. testsuccessequal "foo/unstable 1.0 all
  31. $DESCR
  32. " apt search -qq foo
  33. testsuccessequal "foo/unstable 1.0 all
  34. $DESCR
  35. " apt search -qq --names-only foo
  36. # search with multiple words is a AND search
  37. testsuccessequal "foo/unstable 1.0 all
  38. $DESCR
  39. " apt search -qq aabbcc xxyyzz
  40. testsuccessequal "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. testsuccessequal "foo/unstable 1.0 all
  45. $DESCR
  46. " apt search -qq uppercase
  47. testsuccessequal "foo/unstable 1.0 all
  48. $DESCR
  49. " apt search -qq 'up[pP]erc[Aa]se'
  50. # search is done in the long description
  51. testsuccessequal "foo/unstable 1.0 all
  52. $DESCR
  53. " apt search -qq 'long description'
  54. testsuccessequal "foo/unstable 1.0 all
  55. $DESCR
  56. Long description of stuff and such, with lines
  57. .
  58. and paragraphs and everything.
  59. " apt search --full -qq 'long description'
  60. # output is sorted and search word finds both package
  61. testsuccessequal "bar/testing 2.0 i386
  62. $DESCR2
  63. foo/unstable 1.0 all
  64. $DESCR
  65. " apt search -qq aabbcc