busybox/testsuite/sum.tests
Ron Yorston 1f27fa9838 testsuite: allow tests to work in paths containing spaces
Tweak some tests so they work when the path to the test directory or
$HOME contains spaces.

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-09 20:35:48 +02:00

25 lines
849 B
Bash
Executable File

#!/bin/sh
# unit test for sum.
# Copyright 2007 by Bernhard Reutner-Fischer
# Licensed under GPLv2 or later, see file LICENSE in this source tree.
# AUDIT: Unit tests for sum
. ./testing.sh
# testing "test name" "options" "expected result" "file input" "stdin"
# file input will be file called "input"
# test can create a file "actual" instead of writing to stdout
testing "sum -r file doesn't print file's name" \
"sum -r '$0' | grep -c '$0' && echo wrongly_printed_filename || echo yes" \
"0\nyes\n" "" ""
testing "sum -r file file does print both names" \
"sum -r '$0' '$0' | grep -c '$0' && echo yes || echo wrongly_omitted_filename" \
"2\nyes\n" "" ""
testing "sum -s file does print file's name" \
"sum -s '$0' | grep -c '$0' && echo yes || echo wrongly_omitted_filename" \
"1\nyes\n" "" ""
exit $FAILCOUNT