~ubuntu-branches/ubuntu/oneiric/bugzilla/oneiric

« back to all changes in this revision

Viewing changes to t/006spellcheck.t

  • Committer: Bazaar Package Importer
  • Author(s): Raphael Bossek
  • Date: 2008-06-27 22:34:34 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20080627223434-0ib57vstn43bb4a3
Tags: 3.0.4.1-1
* Update of French, Russian and German translations. (closes: #488251)
* Added Bulgarian and Belarusian translations.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# -*- Mode: perl; indent-tabs-mode: nil -*-
2
 
#
3
 
# The contents of this file are subject to the Mozilla Public
4
 
# License Version 1.1 (the "License"); you may not use this file
5
 
# except in compliance with the License. You may obtain a copy of
6
 
# the License at http://www.mozilla.org/MPL/
7
 
8
 
# Software distributed under the License is distributed on an "AS
9
 
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
10
 
# implied. See the License for the specific language governing
11
 
# rights and limitations under the License.
12
 
13
 
# The Original Code are the Bugzilla Tests.
14
 
15
 
# The Initial Developer of the Original Code is Zach Lipton
16
 
# Portions created by Zach Lipton are 
17
 
# Copyright (C) 2002 Zach Lipton.  All
18
 
# Rights Reserved.
19
 
20
 
# Contributor(s): Zach Lipton <zach@zachlipton.com>
21
 
 
22
 
 
23
 
#################
24
 
#Bugzilla Test 6#
25
 
####Spelling#####
26
 
 
27
 
use lib 't';
28
 
use Support::Files;
29
 
 
30
 
BEGIN { # yes the indenting is off, deal with it
31
 
#add the words to check here:
32
 
@evilwords = qw(
33
 
anyways
34
 
arbitary
35
 
databasa
36
 
dependan
37
 
existance
38
 
existant
39
 
paramater
40
 
varsion
41
 
);
42
 
 
43
 
$testcount = scalar(@Support::Files::testitems);
44
 
}
45
 
 
46
 
use Test::More tests => $testcount;
47
 
 
48
 
# Capture the TESTOUT from Test::More or Test::Builder for printing errors.
49
 
# This will handle verbosity for us automatically.
50
 
my $fh;
51
 
{
52
 
    local $^W = 0;  # Don't complain about non-existent filehandles
53
 
    if (-e \*Test::More::TESTOUT) {
54
 
        $fh = \*Test::More::TESTOUT;
55
 
    } elsif (-e \*Test::Builder::TESTOUT) {
56
 
        $fh = \*Test::Builder::TESTOUT;
57
 
    } else {
58
 
        $fh = \*STDOUT;
59
 
    }
60
 
}
61
 
 
62
 
my @testitems = @Support::Files::testitems;
63
 
 
64
 
# at last, here we actually run the test...
65
 
my $evilwordsregexp = join('|', @evilwords);
66
 
 
67
 
foreach my $file (@testitems) {
68
 
    $file =~ s/\s.*$//; # nuke everything after the first space (#comment)
69
 
    next if (!$file); # skip null entries
70
 
 
71
 
    if (open (FILE, $file)) { # open the file for reading
72
 
 
73
 
        my $found_word = '';
74
 
 
75
 
        while (my $file_line = <FILE>) { # and go through the file line by line
76
 
            if ($file_line =~ /($evilwordsregexp)/i) { # found an evil word
77
 
                $found_word = $1;
78
 
                last;
79
 
            }
80
 
        }
81
 
            
82
 
        close (FILE);
83
 
            
84
 
        if ($found_word) {
85
 
            ok(0,"$file: found SPELLING ERROR $found_word --WARNING");
86
 
        } else {
87
 
            ok(1,"$file does not contain registered spelling errors");
88
 
        }
89
 
    } else {
90
 
        ok(0,"could not open $file for spellcheck --WARNING");
91
 
    }
92
 
93
 
 
94
 
exit 0;