uuencode.tests 1.1 KB

12345678910111213141516171819202122232425262728
  1. #!/bin/sh
  2. # unit test for uuencode to test functionality.
  3. # Copyright 2006 by Erik Hovland <erik@hovland.org>
  4. # Licensed under GPL v2, see file LICENSE for details.
  5. # AUDIT: Unit tests for uuencode
  6. . ./testing.sh
  7. # testing "test name" "options" "expected result" "file input" "stdin"
  8. # file input will be file called "input"
  9. # test can create a file "actual" instead of writing to stdout
  10. # Test setup of standard input
  11. saved_umask=$(umask)
  12. umask 0
  13. testing "uuencode sets standard input mode correctly" \
  14. "uuencode foo </dev/null | head -n 1 | grep -q 666 && echo yes" "yes\n" "" ""
  15. umask $saved_umask
  16. testing "uuencode correct encoding" "uuencode bb_uuenc_test.out" \
  17. "begin 644 bb_uuenc_test.out\nM5&AE(&9A<W0@9W)E>2!F;W@@:G5M<&5D(&]V97(@=&AE(&QA>GD@8G)O=VX@\n%9&]G+@H\`\n\`\nend\n" \
  18. "" "The fast grey fox jumped over the lazy brown dog.\n"
  19. testing "uuencode correct base64 encoding" "uuencode -m bb_uuenc_test.out" \
  20. "begin-base64 644 bb_uuenc_test.out\nVGhlIGZhc3QgZ3JleSBmb3gganVtcGVkIG92ZXIgdGhlIGxhenkgYnJvd24g\nZG9nLgo=\n====\n" \
  21. "" "The fast grey fox jumped over the lazy brown dog.\n"
  22. exit $FAILCOUNT