blob: cd6191b1be27555c80637009b5501f6982df8a7e [file] [log] [blame]
Denis Vlasenko21afc7d2006-09-03 15:49:40 +00001#!/bin/sh
2
3# unit test for uuencode to test functionality.
4# Copyright 2006 by Erik Hovland <erik@hovland.org>
Denys Vlasenko0ef64bd2010-08-16 20:14:46 +02005# Licensed under GPLv2, see file LICENSE in this source tree.
Denis Vlasenko21afc7d2006-09-03 15:49:40 +00006
7# AUDIT: Unit tests for uuencode
8
Mike Frysingercaa79402009-11-04 18:41:22 -05009. ./testing.sh
Denis Vlasenko21afc7d2006-09-03 15:49:40 +000010
11# testing "test name" "options" "expected result" "file input" "stdin"
12# file input will be file called "input"
13# test can create a file "actual" instead of writing to stdout
14
15# Test setup of standard input
Denis Vlasenko21afc7d2006-09-03 15:49:40 +000016umask 0
17testing "uuencode sets standard input mode correctly" \
18 "uuencode foo </dev/null | head -n 1 | grep -q 666 && echo yes" "yes\n" "" ""
Dan Fandrich775965d2010-08-10 23:33:57 -070019umask 022
Denis Vlasenko21afc7d2006-09-03 15:49:40 +000020
21testing "uuencode correct encoding" "uuencode bb_uuenc_test.out" \
22"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" \
23 "" "The fast grey fox jumped over the lazy brown dog.\n"
24testing "uuencode correct base64 encoding" "uuencode -m bb_uuenc_test.out" \
25"begin-base64 644 bb_uuenc_test.out\nVGhlIGZhc3QgZ3JleSBmb3gganVtcGVkIG92ZXIgdGhlIGxhenkgYnJvd24g\nZG9nLgo=\n====\n" \
26 "" "The fast grey fox jumped over the lazy brown dog.\n"
27exit $FAILCOUNT