File: 01_test.t

package info (click to toggle)
libtemplate-plugin-javascript-perl 0.02-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch, wheezy
  • size: 68 kB
  • ctags: 3
  • sloc: perl: 29; makefile: 2
file content (45 lines) | stat: -rw-r--r-- 756 bytes parent folder | download | duplicates (2)
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
use strict;
use Template::Test;

use lib 'lib';

test_expect(\*DATA);

__END__
--test--
[% USE JavaScript -%]
document.write("[% FILTER js %]
Here's some text going on.
[% END %]");
--expect--
document.write("\nHere\'s some text going on.\n");

--test--
[% USE JavaScript -%]
document.write("[% FILTER js %]
You & I
[% END %]");
--expect--
document.write("\nYou \x26 I\n");

--test--
[% USE JavaScript -%]
var t = "[% FILTER js %]
\"+alert(1)//
[% END %]";
--expect--
var t = "\n\\\"+alert(1)//\n";

--test--
[% USE JavaScript -%]
<script type="text/javascript">
var t = "[% FILTER js %]
\"</script><script>
alert(1)//
[% END %]";
</script>
--expect--
<script type="text/javascript">
var t = "\n\\\"\x3c/script\x3e\x3cscript\x3e\nalert(1)//\n";
</script>