top.test 589 B

12345678910111213
  1. #!/bin/bash
  2. [ -f testing.sh ] && . testing.sh
  3. #testing "name" "command" "result" "infile" "stdin"
  4. testing "batch termination" "top -b -n1 | tail -c 1" "\n" "" ""
  5. testing "fractional seconds" "top -b -d 8.5 -n1 | tail -c 1" "\n" "" ""
  6. # These are unit tests of xparsetime.
  7. testing "-d invalid input" "top -b -d monkey -n1 2>&1 >/dev/null" "top: Not a number 'monkey'\n" "" ""
  8. testing "-d unknown suffix" "top -b -d 1u -n1 2>&1 >/dev/null" "top: Unknown suffix 'u'\n" "" ""
  9. testing "-d suffix trailing junk" "top -b -d 1monkey -n1 2>&1 >/dev/null" "top: Unknown suffix 'monkey'\n" "" ""