% Some sort of bug trap by MJSoft. This filter doesn't do anything useful,
% but it should test every dark corner of TEC except the buffering mechanism,
% which is tested by test1/test2/test3.
% Use: TEC trap trap FROM infile TO outfile (yes, run it *twice*)
% infile: zYXAacmNobabxm!AQaAWabcdef aAa.A.pQrst.AAaA.bBb.BbB.
% outfile: ^1*1)@#|#|string\n}a}b}@}m}!#|Qq#|>»abcdef«12345?}
% stdout: This is TRAP.TEC, version 1.0000\nThis is TRAP.TEC version 1.0000\n
%         Pass 2 is running

global
	nocase	'Z' 'y' glob2
	case	'x' put '@'
		'X' put ')'

init:	msg "This is TRAP.TEC, version 1.0000\n"
	start

str:	clr cat ">»" gather
gather:	' ' '\t' '\n' '\r' cat "«" puts clr gath_2
	else add
gath_2:	'.' dottest
	else add
dottest:	switch
		"aaa" xaaa
		"a" xa
		"pqrst" xpqr
	else cswitch
		"AAaA" xaaaa
		"bBb" xbbb
	else put '?' start
xaaa: put '1' qwe
xa: put '2' qwe
xpqr: put '3' qwe
xaaaa: put '4' qwe
xbbb: put '5' qwe
qwe: clr gath_2

start:		eof 'b' eof bgot
	nocase	'a' put '#' ; case 'c' put "string\n"
		'Q' copy qqq
		'W' str
		'*' pass2
		else

bgot: put '}'
	'!' >'!' start
	else copy

glob2:	put "*1" start

qqq: use start
	'a' put 'q'

pass2: put '^' ; msg "Pass 2 is running\n"  pass2a
pass2a:	'#' copy >'|'
	else copy
