makepp

 view release on metacpan or  search on metacpan

t/builtins.test  view on Meta::CPAN

expr.out:
	-&expr -n 8 - 3 * 2 - 2 -o $(output)
	&expr 8 - 3 * 2 > 1 && "'joy'" || \'sorrow\' -o >>$(output)


# Test various variants of &grep
sub choose_a { /a/ }
grep.out grep.o grep.ou: grep.in
	&grep --separator=, /a/ grep.in -o grep.o -w grep.waste
	&grep -co '>>grep.o' /a/ template.tmpl
	&grep --vice-versa -s, /a/ grep.in -o '>>grep.o'
	&grep -r3 /a/ grep.in -o '>>grep.o'
	&grep -vco '>>grep.o' &choose_a template.tmpl
	&grep -l /[Jj]ust/ RootMakeppfile sed.in template.tmpl -o '>>grep.o'
	&echo -o '>>grep.o'
	&grep -vl /[Jj]ust/ RootMakeppfile sed.in template.tmpl -o '>>grep.o'
	&echo -o '>>grep.o'
	&grep -vvl /[Jj]ust/ RootMakeppfile grep.in template.tmpl uniq.in -o '>>grep.o'
	&cp -vfl grep.o grep.ou
	&cp -v grep.ou grep.ou1
	&mv -v grep.ou1 $(output)


# Test &sort
perl { sub transform { $_ = ((split)[1] || '')."\0$_" } sub detransform { (split "\0")[1] }}
sort.out: template.tmpl
ifperl 'a' lt 'A'		# Ebcdic, sorts differently
	&cp -l answers/sort.out .
else
 	&sort $(input) -o $(output)
	&echo + -o >>$(output)
	&sort --compare '$$b cmp $$a' $(input) -o >>$(output)
	&echo + -o >>$(output)
	&sort -t '[lc, $$_]' -c '$$a->[0] cmp $$b->[0]' -d '$$_->[1]' $(input) -o >>$(output)
	&echo + -o >>$(output)
	&sort -t &transform -d &detransform $(input) -o >>$(output)
	&echo +++ -o >>$(output)
 	&sort --uniq $(input) $(input) -o >>$(output)
	&echo + -o >>$(output)
	&sort --unique --compare '$$b cmp $$a' $(input) $(input) -o >>$(output)
	&echo + -o >>$(output)
	&sort -ut '[lc, $$_]' -c '$$a->[0] cmp $$b->[0]' -d '$$_->[1]' $(input) $(input) -o >>$(output)
	&echo + -o >>$(output)
	&sort -urt transform -d detransform $(input) $(input) -o >>$(output)
	&echo + -o >>$(output)
	&sort -uc 'ord( $$a ) <=> ord $$b' $(input) -o >>$(output)
endif


# Test &template
perl { %hash = (aa => 1, aaa => "1\n2", TITLE => 'Test') }
%.out: title.tmpl %.tmpl template.xml pi.xml
	&template -v -o $(output) -h\\%hash THIS=foo THAT=bar:$$1: $(inputs 1 2)
	&template -dv --simple=|<|/>| --multiline=|<|>|</|>| -h '+{%hash, bb => 2}' $(input 3) -o >>$(output)
	&template --defined --simple='_&(?!#)_;_' --multiline='_<\?_(?=\?>)_\?>_' $(input 4) -o >>$(output)
	&template -vS -o >>$(output) -h\\%hash THIS=foo THAT=bar:$$1: $(input 2)


# Test &uniq
# helper function for --compare
sub c0(\$) { substr ${$_[0]}, 0, 1 }
uniq.out: uniq.in sed.in
	&uniq $(input) -o $(output)
	&uniq -c 'c0( $$a ) ne c0 $$b' $(input) -o >>$(output)
	&uniq -S $(inputs 2 1) -o >>$(output)
	&uniq -S $(inputs 1 1) -o >>$(output) # Must reemit file name first time.

install_log:
	&rm -f .install_log installog
	&install --directory --mode=750 dest
	$(IGNINST)&install -v --mode=640 grep.in dest
	$(IGNINST)&install -vc --log installog --mode=666 sed.in dest/foobar
	&sed 's/^[^ ].*/date/; s|`[^`]+(?=/dest)|`...|' .install_log installog -o install_log
	&uninstall -v
	&uninstall -v installog
	@perl { <dest/*> and die "uninstall failed\n" }

# Test own command with frame and loaded fom a module
perl { do './mymodule.pl'; import mymodule 'c_uc' }
uc.out: uniq.in
	&uc -v $(input) -o $(output)

preprocess.out: preprocess.test
	&preprocess -v v4=foobar e== -h\\%hash preprocess.test -o preprocess.out
	&preprocess -va v2=xyz e== preprocess.test -o >>preprocess.out
###	11	644	1141068683	1473530787	mymodule.pl
package mymodule;
require Exporter;
our @ISA = 'Exporter';
our @EXPORT = 'c_uc';

sub c_uc {
  local @ARGV = @_;
  Mpp::Cmds::frame {
    print "\u\L$_" while <>;
  } qw(f i I o O r s);
}
###	-12	644	1134923188	1134923188	cut.in
  ! " # $ % & ' ( ) * + , - . /
0 1 2 3 4 5 6 7 8 9 : ; < = > ?
@ A B C D E F G H I J K L M N O
P Q R S T U V W X Y Z [ \ ] ^ _
` a b c d e f g h i j k l m n o
p q r s t u v w x y z { | } ~
 !"#	$%&'	()*+	,-./
0123	4567	89:;	<=>?
@ABC	DEFG	HIJK	LMNO
PQRS	TUVW	XYZ[	\]^_
`abc	defg	hijk	lmno
pqrs	tuvw	xyz{	|}~
###	0	644	1107332258	1105783994	dir2
###	1	644	1107332258	1107331351	grep.in
aha,foo,bar,with a,without
###	2	644	1404420827	1404420827	pi.xml
<?STYLE="background-color: #d8d8e8;"?><?# This tests not getting confused about nested ';' and &#n; is not a comment ?>
<div style=&STYLE;>&#65;</div>
###	22	644	1153676973	1313824017	preprocess.test

# empty & comment
$()
$()# empty & comment not gone



( run in 1.310 second using v1.01-cache-2.11-cpan-5c0b1e786e0 )