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/FormattingTests.pm

    r766 r816  
    55package FormattingTests; 
    66 
    7 use base qw( TWikiFnTestCase ); 
    8  
    9 use TWiki; 
     7use base qw( FoswikiFnTestCase ); 
     8 
     9use Foswiki; 
    1010use Error qw( :try ); 
    1111 
     
    2828    $this->{twiki}->{store}->saveTopic( 
    2929        $this->{twiki}->{user}, $this->{test_web}, 
    30         $TWiki::cfg{HomeTopicName}, "BLEEGLE"); 
     30        $Foswiki::cfg{HomeTopicName}, "BLEEGLE"); 
    3131    $this->{twiki}->{store}->saveTopic( 
    3232        $this->{twiki}->{user}, $this->{test_web}, 
    3333        'Numeric1Wikiword', "BLEEGLE"); 
    34     $TWiki::cfg{AntiSpam}{RobotsAreWelcome} = 1; 
    35     $TWiki::cfg{AntiSpam}{EmailPadding} = 'STUFFED'; 
    36     $TWiki::cfg{AllowInlineScript} = 1; 
     34    $Foswiki::cfg{AntiSpam}{RobotsAreWelcome} = 1; 
     35    $Foswiki::cfg{AntiSpam}{EmailPadding} = 'STUFFED'; 
     36    $Foswiki::cfg{AllowInlineScript} = 1; 
    3737} 
    3838 
     
    6767    my $this = shift; 
    6868    my $expected = <<EXPECTED; 
    69 <a class="twikiCurrentWebHomeLink twikiLink" href="$this->{sup}/$this->{test_web}/$TWiki::cfg{HomeTopicName}">$TWiki::cfg{HomeTopicName}</a> 
    70 EXPECTED 
    71  
    72     my $actual = <<ACTUAL; 
    73 $TWiki::cfg{HomeTopicName} 
     69<a class="twikiCurrentWebHomeLink twikiLink" href="$this->{sup}/$this->{test_web}/$Foswiki::cfg{HomeTopicName}">$Foswiki::cfg{HomeTopicName}</a> 
     70EXPECTED 
     71 
     72    my $actual = <<ACTUAL; 
     73$Foswiki::cfg{HomeTopicName} 
    7474ACTUAL 
    7575    $this->do_test($expected, $actual); 
     
    8080    my $this = shift; 
    8181    my $expected = <<EXPECTED; 
    82 <a class="twikiCurrentWebHomeLink twikiLink" href="$this->{sup}/$this->{test_web}/$TWiki::cfg{HomeTopicName}">$TWiki::cfg{HomeTopicName}</a> 
    83 EXPECTED 
    84  
    85     my $actual = <<ACTUAL; 
    86 [[$TWiki::cfg{HomeTopicName}]] 
     82<a class="twikiCurrentWebHomeLink twikiLink" href="$this->{sup}/$this->{test_web}/$Foswiki::cfg{HomeTopicName}">$Foswiki::cfg{HomeTopicName}</a> 
     83EXPECTED 
     84 
     85    my $actual = <<ACTUAL; 
     86[[$Foswiki::cfg{HomeTopicName}]] 
    8787ACTUAL 
    8888    $this->do_test($expected, $actual); 
     
    9393    my $this = shift; 
    9494    my $expected = <<EXPECTED; 
    95 <a class="twikiLink" href="$this->{sup}/$TWiki::cfg{SystemWebName}/$TWiki::cfg{HomeTopicName}">$TWiki::cfg{SystemWebName}.$TWiki::cfg{HomeTopicName}</a> 
    96 EXPECTED 
    97  
    98     my $actual = <<ACTUAL; 
    99 [[$TWiki::cfg{SystemWebName}.$TWiki::cfg{HomeTopicName}]] 
     95<a class="twikiLink" href="$this->{sup}/$Foswiki::cfg{SystemWebName}/$Foswiki::cfg{HomeTopicName}">$Foswiki::cfg{SystemWebName}.$Foswiki::cfg{HomeTopicName}</a> 
     96EXPECTED 
     97 
     98    my $actual = <<ACTUAL; 
     99[[$Foswiki::cfg{SystemWebName}.$Foswiki::cfg{HomeTopicName}]] 
    100100ACTUAL 
    101101    $this->do_test($expected, $actual); 
     
    106106    my $this = shift; 
    107107    my $expected = <<EXPECTED; 
    108 <a class="twikiLink" href="$this->{sup}/$TWiki::cfg{SystemWebName}/$TWiki::cfg{HomeTopicName}">Alt <nop>TextAlt</a> 
    109 EXPECTED 
    110  
    111     my $actual = <<ACTUAL; 
    112 [[$TWiki::cfg{SystemWebName}.$TWiki::cfg{HomeTopicName}][Alt TextAlt]] 
     108<a class="twikiLink" href="$this->{sup}/$Foswiki::cfg{SystemWebName}/$Foswiki::cfg{HomeTopicName}">Alt <nop>TextAlt</a> 
     109EXPECTED 
     110 
     111    my $actual = <<ACTUAL; 
     112[[$Foswiki::cfg{SystemWebName}.$Foswiki::cfg{HomeTopicName}][Alt TextAlt]] 
    113113ACTUAL 
    114114    $this->do_test($expected, $actual); 
     
    119119    my $this = shift; 
    120120    my $expected = <<EXPECTED; 
    121 <a href="$this->{sup}/$TWiki::cfg{SystemWebName}/$TWiki::cfg{HomeTopicName}" target="_top">Alt <nop>TextAlt</a> 
    122 EXPECTED 
    123  
    124     my $actual = <<ACTUAL; 
    125 [[$this->{sup}/$TWiki::cfg{SystemWebName}/$TWiki::cfg{HomeTopicName} Alt TextAlt]] 
     121<a href="$this->{sup}/$Foswiki::cfg{SystemWebName}/$Foswiki::cfg{HomeTopicName}" target="_top">Alt <nop>TextAlt</a> 
     122EXPECTED 
     123 
     124    my $actual = <<ACTUAL; 
     125[[$this->{sup}/$Foswiki::cfg{SystemWebName}/$Foswiki::cfg{HomeTopicName} Alt TextAlt]] 
    126126ACTUAL 
    127127    $this->do_test($expected, $actual); 
     
    131131    my $this = shift; 
    132132    my $expected = <<EXPECTED; 
    133 <nop>$TWiki::cfg{HomeTopicName} 
    134 EXPECTED 
    135  
    136     my $actual = <<ACTUAL; 
    137 !$TWiki::cfg{HomeTopicName} 
     133<nop>$Foswiki::cfg{HomeTopicName} 
     134EXPECTED 
     135 
     136    my $actual = <<ACTUAL; 
     137!$Foswiki::cfg{HomeTopicName} 
    138138ACTUAL 
    139139    $this->do_test($expected, $actual); 
     
    143143    my $this = shift; 
    144144    my $expected = <<EXPECTED; 
    145 [<nop>[$TWiki::cfg{SystemWebName}.$TWiki::cfg{HomeTopicName}]] 
    146 EXPECTED 
    147  
    148     my $actual = <<ACTUAL; 
    149 ![[$TWiki::cfg{SystemWebName}.$TWiki::cfg{HomeTopicName}]] 
     145[<nop>[$Foswiki::cfg{SystemWebName}.$Foswiki::cfg{HomeTopicName}]] 
     146EXPECTED 
     147 
     148    my $actual = <<ACTUAL; 
     149![[$Foswiki::cfg{SystemWebName}.$Foswiki::cfg{HomeTopicName}]] 
    150150ACTUAL 
    151151    $this->do_test($expected, $actual); 
     
    155155    my $this = shift; 
    156156    my $expected = <<EXPECTED; 
    157 [<nop>[$this->{test_web}.$TWiki::cfg{HomeTopicName}]] 
    158 EXPECTED 
    159  
    160     my $actual = <<ACTUAL; 
    161 [<nop>[$this->{test_web}.$TWiki::cfg{HomeTopicName}]] 
     157[<nop>[$this->{test_web}.$Foswiki::cfg{HomeTopicName}]] 
     158EXPECTED 
     159 
     160    my $actual = <<ACTUAL; 
     161[<nop>[$this->{test_web}.$Foswiki::cfg{HomeTopicName}]] 
    162162ACTUAL 
    163163    $this->do_test($expected, $actual); 
     
    299299 
    300300    my $actual = <<ACTUAL; 
    301 [[system.WebRss Base]] 
     301[[System.WebRss Base]] 
    302302ACTUAL 
    303303    $this->do_test($expected, $actual); 
     
    535535sub test_Item3431a { 
    536536    my $this = shift; 
    537     $TWiki::cfg{AllowInlineScript} = 1; 
     537    $Foswiki::cfg{AllowInlineScript} = 1; 
    538538    my $expected = <<EXPECTED; 
    539539<script> 
     
    549549    $this->do_test($expected, $actual); 
    550550 
    551     $TWiki::cfg{AllowInlineScript} = 0; 
     551    $Foswiki::cfg{AllowInlineScript} = 0; 
    552552    $expected = <<EXPECTED; 
    553553<!-- <script> is not allowed on this site --> 
     
    581581sub test_mailWithoutMailto { 
    582582    my $this = shift; 
    583     $TWiki::cfg{AntiSpam}{HideUserDetails} = 0; 
     583    $Foswiki::cfg{AntiSpam}{HideUserDetails} = 0; 
    584584    my $expected = <<EXPECTED; 
    585585<a href="mailto:pitiful\@exampleSTUFFED.com">mailto:pitiful\@exampleSTUFFED.com</a> 
     
    594594sub test_protocols { 
    595595    my $this = shift; 
    596     $TWiki::cfg{AntiSpam}{HideUserDetails} = 0; 
     596    $Foswiki::cfg{AntiSpam}{HideUserDetails} = 0; 
    597597    my %urls = ( 
    598598        'file://fnurfle' => 0, 
     
    628628 
    629629    # mailto URL in double squabs 
    630     $TWiki::cfg{AntiSpam}{HideUserDetails} = 0; 
     630    $Foswiki::cfg{AntiSpam}{HideUserDetails} = 0; 
    631631    my $expected = <<EXPECTED; 
    632632<a href="mailto:flip\@exampleSTUFFED.com">Oh smeg</a> 
     
    637637    $this->do_test($expected, $actual); 
    638638 
    639     $TWiki::cfg{AntiSpam}{HideUserDetails} = 1; 
     639    $Foswiki::cfg{AntiSpam}{HideUserDetails} = 1; 
    640640    $expected = <<EXPECTED; 
    641641<a href="mailto:flip\@exampleSTUFFED.com">Oh smeg</a> 
Note: See TracChangeset for help on using the changeset viewer.