1*e0c4386eSCy Schubert#!perl 2*e0c4386eSCy Schubert# 3*e0c4386eSCy Schubert# test apparatus for Text::Template module 4*e0c4386eSCy Schubert# still incomplete. 5*e0c4386eSCy Schubert 6*e0c4386eSCy Schubertuse strict; 7*e0c4386eSCy Schubertuse warnings; 8*e0c4386eSCy Schubertuse Test::More tests => 6; 9*e0c4386eSCy Schubert 10*e0c4386eSCy Schubertuse_ok 'Text::Template' or exit 1; 11*e0c4386eSCy Schubert 12*e0c4386eSCy Schubert# (1-2) Missing source 13*e0c4386eSCy Schuberteval { 14*e0c4386eSCy Schubert Text::Template->new(); 15*e0c4386eSCy Schubert pass; 16*e0c4386eSCy Schubert}; 17*e0c4386eSCy Schubert 18*e0c4386eSCy Schubertlike $@, qr/^\QUsage: Text::Template::new(TYPE => ..., SOURCE => ...)/; 19*e0c4386eSCy Schubert 20*e0c4386eSCy Schuberteval { Text::Template->new(TYPE => 'FILE'); }; 21*e0c4386eSCy Schubertlike $@, qr/^\QUsage: Text::Template::new(TYPE => ..., SOURCE => ...)/; 22*e0c4386eSCy Schubert 23*e0c4386eSCy Schubert# (3) Invalid type 24*e0c4386eSCy Schuberteval { Text::Template->new(TYPE => 'wlunch', SOURCE => 'fish food'); }; 25*e0c4386eSCy Schubertlike $@, qr/^\QIllegal value `WLUNCH' for TYPE parameter/; 26*e0c4386eSCy Schubert 27*e0c4386eSCy Schubert# (4-5) File does not exist 28*e0c4386eSCy Schubertmy $o = Text::Template->new( 29*e0c4386eSCy Schubert TYPE => 'file', 30*e0c4386eSCy Schubert SOURCE => 'this file does not exist'); 31*e0c4386eSCy Schubertok !defined $o; 32*e0c4386eSCy Schubert 33*e0c4386eSCy Schubertok defined($Text::Template::ERROR) 34*e0c4386eSCy Schubert && $Text::Template::ERROR =~ /^Couldn't open file/; 35