1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
|
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl 1.t'
#########################
# change 'tests => 1' to 'tests => last_test_to_print';
use Test::More tests => 2;
use Text::Quoted;
#########################
# Insert your test code below, the Test::More module is use()ed here so read
# its man page ( perldoc Test::More ) for help writing this test script.
$a = <<'EOF';
>>>>> "dc" == darren chamberlain writes:
>> If I don't do "use Template;" in my startup script, each child will
>> get the pleasure of loading and compiling it all when the first script
>> that uses Template gets executed.
dc> Unless one of the other modules that you use in your startup script
dc> happens to use Template, in which case you'll be OK.
Well, that's still "use Template;" as far as I'm concerned.
I was really just being pedantic... but think of a hosting situation
where the startup is pretty bare, and some Registry program uses the
template.
I personally don't think the preload should be called automagically,
even if it does the right thing most of the time.
_______________________________________________
templates mailing list
templates@template-toolkit.org
http://www.template-toolkit.org/mailman/listinfo/templates
EOF
$expected = [
[
[
{
'quoter' => '>>>>>',
'text' => '"dc" == darren chamberlain writes:',
'raw' => '>>>>> "dc" == darren chamberlain writes:',
}
]
],
{
'quoter' => '',
'text' => '',
'raw' => '',
'empty' => '1'
},
[
{
'quoter' => '>>',
'text' => 'If I don\'t do "use Template;" in my startup script, each child will
get the pleasure of loading and compiling it all when the first script
that uses Template gets executed.',
'raw' => '>> If I don\'t do "use Template;" in my startup script, each child will
>> get the pleasure of loading and compiling it all when the first script
>> that uses Template gets executed.',
}
],
{
'quoter' => '',
'text' => '',
'raw' => '',
'empty' => '1'
},
[
{
'quoter' => 'dc>',
'text' => 'Unless one of the other modules that you use in your startup script
happens to use Template, in which case you\'ll be OK.',
'raw' => 'dc> Unless one of the other modules that you use in your startup script
dc> happens to use Template, in which case you\'ll be OK.',
}
],
{
'quoter' => '',
'text' => '',
'raw' => '',
'empty' => '1'
},
{
'quoter' => '',
'text' => 'Well, that\'s still "use Template;" as far as I\'m concerned.',
'raw' => 'Well, that\'s still "use Template;" as far as I\'m concerned.',
},
{
'quoter' => '',
'text' => '',
'raw' => '',
'empty' => '1'
},
{
'quoter' => '',
'text' => 'I was really just being pedantic... but think of a hosting situation
where the startup is pretty bare, and some Registry program uses the
template.',
'raw' => 'I was really just being pedantic... but think of a hosting situation
where the startup is pretty bare, and some Registry program uses the
template.',
},
{
'quoter' => '',
'text' => '',
'raw' => '',
'empty' => '1'
},
{
'quoter' => '',
'text' => 'I personally don\'t think the preload should be called automagically,
even if it does the right thing most of the time.',
'raw' => 'I personally don\'t think the preload should be called automagically,
even if it does the right thing most of the time.',
},
{
'quoter' => '',
'text' => '',
'raw' => '',
'empty' => '1'
},
{
'separator' => '1',
'quoter' => '',
'text' => '_______________________________________________',
'raw' => '_______________________________________________',
},
{
'quoter' => '',
'text' => 'templates mailing list
templates@template-toolkit.org
http://www.template-toolkit.org/mailman/listinfo/templates',
'raw' => 'templates mailing list
templates@template-toolkit.org
http://www.template-toolkit.org/mailman/listinfo/templates',
}
];
is_deeply(extract($a), $expected,
"Supercite doesn't screw me up as badly as before");
is(
Text::Quoted::combine_hunks( extract($a) ),
$a,
"round-trips okay",
);
|