some regression tests for lam(1) including width measurements;
authorschwarze <schwarze@openbsd.org>
Wed, 11 Jul 2018 20:24:35 +0000 (20:24 +0000)
committerschwarze <schwarze@openbsd.org>
Wed, 11 Jul 2018 20:24:35 +0000 (20:24 +0000)
will be fixed soon and then linked to the build

regress/usr.bin/lam/Makefile [new file with mode: 0644]
regress/usr.bin/lam/expect_Fback.txt [new file with mode: 0644]
regress/usr.bin/lam/expect_fonly.txt [new file with mode: 0644]
regress/usr.bin/lam/expect_noarg.txt [new file with mode: 0644]
regress/usr.bin/lam/expect_pminus.txt [new file with mode: 0644]
regress/usr.bin/lam/expect_stdio.txt [new file with mode: 0644]
regress/usr.bin/lam/in1.txt [new file with mode: 0644]
regress/usr.bin/lam/in2.txt [new file with mode: 0644]
regress/usr.bin/lam/in3.txt [new file with mode: 0644]

diff --git a/regress/usr.bin/lam/Makefile b/regress/usr.bin/lam/Makefile
new file mode 100644 (file)
index 0000000..b9032a0
--- /dev/null
@@ -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 <bsd.regress.mk>
diff --git a/regress/usr.bin/lam/expect_Fback.txt b/regress/usr.bin/lam/expect_Fback.txt
new file mode 100644 (file)
index 0000000..5a30f41
--- /dev/null
@@ -0,0 +1,7 @@
+01234567890123456789 123456
+00accent édoubleカオ  ascii
+0000comb é0003byte ‒ trunca
+000four ð \80\800badbyte ÿ    end
+000incom Â0000cont \80    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 (file)
index 0000000..bdbca83
--- /dev/null
@@ -0,0 +1,7 @@
+123456789123456789123456789
+ accent édoubleカascii
+   comb é3byte ‒truncate
+  four ð \80\80badbyte ÿend
+  incom Âcont \80end
+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 (file)
index 0000000..38c9098
--- /dev/null
@@ -0,0 +1,7 @@
+123456789123456789123456789
+accent édoubleカオascii
+comb é3byte ‒truncate
+four ð \80\80badbyte ÿend
+incom Âcont \80end
+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 (file)
index 0000000..eb890ea
--- /dev/null
@@ -0,0 +1,7 @@
+|123456789|123456789|123456789
+| accent é|doubleカ |ascii    
+|   comb é|3byte ‒  |truncate 
+|  four ð \80\80|badbyte ÿ|end      
+|  incom Â|cont \80   |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 (file)
index 0000000..8d624c0
--- /dev/null
@@ -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 (file)
index 0000000..2b5982e
--- /dev/null
@@ -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 (file)
index 0000000..8ab95c4
--- /dev/null
@@ -0,0 +1,6 @@
+123456789
+doubleカオ
+3byte ‒
+badbyte ÿ
+cont \80
+two
diff --git a/regress/usr.bin/lam/in3.txt b/regress/usr.bin/lam/in3.txt
new file mode 100644 (file)
index 0000000..a9ac812
--- /dev/null
@@ -0,0 +1,7 @@
+123456789
+ascii
+truncate
+end
+end
+and three
+three only