function GeshiFilterTest::testBracketsOnlyDoubleSquare in GeSHi Filter for syntax highlighting 6
Same name and namespace in other branches
- 7 geshifilter.test \GeshiFilterTest::testBracketsOnlyDoubleSquare()
File
- ./
geshifilter.test, line 387 - Tests for the GeSHi filter module.
Class
Code
function testBracketsOnlyDoubleSquare() {
variable_set('geshifilter_tags', 'code');
variable_set('geshifilter_language_enabled_cpp', TRUE);
$source_code = "//C++ source code\nfor (int i=0; i<10; ++i) {\n fun(i);\n bar.foo(x, y);\n server->start(&pool); \n}";
// Enable only double square brackets
variable_set('geshifilter_tag_styles', array(
GESHIFILTER_BRACKETS_DOUBLESQUARE => GESHIFILTER_BRACKETS_DOUBLESQUARE,
));
// This should be filtered.
$this
->assertGeshiFilterHighlighting('[[code language="cpp"]]' . $source_code . '[[/code]]', array(
array(
$source_code,
'cpp',
0,
1,
FALSE,
),
), t('Checking [[foo]] brackets style in GESHIFILTER_BRACKETS_DOUBLESQUARE mode'));
// This should not be filtered.
$this
->assertGeshiFilterHighlighting('<code language="cpp">' . $source_code . '</code>', array(
array(
$source_code,
NULL,
0,
1,
FALSE,
),
), t('Checking angle brackets style in GESHIFILTER_BRACKETS_DOUBLESQUARE mode'));
$this
->assertGeshiFilterHighlighting('[code language="cpp"]' . $source_code . '[/code]', array(
array(
$source_code,
NULL,
0,
1,
FALSE,
),
), t('Checking [foo] brackets style in GESHIFILTER_BRACKETS_DOUBLESQUARE mode'));
$this
->assertGeshiFilterHighlighting('<?php' . $source_code . '?>', array(
array(
$source_code,
NULL,
0,
1,
FALSE,
),
), t('Checking php code blocks in GESHIFILTER_BRACKETS_DOUBLESQUARE mode'));
}