test-apt-cli-search 1.8 KB

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