You are here

function GeshiFilterTest::testSpecialTags in GeSHi Filter for syntax highlighting 5.2

Same name and namespace in other branches
  1. 6 geshifilter.test \GeshiFilterTest::testSpecialTags()
  2. 7 geshifilter.test \GeshiFilterTest::testSpecialTags()

Check if tags like [c++] and [c#] work Problem described in http://drupal.org/node/208720

File

tests/geshifilter.test, line 132

Class

GeshiFilterTest
Unit tests for the GeSHi filter module.

Code

function testSpecialTags() {

  // Enabled the tags
  $this
    ->drupalVariableSet('geshifilter_language_enabled_cpp', TRUE);
  $this
    ->drupalVariableSet('geshifilter_language_tags_cpp', 'c++');
  $this
    ->drupalVariableSet('geshifilter_language_enabled_csharp', TRUE);
  $this
    ->drupalVariableSet('geshifilter_language_tags_csharp', 'c#');

  // Test the tags
  $this
    ->assertGeshiFilterHighlighting('<c++>', "//C++ source code\nfor (int i=0; i<10; ++i) {\n  fun(i);\n}", '</c++>', 'cpp', t('Source code in <c++>...</c++> should work'));
  $this
    ->assertGeshiFilterHighlighting('[c++]', "//C++ source code\nfor (int i=0; i<10; ++i) {\n  fun(i);\n}", '[/c++]', 'cpp', t('Source code in [c++]...[/c++] should work'));
  $this
    ->assertGeshiFilterHighlighting('<c#>', "//C# source code\nfor (int i=0; i<10; ++i) {\n  fun(i);\n}", '</c#>', 'csharp', t('Source code in <c#>...</c#> should work'));
  $this
    ->assertGeshiFilterHighlighting('[c#]', "//C# source code\nfor (int i=0; i<10; ++i) {\n  fun(i);\n}", '[/c#]', 'csharp', t('Source code in [c#]...[/c#] should work'));
}