use strict; use Test::More; BEGIN { plan tests => 9 } use Syntax::Highlight::Shell; my $highlighter = new Syntax::Highlight::Shell; my $expected = ''; ## testing an empty string is( $highlighter->parse(''), "
\n\n" ); #01 ## shebang (no end-of-line) is( $highlighter->parse('#!/bin/sh'), <<'HTML' ); #02
#!/bin/sh
HTML
## shebang
is( $highlighter->parse("#!/bin/sh\n"), <<'HTML' ); #03
#!/bin/sh
HTML
## comment
is( $highlighter->parse("# a comment\n"), <<'HTML' ); #04
# a comment
HTML
## keyword
is( $highlighter->parse('for'), <<'HTML' ); #05
for
HTML
## builtin
is( $highlighter->parse('eval'), <<'HTML' ); #06
eval
HTML
## expanded variable
is( $highlighter->parse('$variable'), <<'HTML' ); #07
$variable
HTML
## assigned variable
is( $highlighter->parse('variable_01=any_value'), <<'HTML' ); #08
variable_01=any_valueHTML ## value between quotes is( $highlighter->parse('"any kind of value"'), <<'HTML' ); #09
"any kind of value"HTML