1#	$OpenBSD: Makefile,v 1.9 2024/08/28 14:32:02 millert Exp $
2#	$NetBSD: Makefile,v 1.1 2005/04/04 16:48:45 peter Exp $
3
4SED?=	/usr/bin/sed
5
6REGRESS_TARGETS= sedtest substitute hanoi math sierpinski negation \
7	inplace inplace2 inplace3 commandl1 commandl2 commandc1 commandD1 \
8	commandD2
9
10commandc1:
11	# New tests, currently failing, need fixes in sed.
12	@echo DISABLED
13
14sedtest:
15	sh ${.CURDIR}/$@.sh ${SED} $@.out
16	diff ${.CURDIR}/$@.expected $@.out
17
18substitute:
19	sh ${.CURDIR}/$@.sh
20
21hanoi:
22	${SED} -f ${.CURDIR}/$@.sed ${.CURDIR}/$@.in > $@.out
23	diff ${.CURDIR}/$@.expected $@.out
24
25math:
26	${SED} -f ${.CURDIR}/$@.sed ${.CURDIR}/$@.in > $@.out
27	diff ${.CURDIR}/$@.expected $@.out
28
29sierpinski:
30	${SED} -nf ${.CURDIR}/$@.sed ${.CURDIR}/$@.in > $@.out
31	diff ${.CURDIR}/$@.expected $@.out
32
33negation:
34	echo foo | ${SED} "1!!s/foo/bar/" > $@.out
35	diff ${.CURDIR}/$@.expected $@.out
36
37inplace:
38	cp -f ${.CURDIR}/$@.in $@.txt
39	${SED} -i -f ${.CURDIR}/sierpinski.sed $@.txt
40	diff ${.CURDIR}/sierpinski.expected $@.txt
41
42inplace2:
43	cp -f ${.CURDIR}/$@.in $@.txt
44	${SED} -i 's/PROG/GROP/g' $@.txt
45	diff ${.CURDIR}/$@.expected $@.txt
46
47inplace3:
48	cp -f ${.CURDIR}/$@.in $@.txt
49	${SED} -i 's/#PermitRootLogin no/PermitRootLogin yes/g' $@.txt
50	diff ${.CURDIR}/$@.expected $@.txt
51
52commandl1:
53	printf 'a\nbb\n' | ${SED} -f ${.CURDIR}/$@.sed > $@.out
54	diff ${.CURDIR}/$@.expected $@.out
55
56commandl2:
57	printf 'abc' | ${SED} -f ${.CURDIR}/$@.sed > $@.out
58	diff ${.CURDIR}/$@.expected $@.out
59
60commandc1:
61	printf 'abc' | ${SED} -f ${.CURDIR}/$@.sed > $@.out
62	diff ${.CURDIR}/$@.expected $@.out
63
64commandD1:
65	printf 'a\nbb\n' | ${SED} -f ${.CURDIR}/$@.sed > $@.out
66	diff ${.CURDIR}/$@.expected $@.out
67
68commandD2:
69	printf 'a\nbb\n\n' | ${SED} -f ${.CURDIR}/$@.sed > $@.out
70	diff ${.CURDIR}/$@.expected $@.out
71
72CLEANFILES+=*.out lines* script* *.txt
73
74.include <bsd.regress.mk>
75