function GeshiFilterTest::testDoNothingMode in GeSHi Filter for syntax highlighting 7
Same name and namespace in other branches
- 6 geshifilter.test \GeshiFilterTest::testDoNothingMode()
File
- ./
geshifilter.test, line 481 - Tests for the GeSHi filter module.
Class
- GeshiFilterTest
- Funcional tests for the GeSHi filter node content.
Code
function testDoNothingMode() {
// Enable C++.
variable_set('geshifilter_language_enabled_cpp', TRUE);
variable_set('geshifilter_language_tags_cpp', 'cpp');
// Set default highlighting mode to "do nothing".
variable_set('geshifilter_default_highlighting', GESHIFILTER_DEFAULT_DONOTHING);
// Body material with some characters ('<' and '&') that would be escaped
// except in "do nothing" mode
$source_code = "//C++-ish source code\nfor (int i=0; i!=10; ++i) {\n fun(i);\n bar.foo(x, y);\n}";
// Tests
$this
->assertGeshiFilterHighlighting('<code>' . $source_code . '</code>', array(
array(
'<code>' . $source_code . '</code>',
FALSE,
0,
1,
FALSE,
),
), t('Do nothing mode should not touch given source code'));
$this
->assertGeshiFilterHighlighting('<code language="cpp">' . $source_code . '</code>', array(
array(
$source_code,
'cpp',
0,
1,
FALSE,
),
), t('Highlighting with language="cpp" should work when default is "do nothing"'));
$this
->assertGeshiFilterHighlighting('<cpp>' . $source_code . '</cpp>', array(
array(
$source_code,
'cpp',
0,
1,
FALSE,
),
), t('Highlighting with <cpp>...</cpp> should work when default is "do nothing"'));
}