svn commit: r268794 - in head: etc/mtree usr.bin/units usr.bin/units/tests
Eitan Adler
eadler at FreeBSD.org
Thu Jul 17 07:12:13 UTC 2014
Author: eadler
Date: Thu Jul 17 07:12:12 2014
New Revision: 268794
URL: http://svnweb.freebsd.org/changeset/base/268794
Log:
units(1): Add basic tests
Add some tests to help avoid breaking units
Added:
head/usr.bin/units/tests/
head/usr.bin/units/tests/Makefile (contents, props changed)
head/usr.bin/units/tests/units_basics.sh (contents, props changed)
Modified:
head/etc/mtree/BSD.tests.dist
head/usr.bin/units/Makefile
Modified: head/etc/mtree/BSD.tests.dist
==============================================================================
--- head/etc/mtree/BSD.tests.dist Thu Jul 17 06:57:26 2014 (r268793)
+++ head/etc/mtree/BSD.tests.dist Thu Jul 17 07:12:12 2014 (r268794)
@@ -256,6 +256,8 @@
tr
..
truncate
+ ..
+ units
..
uudecode
..
Modified: head/usr.bin/units/Makefile
==============================================================================
--- head/usr.bin/units/Makefile Thu Jul 17 06:57:26 2014 (r268793)
+++ head/usr.bin/units/Makefile Thu Jul 17 07:12:12 2014 (r268794)
@@ -1,5 +1,7 @@
# $FreeBSD$
+.include <src.opts.mk>
+
PROG= units
FILES= units.lib
FILESDIR= ${SHAREDIR}/misc
@@ -7,4 +9,8 @@ FILESDIR= ${SHAREDIR}/misc
LDADD+=-ledit -ltermcap
DPADD+=${LIBEDIT} ${LIBTERMCAP}
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
.include <bsd.prog.mk>
Added: head/usr.bin/units/tests/Makefile
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/usr.bin/units/tests/Makefile Thu Jul 17 07:12:12 2014 (r268794)
@@ -0,0 +1,9 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+TESTSDIR= ${TESTSBASE}/bin/chown
+
+TAP_TESTS_SH= units_basics
+
+.include <bsd.test.mk>
Added: head/usr.bin/units/tests/units_basics.sh
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/usr.bin/units/tests/units_basics.sh Thu Jul 17 07:12:12 2014 (r268794)
@@ -0,0 +1,22 @@
+#!/bin/sh
+# $FreeBSD$
+
+base=`basename $0`
+
+echo "1..3"
+
+assert_equals() {
+ testnum="$1"
+ expected="$2"
+ fn="$3"
+ if [ "$expected" = "$($fn)" ]
+ then
+ echo "ok $testnum - $fn"
+ else
+ echo "not ok $testnum - $fn"
+ fi
+}
+
+assert_equals 1 1 "units -t ft ft"
+assert_equals 2 12 "units -t ft in"
+assert_equals 3 0.083333333 "units -t in ft"
More information about the svn-src-all
mailing list