/[Perly]/t/02-SyntaxHighlight.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /t/02-SyntaxHighlight.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 41 - (show annotations)
Sun Jun 1 17:31:43 2008 UTC (16 years ago) by dpavlin
File MIME type: application/x-troff
File size: 651 byte(s)
added Perly::SyntaxHighlight which generates sytax highlight of perl code
using Syntax::Highlight::Perl which is similar enough to CodePress so that
code in html doesn't look ugly
1 #!/usr/bin/env perl
2 use warnings;
3 use strict;
4
5 use Jifty::Test tests => 3;
6 use Data::Dump qw/dump/;
7
8 # Make sure we can load the action
9 use_ok('Perly::SyntaxHighlight');
10
11 ok(my $html = Perly::SyntaxHighlight->color(<<'__END_OF_PERL__'
12 $foo = 42;
13 sub foo {
14 'foobar';
15 }
16 print 'foo';
17 print("bar");
18 __END_OF_PERL__
19 ), 'parse');
20
21 #diag dump( $html );
22
23 my $got_html = <<'__GENERATED_HTML__';
24 <div class="code"><a>$foo</a> = 42<u>;</u>
25 <b>sub</b> <b>foo</b> <u>{</u>
26 <s>'foobar'</s><u>;</u>
27 <u>}</u>
28 <b>print</b> <s>'foo'</s><u>;</u>
29 <b>print</b><u>(</u><s>"bar"</s><u>);</u>
30 </div>
31 __GENERATED_HTML__
32
33 chomp( $got_html );
34 is( $html, $got_html, 'html' );
35

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26