function GeshiFilterTest::testPrefixTags in GeSHi Filter for syntax highlighting 5.2
Same name and namespace in other branches
- 6 geshifilter.test \GeshiFilterTest::testPrefixTags()
- 7 geshifilter.test \GeshiFilterTest::testPrefixTags()
Test if tags like [cpp], [css], [csharp] aren't highjacked by [c]
File
- tests/
geshifilter.test, line 152
Class
- GeshiFilterTest
- Unit tests for the GeSHi filter module.
Code
function testPrefixTags() {
// enabled the tags
$this
->drupalVariableSet('geshifilter_language_enabled_c', TRUE);
$this
->drupalVariableSet('geshifilter_language_tags_c', 'c');
$this
->drupalVariableSet('geshifilter_language_enabled_cpp', TRUE);
$this
->drupalVariableSet('geshifilter_language_tags_cpp', 'cpp');
$this
->drupalVariableSet('geshifilter_language_enabled_csharp', TRUE);
$this
->drupalVariableSet('geshifilter_language_tags_csharp', 'csharp');
$this
->drupalVariableSet('geshifilter_language_enabled_css', TRUE);
$this
->drupalVariableSet('geshifilter_language_tags_css', 'css');
// Test the tags
$this
->assertGeshiFilterHighlighting('<cpp>', "//C++ source code\nfor (int i=0; i<10; ++i) {\n fun(i);\n}", '</cpp>', 'cpp', t('Source code in <cpp>...</cpp> should work when <c>...</c> is also enabled'));
$this
->assertGeshiFilterHighlighting('<csharp>', "//C# source code\nfor (int i=0; i<10; ++i) {\n fun(i);\n}", '</csharp>', 'csharp', t('Source code in <csharp>...</csharp> should work when <c>...</c> is also enabled'));
$this
->assertGeshiFilterHighlighting('<css>', "//CSS source code\nbody {\n color: black; text-align: right; \n}", '</css>', 'css', t('Source code in <css>...</css> should work when <c>...</c> is also enabled'));
}