From: schwarze Date: Wed, 11 Jul 2018 20:24:35 +0000 (+0000) Subject: some regression tests for lam(1) including width measurements; X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=38a6d86aec9df449397e6831a0422c06154f4a48;p=openbsd some regression tests for lam(1) including width measurements; will be fixed soon and then linked to the build --- diff --git a/regress/usr.bin/lam/Makefile b/regress/usr.bin/lam/Makefile new file mode 100644 index 00000000000..b9032a01595 --- /dev/null +++ b/regress/usr.bin/lam/Makefile @@ -0,0 +1,36 @@ +# $OpenBSD: Makefile,v 1.1 2018/07/11 20:24:35 schwarze Exp $ + +LAM = LC_CTYPE=en_US.UTF-8 lam +REGRESS_TARGETS = noarg fonly Fback pminus stdio +CLEANFILES = ${REGRESS_TARGETS:C/^/out_/:C/$/.txt/} + +noarg: + ${LAM} ${.CURDIR}/in1.txt ${.CURDIR}/in2.txt ${.CURDIR}/in3.txt > \ + out_noarg.txt + diff -u ${.CURDIR}/expect_noarg.txt out_noarg.txt + +# also test padding (in1), truncation (in2), and back to default +fonly: + ${LAM} -f 9 ${.CURDIR}/in1.txt -f .9 ${.CURDIR}/in2.txt \ + ${.CURDIR}/in3.txt > out_fonly.txt + diff -u ${.CURDIR}/expect_fonly.txt out_fonly.txt + +# also test 0 padding, and padding combined with truncation +Fback: + ${LAM} -F 010 ${.CURDIR}/in1.txt ${.CURDIR}/in2.txt \ + -f 7.6 ${.CURDIR}/in3.txt > out_Fback.txt + diff -u ${.CURDIR}/expect_Fback.txt out_Fback.txt + +# also test separator, left alignment, and column padding +pminus: + ${LAM} -S '|' -F 9.9 ${.CURDIR}/in1.txt -P -9.9 ${.CURDIR}/in2.txt \ + ${.CURDIR}/in3.txt > out_pminus.txt + diff -u ${.CURDIR}/expect_pminus.txt out_pminus.txt + +# also test line ending and separators +stdio: + printf "11:12;21:22;" | ${LAM} -t ':' - -S= -t ';' - -s '%' > \ + out_stdio.txt + diff -u ${.CURDIR}/expect_stdio.txt out_stdio.txt + +.include diff --git a/regress/usr.bin/lam/expect_Fback.txt b/regress/usr.bin/lam/expect_Fback.txt new file mode 100644 index 00000000000..5a30f413218 --- /dev/null +++ b/regress/usr.bin/lam/expect_Fback.txt @@ -0,0 +1,7 @@ +01234567890123456789 123456 +00accent édoubleカオ ascii +0000comb é0003byte ‒ trunca +000four 𠀀0badbyte ÿ end +000incom Â0000cont € end +0000000two and th + three diff --git a/regress/usr.bin/lam/expect_fonly.txt b/regress/usr.bin/lam/expect_fonly.txt new file mode 100644 index 00000000000..bdbca839f22 --- /dev/null +++ b/regress/usr.bin/lam/expect_fonly.txt @@ -0,0 +1,7 @@ +123456789123456789123456789 + accent édoubleカascii + comb é3byte ‒truncate + four 𠀀badbyte ÿend + incom Âcont €end +twoand three +three only diff --git a/regress/usr.bin/lam/expect_noarg.txt b/regress/usr.bin/lam/expect_noarg.txt new file mode 100644 index 00000000000..38c9098e16d --- /dev/null +++ b/regress/usr.bin/lam/expect_noarg.txt @@ -0,0 +1,7 @@ +123456789123456789123456789 +accent édoubleカオascii +comb é3byte ‒truncate +four 𠀀badbyte ÿend +incom Âcont €end +twoand three +three only diff --git a/regress/usr.bin/lam/expect_pminus.txt b/regress/usr.bin/lam/expect_pminus.txt new file mode 100644 index 00000000000..eb890eabe66 --- /dev/null +++ b/regress/usr.bin/lam/expect_pminus.txt @@ -0,0 +1,7 @@ +|123456789|123456789|123456789 +| accent é|doubleカ |ascii +| comb é|3byte ‒ |truncate +| four 𠀀|badbyte ÿ|end +| incom Â|cont € |end +||two |and three +|| |three onl diff --git a/regress/usr.bin/lam/expect_stdio.txt b/regress/usr.bin/lam/expect_stdio.txt new file mode 100644 index 00000000000..8d624c0abc2 --- /dev/null +++ b/regress/usr.bin/lam/expect_stdio.txt @@ -0,0 +1 @@ +11=12%21=22% \ No newline at end of file diff --git a/regress/usr.bin/lam/in1.txt b/regress/usr.bin/lam/in1.txt new file mode 100644 index 00000000000..2b5982ea88f --- /dev/null +++ b/regress/usr.bin/lam/in1.txt @@ -0,0 +1,5 @@ +123456789 +accent é +comb é +four 𠀀 +incom  diff --git a/regress/usr.bin/lam/in2.txt b/regress/usr.bin/lam/in2.txt new file mode 100644 index 00000000000..8ab95c4755d --- /dev/null +++ b/regress/usr.bin/lam/in2.txt @@ -0,0 +1,6 @@ +123456789 +doubleカオ +3byte ‒ +badbyte ÿ +cont € +two diff --git a/regress/usr.bin/lam/in3.txt b/regress/usr.bin/lam/in3.txt new file mode 100644 index 00000000000..a9ac8129b33 --- /dev/null +++ b/regress/usr.bin/lam/in3.txt @@ -0,0 +1,7 @@ +123456789 +ascii +truncate +end +end +and three +three only