Ignore:
Timestamp:
11/19/08 19:11:33 (4 years ago)
Author:
CrawfordCurrie
Message:

Item175: ported unit tests to new namespace. They all pass.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UnitTestContrib/test/unit/Fn_SECTION.pm

    r14 r816  
    55package Fn_SECTION; 
    66 
    7 use base qw( TWikiFnTestCase ); 
     7use base qw( FoswikiFnTestCase ); 
    88 
    9 use TWiki; 
     9use Foswiki; 
    1010use Error qw( :try ); 
    1111 
     
    2525    # Named section closed without being opened 
    2626    my $text = '0%ENDSECTION{"name"}%1'; 
    27     my( $nt, $s ) = TWiki::parseSections( $text ); 
     27    my( $nt, $s ) = Foswiki::parseSections( $text ); 
    2828    $this->assert_str_equals("01",$nt); 
    2929    $this->assert_str_equals('',dumpsec($s)); 
     
    3535    # Named section opened but never closed 
    3636    my $text = '0%STARTSECTION{"name"}%1'; 
    37     my ( $nt, $s ) = TWiki::parseSections( $text ); 
     37    my ( $nt, $s ) = Foswiki::parseSections( $text ); 
    3838    $this->assert_str_equals("01",$nt); 
    3939    $this->assert_str_equals('end="2" name="name" start="1" type="section"',dumpsec($s)); 
     
    4545    # Unnamed section closed without being opened 
    4646    my $text = '0%ENDSECTION%1'; 
    47     my ( $nt, $s ) = TWiki::parseSections( $text ); 
     47    my ( $nt, $s ) = Foswiki::parseSections( $text ); 
    4848    $this->assert_str_equals("01",$nt); 
    4949    $this->assert_str_equals('',dumpsec($s)); 
     
    5555    # Unnamed section opened but never closed 
    5656    my $text = '0%STARTSECTION%1'; 
    57     my ( $nt, $s ) = TWiki::parseSections( $text ); 
     57    my ( $nt, $s ) = Foswiki::parseSections( $text ); 
    5858    $this->assert_str_equals("01",$nt); 
    5959    $this->assert_str_equals('end="2" name="_SECTION0" start="1" type="section"',dumpsec($s)); 
     
    6565    # Unnamed section closed by opening another section of the same type 
    6666    my $text = '0%STARTSECTION%1%STARTSECTION%2'; 
    67     my ( $nt, $s ) = TWiki::parseSections( $text ); 
     67    my ( $nt, $s ) = Foswiki::parseSections( $text ); 
    6868    $this->assert_str_equals("012",$nt); 
    6969    $this->assert_str_equals('end="2" name="_SECTION0" start="1" type="section";end="3" name="_SECTION1" start="2" type="section"',dumpsec($s)); 
     
    7575    # Named section overlaps unnamed section before it 
    7676    my $text = '0%STARTSECTION%1%STARTSECTION{"named"}%2%ENDSECTION%3%ENDSECTION{"named"}%4'; 
    77     my ( $nt, $s ) = TWiki::parseSections( $text ); 
     77    my ( $nt, $s ) = Foswiki::parseSections( $text ); 
    7878    $this->assert_str_equals("01234",$nt); 
    7979    $this->assert_str_equals('end="2" name="_SECTION0" start="1" type="section";end="4" name="named" start="2" type="section"',dumpsec($s)); 
     
    8585    # Named section overlaps unnamed section after it 
    8686    my $text = '0%STARTSECTION{"named"}%1%STARTSECTION%2%ENDSECTION{"named"}%3%ENDSECTION%4'; 
    87     my ( $nt, $s ) = TWiki::parseSections( $text ); 
     87    my ( $nt, $s ) = Foswiki::parseSections( $text ); 
    8888    $this->assert_str_equals("01234",$nt); 
    8989    $this->assert_str_equals('end="3" name="named" start="1" type="section";end="4" name="_SECTION0" start="2" type="section"',dumpsec($s)); 
     
    9595    # Unnamed sections of different types overlap 
    9696    my $text = '0%STARTSECTION{type="include"}%1%STARTSECTION{type="templateonly"}%2%ENDSECTION{type="include"}%3%ENDSECTION{type="templateonly"}%4'; 
    97     my ( $nt, $s ) = TWiki::parseSections( $text ); 
     97    my ( $nt, $s ) = Foswiki::parseSections( $text ); 
    9898    $this->assert_str_equals("01234",$nt); 
    9999    $this->assert_str_equals('end="3" name="_SECTION0" start="1" type="include";end="4" name="_SECTION1" start="2" type="templateonly"',dumpsec($s)); 
     
    105105    # Named sections of same type overlap 
    106106    my $text = '0%STARTSECTION{"one"}%1%STARTSECTION{"two"}%2%ENDSECTION{"one"}%3%ENDSECTION{"two"}%4'; 
    107     my ( $nt, $s ) = TWiki::parseSections( $text ); 
     107    my ( $nt, $s ) = Foswiki::parseSections( $text ); 
    108108    $this->assert_str_equals("01234",$nt); 
    109109    $this->assert_str_equals('end="3" name="one" start="1" type="section";end="4" name="two" start="2" type="section"',dumpsec($s)); 
     
    115115    # Named sections nested 
    116116    my $text = '0%STARTSECTION{name="one"}%1%STARTSECTION{name="two"}%2%ENDSECTION{name="two"}%3%ENDSECTION{name="one"}%4'; 
    117     my ( $nt, $s ) = TWiki::parseSections( $text ); 
     117    my ( $nt, $s ) = Foswiki::parseSections( $text ); 
    118118    $this->assert_str_equals("01234",$nt); 
    119119    $this->assert_str_equals('end="4" name="one" start="1" type="section";end="3" name="two" start="2" type="section"',dumpsec($s)); 
Note: See TracChangeset for help on using the changeset viewer.