You are here

function GeshiFilterTest::testBracketsOnlyAngle in GeSHi Filter for syntax highlighting 7

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

File

./geshifilter.test, line 341
Tests for the GeSHi filter module.

Class

GeshiFilterTest
Funcional tests for the GeSHi filter node content.

Code

function testBracketsOnlyAngle() {
  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 angle brackets
  variable_set('geshifilter_tag_styles', array(
    GESHIFILTER_BRACKETS_ANGLE => GESHIFILTER_BRACKETS_ANGLE,
  ));

  // This should be filtered.
  $this
    ->assertGeshiFilterHighlighting('<code language="cpp">' . $source_code . '</code>', array(
    array(
      $source_code,
      'cpp',
      0,
      1,
      FALSE,
    ),
  ), t('Checking angle brackets style in GESHIFILTER_BRACKETS_ANGLE mode'));

  // This should not be filtered.
  $this
    ->assertGeshiFilterHighlighting('[code language="cpp"]' . $source_code . '[/code]', array(
    array(
      $source_code,
      NULL,
      0,
      1,
      FALSE,
    ),
  ), t('Checking [foo] brackets style in GESHIFILTER_BRACKETS_ANGLE 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_ANGLE mode'));
  $this
    ->assertGeshiFilterHighlighting('<?php' . $source_code . '?>', array(
    array(
      $source_code,
      NULL,
      0,
      1,
      FALSE,
    ),
  ), t('Checking php code blocks in GESHIFILTER_BRACKETS_ANGLE mode'));
}