use Test; BEGIN { plan tests => 8 } use Text::Highlight; my $o = Text::Highlight->new(wrapper => "
%s
\n"); ok(1); my $html = <<'EOHTML'; Hello World!

Hello World!

World, this is me, saying "hello!"

EOHTML my $java = <<'EOJAVA'; //hello world! public class HelloWorld { public static final void main( String args[] ) { System.out.println("Hello World"); } } EOJAVA my $perl = <<'EOPERL'; #hello world! print "Hello World!\n"; EOPERL my $cpp = <<'EOCPP'; #include /* block */ //line int main(void) { cout << "Hello World!" << endl; return 0; } EOCPP my $css = <<'EOCSS'; body { background-color: #0060A0; /* Win2k default blue backgroundish */ color: white; } a:link { color: yellow } a:visited { color: #BAD1EA } /* lighter grey-blue */ a:hover { color: #00FF00 } /* bright, nasty green */ a:active { color: #FF8080F } /* I don't remember */ ul { list-style: circle outside; } EOCSS my $php = <<'EOPHP'; EOPHP my $sql = <<'EOSQL'; SELECT count(*) FROM tblFoo WHERE col = 'value'; INSERT INTO tblFoo (column) SELECT count(*) FROM tblFoo2; EOSQL ####################### HIGHLIGHTED CODE ############################## my $html_h = <<'EOH';
<html>
<head>
        <title>Hello World!</title>
</head>
<!-- Hello World! -->
<body>
<h2>Hello World!</h2>
<p class="center">
        <i>World, this is me, saying "hello!"</i>
</p>
</body>
</html>
EOH my $java_h = <<'EOH';
//hello world!
public class HelloWorld
{
  public static final void main( String args[] )
  {
     System.out.println("Hello World");
  }
}
EOH my $perl_h = <<'EOH';
#hello world!
print "Hello World!\n";
EOH my $cpp_h = <<'EOH';
#include <iostream>

/*
block
*/
//line
int main(void)
{
	cout << "Hello World!" << endl;
	return 0;
}
EOH my $css_h = <<'EOH';
body
{
	background-color: #0060A0; /* Win2k default blue backgroundish */
	color: white;
}

a:link { color: yellow }
a:visited { color: #BAD1EA } /* lighter grey-blue */
a:hover { color: #00FF00 }   /* bright, nasty green */
a:active { color: #FF8080F } /* I don't remember */

ul
{
	list-style: circle outside;
}
EOH my $php_h = <<'EOH';
<?
	#Hello World!
	echo "Hello World!"
?>
EOH my $sql_h = <<'EOH';
SELECT count(*) FROM tblFoo WHERE col = 'value';
INSERT INTO tblFoo (column) SELECT count(*) FROM tblFoo2;
EOH ok($o->highlight('HTML', $html, 'simple'), $html_h); ok($o->highlight('Java', $java), $java_h); ok($o->highlight('Perl', $perl), $perl_h); ok($o->highlight('CPP', $cpp), $cpp_h); ok($o->highlight('CSS', $css), $css_h); ok($o->highlight('PHP', $php), $php_h); ok($o->highlight('SQL', $sql), $sql_h);