Hello, attached are some simple tests for dirname and wc and a fix for a small typo in another test script.
Posix specifies an -m option for wc, which toybox does not implement. Should there be a test for this, too? Why do the scripts actually use bash? Regards, Felix
diff -r b88859043af2 -r 7f41c9c49509 scripts/test/cmp.test --- a/scripts/test/cmp.test Mon Sep 17 00:17:16 2012 -0500 +++ b/scripts/test/cmp.test Sat Oct 27 22:29:02 2012 +0200 @@ -1,4 +1,4 @@ -#/bin/bash +#!/bin/bash [ -f testing.sh ] && . testing.sh
diff -r 88fa9133995e -r 929003d8c4f9 scripts/test/dirname.test --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/test/dirname.test Sun Oct 28 00:06:38 2012 +0200 @@ -0,0 +1,10 @@ +#!/bin/bash + +[ -f testing.sh ] && . testing.sh + +#testing "name" "command" "result" "infile" "stdin" + +testing "dirname /-only" "dirname ///////" "/\n" "" "" +testing "dirname trailing /" "dirname a//////" ".\n" "" "" +testing "dirname combined" "dirname /////a///b///c///d/////" "/////a///b///c\n" "" "" +testing "dirname /a/" "dirname /////a///" "/\n" "" ""
diff -r 7f41c9c49509 -r 88fa9133995e scripts/test/wc.test --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/test/wc.test Sat Oct 27 23:52:43 2012 +0200 @@ -0,0 +1,22 @@ +#!/bin/bash + +[ -f testing.sh ] && . testing.sh + +#testing "name" "command" "result" "infile" "stdin" + +cat >file1 <<EOF +some words . + +some +lines +EOF + +testing "wc" "wc >/dev/null && echo yes" "yes\n" "" "" +testing "wc empty file" "wc" "0 0 0\n" "" "" +testing "wc standard input" "wc" "1 3 5\n" "" "a b\nc" +testing "wc -c" "wc -c file1" "26 file1\n" "" "" +testing "wc -l" "wc -l file1" "4 file1\n" "" "" +testing "wc -w" "wc -w file1" "5 file1\n" "" "" +testing "wc format" "wc file1" "4 5 26 file1\n" "" "" +testing "wc multiple files" "wc input - file1" "1 2 3 input\n0 2 3 -\n4 5 26 file1\n5 9 32 total\n" "a\nb" "a b" +rm file1
_______________________________________________ Toybox mailing list [email protected] http://lists.landley.net/listinfo.cgi/toybox-landley.net
