test-apt-cli-search 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. Long description of stuff and such, with lines
  16. .
  17. and paragraphs and everything."
  18. insertpackage 'testing' 'bar' 'i386' '2.0' '' '' "$DESCR2"
  19. setupaptarchive
  20. APTARCHIVE=$(readlink -f ./aptarchive)
  21. testfailureequal 'E: You must give at least one search pattern' aptcache search
  22. testfailureequal 'E: You must give at least one search pattern' apt search
  23. # with OP progress
  24. testsuccessequal "Sorting...
  25. Full Text Search...
  26. foo/unstable 1.0 all
  27. $DESCR
  28. " apt search xxyyzz
  29. # without op progress
  30. testsuccessequal "foo/unstable 1.0 all
  31. $DESCR
  32. " apt search -qq xxyyzz
  33. testempty apt search -qq --names-only xxyyzz
  34. # search name
  35. testsuccessequal "foo/unstable 1.0 all
  36. $DESCR
  37. " apt search -qq foo
  38. testsuccessequal "foo/unstable 1.0 all
  39. $DESCR
  40. " apt search -qq --names-only foo
  41. # search with multiple words is a AND search
  42. testsuccessequal "foo/unstable 1.0 all
  43. $DESCR
  44. " apt search -qq aabbcc xxyyzz
  45. testsuccessequal "foo/unstable 1.0 all
  46. $DESCR
  47. " apt search -qq 'a+b+c+' 'i*xxy{0,2}zz'
  48. # search is not case-sensitive by default
  49. testsuccessequal "foo/unstable 1.0 all
  50. $DESCR
  51. " apt search -qq uppercase
  52. testsuccessequal "foo/unstable 1.0 all
  53. $DESCR
  54. " apt search -qq 'up[pP]erc[Aa]se'
  55. # search is done in the long description
  56. testsuccessequal "foo/unstable 1.0 all
  57. $DESCR
  58. " apt search -qq 'long description'
  59. testsuccessequal "foo/unstable 1.0 all
  60. $DESCR
  61. Long description of stuff and such, with lines
  62. .
  63. and paragraphs and everything.
  64. " apt search --full -qq 'long description'
  65. # output is sorted and search word finds both package
  66. testsuccessequal "bar/testing 2.0 i386
  67. $DESCR2
  68. foo/unstable 1.0 all
  69. $DESCR
  70. " apt search -qq aabbcc