summaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2016-09-12 22:22:17 +0200
committerDylan William Hardison <dylan@hardison.net>2016-09-12 22:22:17 +0200
commit14bcdce1dc6029c3676c3640d8148c83c14692e5 (patch)
tree99d760e13b687f8111635916d9ed3937bc084c64 /t
parente6bf4cacb10f86077fe898349485f5c7ab9fb4b6 (diff)
downloadbugzilla-14bcdce1dc6029c3676c3640d8148c83c14692e5.tar.gz
bugzilla-14bcdce1dc6029c3676c3640d8148c83c14692e5.tar.xz
Revert "Bug 1283930 - Add Makefile.PL & local/lib/perl5 support to bmo/master + local symlink to data/ directory"
Diffstat (limited to 't')
-rw-r--r--t/001compile.t45
-rw-r--r--t/002goodperl.t89
-rw-r--r--t/003safesys.t73
-rw-r--r--t/004template.t62
-rw-r--r--t/005whitespace.t37
-rw-r--r--t/006spellcheck.t84
-rw-r--r--t/007util.t48
-rw-r--r--t/008filter.t40
-rw-r--r--t/009bugwords.t38
-rw-r--r--t/010dependencies.t29
-rw-r--r--t/011pod.t28
-rw-r--r--t/012throwables.t40
-rw-r--r--t/013remote_ip.t82
-rw-r--r--t/Support/Files.pm61
-rw-r--r--t/Support/Systemexec.pm21
-rw-r--r--t/Support/Templates.pm70
16 files changed, 555 insertions, 292 deletions
diff --git a/t/001compile.t b/t/001compile.t
index f8ba8d1c7..a2176babd 100644
--- a/t/001compile.t
+++ b/t/001compile.t
@@ -1,31 +1,41 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+# -*- Mode: perl; indent-tabs-mode: nil -*-
#
-# This Source Code Form is "Incompatible With Secondary Licenses", as
-# defined by the Mozilla Public License, v. 2.0.
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code are the Bugzilla Tests.
+#
+# The Initial Developer of the Original Code is Zach Lipton
+# Portions created by Zach Lipton are Copyright (C) 2001 Zach Lipton.
+# All Rights Reserved.
+#
+# Contributor(s): Zach Lipton <zach@zachlipton.com>
+# Max Kanat-Alexander <mkanat@bugzilla.org>
#################
#Bugzilla Test 1#
###Compilation###
-use 5.10.1;
use strict;
-use warnings;
-
-use lib qw(. lib local/lib/perl5 t);
+use 5.008001;
+use lib qw(. lib t);
use Config;
use Support::Files;
-use Test::More tests => scalar(@Support::Files::testitems)
- + scalar(@Support::Files::test_files);
+use Test::More tests => scalar(@Support::Files::testitems);
BEGIN {
use_ok('Bugzilla::Constants');
use_ok('Bugzilla::Install::Requirements');
use_ok('Bugzilla');
}
-Bugzilla->usage_mode(USAGE_MODE_TEST);
sub compile_file {
my ($file) = @_;
@@ -55,12 +65,12 @@ sub compile_file {
$T = "T";
}
- my $libs = '-It ';
+ my $libs = '';
if ($ENV{PERL5LIB}) {
- $libs .= join " ", map { "-I\"$_\"" } split /$Config{path_sep}/, $ENV{PERL5LIB};
+ $libs = join " ", map { "-I\"$_\"" } split /$Config{path_sep}/, $ENV{PERL5LIB};
}
my $perl = qq{"$^X"};
- my $output = `$perl $libs -c$T -MSupport::Systemexec $file 2>&1`;
+ my $output = `$perl $libs -wc$T $file 2>&1`;
chomp($output);
my $return_val = $?;
$output =~ s/^\Q$file\E syntax OK$//ms;
@@ -68,7 +78,7 @@ sub compile_file {
ok(!$return_val, $file) or diag('--ERROR');
}
-my @testitems = (@Support::Files::testitems, @Support::Files::test_files);
+my @testitems = @Support::Files::testitems;
my $file_features = map_files_to_features();
# Test the scripts by compiling them
@@ -92,7 +102,8 @@ foreach my $file (@testitems) {
and $file ne "Bugzilla/DB/Schema.pm")
{
my $module = lc($1);
- Bugzilla->feature($module) or skip "$file: Driver for $module not installed", 1;
+ my $dbd = DB_MODULE->{$module}->{dbd}->{module};
+ eval("use $dbd; 1") or skip "$file: $dbd not installed", 1;
}
compile_file($file);
diff --git a/t/002goodperl.t b/t/002goodperl.t
index 7b2e74acc..77b014f6a 100644
--- a/t/002goodperl.t
+++ b/t/002goodperl.t
@@ -1,28 +1,40 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-# This Source Code Form is "Incompatible With Secondary Licenses", as
-# defined by the Mozilla Public License, v. 2.0.
+# -*- Mode: perl; indent-tabs-mode: nil -*-
+#
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code are the Bugzilla Tests.
+#
+# The Initial Developer of the Original Code is Zach Lipton
+# Portions created by Zach Lipton are
+# Copyright (C) 2001 Zach Lipton. All
+# Rights Reserved.
+#
+# Contributor(s): Zach Lipton <zach@zachlipton.com>
+# Jacob Steenhagen <jake@bugzilla.org>
+# David D. Kilzer <ddkilzer@theracingworld.com>
#################
#Bugzilla Test 2#
####GoodPerl#####
-use 5.10.1;
use strict;
-use warnings;
-use lib qw(. lib local/lib/perl5 t);
+use lib 't';
use Support::Files;
-use Test::More tests => (scalar(@Support::Files::testitems)
- + scalar(@Support::Files::test_files)) * 6;
+use Test::More tests => (scalar(@Support::Files::testitems) * 4);
-my @testitems = (@Support::Files::test_files, @Support::Files::testitems);
-my @require_taint = qw(email_in.pl importxml.pl mod_perl.pl whine.pl);
+my @testitems = @Support::Files::testitems; # get the files to test.
foreach my $file (@testitems) {
$file =~ s/\s.*$//; # nuke everything after the first space (#comment)
@@ -37,38 +49,28 @@ foreach my $file (@testitems) {
my $ext = $1;
if ($file_line1 !~ m/^#\!/) {
- ok(1,"$file does not have a shebang");
+ ok(1,"$file does not have a shebang");
} else {
my $flags;
- if (!defined $ext || $ext eq 'pl' || $ext eq 'psgi') {
+ if (!defined $ext || $ext eq "pl") {
# standalone programs aren't taint checked yet
- if (grep { $file eq $_ } @require_taint) {
- $flags = 'T';
- }
- else {
- $flags = '';
- }
+ $flags = "w";
} elsif ($ext eq "pm") {
ok(0, "$file is a module, but has a shebang");
next;
} elsif ($ext eq "cgi") {
# cgi files must be taint checked
- $flags = 'T';
+ $flags = "wT";
} else {
ok(0, "$file has shebang but unknown extension");
next;
}
- if ($file_line1 =~ m#^\#\!/usr/bin/perl(?:\s-(\w+))?$#) {
- my $file_flags = $1 || '';
- if ($flags eq $file_flags) {
- ok(1, "$file uses standard perl location" . ($flags ? " and -$flags flag" : ""));
- }
- elsif ($flags) {
- ok(0, "$file is MISSING -$flags flag --WARNING");
- }
- else {
- ok(0, "$file has unexpected -$file_flags flag --WARNING");
+ if ($file_line1 =~ m#^\#\!/usr/bin/perl\s#) {
+ if ($file_line1 =~ m#\s-$flags#) {
+ ok(1,"$file uses standard perl location and -$flags");
+ } else {
+ ok(0,"$file is MISSING -$flags --WARNING");
}
} else {
ok(0,"$file uses non-standard perl location");
@@ -77,10 +79,7 @@ foreach my $file (@testitems) {
}
foreach my $file (@testitems) {
- my $found_use_perl = 0;
my $found_use_strict = 0;
- my $found_use_warnings = 0;
-
$file =~ s/\s.*$//; # nuke everything after the first space (#comment)
next if (!$file); # skip null entries
if (! open (FILE, $file)) {
@@ -88,29 +87,17 @@ foreach my $file (@testitems) {
next;
}
while (my $file_line = <FILE>) {
- $found_use_perl = 1 if $file_line =~ m/^\s*use 5.10.1/;
- $found_use_strict = 1 if $file_line =~ m/^\s*use strict/;
- $found_use_warnings = 1 if $file_line =~ m/^\s*use warnings/;
- last if ($found_use_perl && $found_use_strict && $found_use_warnings);
+ if ($file_line =~ m/^\s*use strict/) {
+ $found_use_strict = 1;
+ last;
+ }
}
close (FILE);
- if ($found_use_perl) {
- ok(1,"$file requires Perl 5.10.1");
- } else {
- ok(0,"$file DOES NOT require Perl 5.10.1 --WARNING");
- }
-
if ($found_use_strict) {
ok(1,"$file uses strict");
} else {
ok(0,"$file DOES NOT use strict --WARNING");
}
-
- if ($found_use_warnings) {
- ok(1,"$file uses warnings");
- } else {
- ok(0,"$file DOES NOT use warnings --WARNING");
- }
}
# Check to see that all error messages use tags (for l10n reasons.)
diff --git a/t/003safesys.t b/t/003safesys.t
new file mode 100644
index 000000000..a69500b7a
--- /dev/null
+++ b/t/003safesys.t
@@ -0,0 +1,73 @@
+# -*- Mode: perl; indent-tabs-mode: nil -*-
+#
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code are the Bugzilla Tests.
+#
+# The Initial Developer of the Original Code is Zach Lipton
+# Portions created by Zach Lipton are
+# Copyright (C) 2001 Zach Lipton. All
+# Rights Reserved.
+#
+# Contributor(s): Zach Lipton <zach@zachlipton.com>
+
+
+#################
+#Bugzilla Test 3#
+###Safesystem####
+
+use strict;
+
+use lib 't';
+
+use Support::Files;
+use File::Slurp;
+
+use Test::More tests => scalar(@Support::Files::testitems);
+
+# Capture the TESTOUT from Test::More or Test::Builder for printing errors.
+# This will handle verbosity for us automatically.
+my $fh;
+{
+ local $^W = 0; # Don't complain about non-existent filehandles
+ if (-e \*Test::More::TESTOUT) {
+ $fh = \*Test::More::TESTOUT;
+ } elsif (-e \*Test::Builder::TESTOUT) {
+ $fh = \*Test::Builder::TESTOUT;
+ } else {
+ $fh = \*STDOUT;
+ }
+}
+
+my @testitems = @Support::Files::testitems;
+my $perlapp = "\"$^X\"";
+
+foreach my $file (@testitems) {
+ $file =~ s/\s.*$//; # nuke everything after the first space (#comment)
+ next if (!$file); # skip null entries
+
+ my $contents = read_file($file);
+ if ($contents !~ /\b(system|exec)\b/) {
+ ok(1,"$file does not contain any system or exec calls");
+ next;
+ }
+
+ my $command = "$perlapp -c -It -MSupport::Systemexec $file 2>&1";
+ my $loginfo=`$command`;
+ if ($loginfo =~ /arguments for Support::Systemexec::(system|exec)/im) {
+ ok(0,"$file DOES NOT use proper system or exec calls");
+ print $fh $loginfo;
+ } else {
+ ok(1,"$file uses proper system and exec calls");
+ }
+}
+
+exit 0;
diff --git a/t/004template.t b/t/004template.t
index 909f1a231..666ce5fa4 100644
--- a/t/004template.t
+++ b/t/004template.t
@@ -1,19 +1,35 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+# -*- Mode: perl; indent-tabs-mode: nil -*-
+#
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code are the Bugzilla tests.
+#
+# The Initial Developer of the Original Code is Jacob Steenhagen.
+# Portions created by Jacob Steenhagen are
+# Copyright (C) 2001 Jacob Steenhagen. All
+# Rights Reserved.
+#
+# Contributor(s): Jacob Steenhagen <jake@bugzilla.org>
+# Zach Lipton <zach@zachlipton.com>
+# David D. Kilzer <ddkilzer@kilzer.net>
+# Tobias Burnus <burnus@net-b.de>
#
-# This Source Code Form is "Incompatible With Secondary Licenses", as
-# defined by the Mozilla Public License, v. 2.0.
#################
#Bugzilla Test 4#
####Templates####
-use 5.10.1;
use strict;
-use warnings;
-use lib qw(. lib local/lib/perl5 t);
+use lib 't';
use Support::Templates;
@@ -28,7 +44,7 @@ use Test::More tests => ( scalar(@referenced_files) + 2 * $num_actual_files );
# This will handle verbosity for us automatically.
my $fh;
{
- no warnings qw(unopened); # Don't complain about non-existent filehandles
+ local $^W = 0; # Don't complain about non-existent filehandles
if (-e \*Test::More::TESTOUT) {
$fh = \*Test::More::TESTOUT;
} elsif (-e \*Test::Builder::TESTOUT) {
@@ -39,21 +55,22 @@ my $fh;
}
# Check to make sure all templates that are referenced in Bugzilla
-# exist in the proper place in the English template or extension directory.
+# exist in the proper place in the English template directory.
# All other languages may or may not include any template as Bugzilla will
# fall back to English if necessary.
foreach my $file (@referenced_files) {
- my $found = 0;
- foreach my $path (@english_default_include_paths) {
- my $pathfile = File::Spec->catfile($path, $file);
- if (-e $pathfile) {
- $found = 1;
- last;
- }
+ my @path = map(File::Spec->catfile($_, $file), @include_paths);
+ push(@path, File::Spec->catfile($english_default_include_path, $file));
+ my $found;
+ foreach my $path (@path) {
+ $found = $path if -e $path;
+ }
+ if ($found) {
+ ok(1, "$file exists");
+ } else {
+ ok(0, "$file cannot be located --ERROR");
}
-
- ok($found, "$file found");
}
foreach my $include_path (@include_paths) {
@@ -66,13 +83,17 @@ foreach my $include_path (@include_paths) {
# See Template.pm for the actual codebase definitions.
# Initialize templates (f.e. by loading plugins like Hook).
- PRE_PROCESS => "global/variables.none.tmpl",
+ PRE_PROCESS => "global/initialize.none.tmpl",
FILTERS =>
{
html_linebreak => sub { return $_; },
+ no_break => sub { return $_; } ,
js => sub { return $_ } ,
base64 => sub { return $_ } ,
+ inactive => [ sub { return sub { return $_; } }, 1] ,
+ closed => [ sub { return sub { return $_; } }, 1] ,
+ obsolete => [ sub { return sub { return $_; } }, 1] ,
url_quote => sub { return $_ } ,
css_class_quote => sub { return $_ } ,
xml => sub { return $_ } ,
@@ -84,7 +105,6 @@ foreach my $include_path (@include_paths) {
wrap_comment => sub { return $_ },
none => sub { return $_ } ,
ics => [ sub { return sub { return $_; } }, 1] ,
- markdown => sub { return $_ } ,
},
}
);
diff --git a/t/005whitespace.t b/t/005whitespace.t
index be13890bb..edba8b274 100644
--- a/t/005whitespace.t
+++ b/t/005whitespace.t
@@ -1,29 +1,44 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+# -*- Mode: perl; indent-tabs-mode: nil -*-
+#
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code are the Bugzilla tests.
+#
+# The Initial Developer of the Original Code is Jacob Steenhagen.
+# Portions created by Jacob Steenhagen are
+# Copyright (C) 2001 Jacob Steenhagen. All
+# Rights Reserved.
+#
+# Contributor(s): Jacob Steenhagen <jake@bugzilla.org>
+# David D. Kilzer <ddkilzer@kilzer.net>
+# Colin Ogilvie <mozilla@colinogilvie.co.uk>
+# Marc Schumann <wurblzap@gmail.com>
#
-# This Source Code Form is "Incompatible With Secondary Licenses", as
-# defined by the Mozilla Public License, v. 2.0.
#################
#Bugzilla Test 5#
#####no_tabs#####
-use 5.10.1;
use strict;
-use warnings;
-use lib qw(. lib local/lib/perl5 t);
+use lib 't';
use Support::Files;
use Support::Templates;
use File::Spec;
-use Test::More tests => (scalar(@Support::Files::testitems)
- + scalar(@Support::Files::test_files)
+use Test::More tests => ( scalar(@Support::Files::testitems)
+ $Support::Templates::num_actual_files) * 3;
-my @testitems = (@Support::Files::testitems, @Support::Files::test_files);
+my @testitems = @Support::Files::testitems;
for my $path (@Support::Templates::include_paths) {
push(@testitems, map(File::Spec->catfile($path, $_),
Support::Templates::find_actual_files($path)));
diff --git a/t/006spellcheck.t b/t/006spellcheck.t
index 70181ef85..e311be8ec 100644
--- a/t/006spellcheck.t
+++ b/t/006spellcheck.t
@@ -1,31 +1,62 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+# -*- Mode: perl; indent-tabs-mode: nil -*-
#
-# This Source Code Form is "Incompatible With Secondary Licenses", as
-# defined by the Mozilla Public License, v. 2.0.
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code are the Bugzilla Tests.
+#
+# The Initial Developer of the Original Code is Zach Lipton
+# Portions created by Zach Lipton are
+# Copyright (C) 2002 Zach Lipton. All
+# Rights Reserved.
+#
+# Contributor(s): Zach Lipton <zach@zachlipton.com>
#################
#Bugzilla Test 6#
####Spelling#####
-use 5.10.1;
-use strict;
-use warnings;
-
-use lib qw(. lib local/lib/perl5 t);
+use lib 't';
use Support::Files;
-# -1 because 006spellcheck.t must not be checked.
-use Test::More tests => scalar(@Support::Files::testitems)
- + scalar(@Support::Files::test_files) - 1;
+BEGIN { # yes the indenting is off, deal with it
+#add the words to check here:
+@evilwords = qw(
+anyways
+appearence
+arbitary
+cancelled
+critera
+databasa
+dependan
+existance
+existant
+paramater
+refered
+repsentation
+retreive
+suported
+varsion
+);
+
+$testcount = scalar(@Support::Files::testitems);
+}
+
+use Test::More tests => $testcount;
# Capture the TESTOUT from Test::More or Test::Builder for printing errors.
# This will handle verbosity for us automatically.
my $fh;
{
- no warnings qw(unopened); # Don't complain about non-existent filehandles
+ local $^W = 0; # Don't complain about non-existent filehandles
if (-e \*Test::More::TESTOUT) {
$fh = \*Test::More::TESTOUT;
} elsif (-e \*Test::Builder::TESTOUT) {
@@ -35,35 +66,14 @@ my $fh;
}
}
-my @testitems = (@Support::Files::testitems, @Support::Files::test_files);
-
-#add the words to check here:
-my @evilwords = qw(
- anyways
- appearence
- arbitary
- cancelled
- critera
- databasa
- dependan
- existance
- existant
- paramater
- refered
- repsentation
- retreive
- suported
- varsion
-);
+my @testitems = @Support::Files::testitems;
+# at last, here we actually run the test...
my $evilwordsregexp = join('|', @evilwords);
foreach my $file (@testitems) {
$file =~ s/\s.*$//; # nuke everything after the first space (#comment)
next if (!$file); # skip null entries
- # Do not try to validate this file as it obviously contains a list
- # of wrongly spelled words.
- next if ($file eq 't/006spellcheck.t');
if (open (FILE, $file)) { # open the file for reading
diff --git a/t/007util.t b/t/007util.t
index b8e9505d8..b32a1b90c 100644
--- a/t/007util.t
+++ b/t/007util.t
@@ -1,26 +1,36 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+# -*- Mode: perl; indent-tabs-mode: nil -*-
#
-# This Source Code Form is "Incompatible With Secondary Licenses", as
-# defined by the Mozilla Public License, v. 2.0.
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code are the Bugzilla Tests.
+#
+# The Initial Developer of the Original Code is Zach Lipton
+# Portions created by Zach Lipton are Copyright (C) 2002 Zach Lipton.
+# All Rights Reserved.
+#
+# Contributor(s): Zach Lipton <zach@zachlipton.com>
+# Max Kanat-Alexander <mkanat@bugzilla.org>
+# Frédéric Buclin <LpSolit@gmail.com>
#################
#Bugzilla Test 7#
#####Util.pm#####
-use 5.10.1;
-use strict;
-use warnings;
-
-use lib qw(. lib local/lib/perl5 t);
+use lib 't';
use Support::Files;
-use Test::More tests => 17;
-use DateTime;
+use Test::More tests => 15;
BEGIN {
- use_ok('Bugzilla');
- use_ok('Bugzilla::Util');
+ use_ok(Bugzilla);
+ use_ok(Bugzilla::Util);
}
# We need to override user preferences so we can get an expected value when
@@ -63,16 +73,6 @@ foreach my $input (keys %email_strings) {
"email_filter('$input')");
}
-# validate_email_syntax. We need to override some parameters.
-my $params = Bugzilla->params;
-$params->{emailregexp} = '.*';
-$params->{emailsuffix} = '';
-my $ascii_email = 'admin@company.com';
-# U+0430 returns the Cyrillic "а", which looks similar to the ASCII "a".
-my $utf8_email = "\N{U+0430}dmin\@company.com";
-ok(validate_email_syntax($ascii_email), 'correctly formatted ASCII-only email address is valid');
-ok(!validate_email_syntax($utf8_email), 'correctly formatted email address with non-ASCII characters is rejected');
-
# diff_arrays():
my @old_array = qw(alpha beta alpha gamma gamma beta alpha delta epsilon gamma);
my @new_array = qw(alpha alpha beta gamma epsilon delta beta delta);
diff --git a/t/008filter.t b/t/008filter.t
index b8d05af8a..1111c16f6 100644
--- a/t/008filter.t
+++ b/t/008filter.t
@@ -1,9 +1,23 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+# -*- Mode: perl; indent-tabs-mode: nil -*-
#
-# This Source Code Form is "Incompatible With Secondary Licenses", as
-# defined by the Mozilla Public License, v. 2.0.
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code are the Bugzilla tests.
+#
+# The Initial Developer of the Original Code is Jacob Steenhagen.
+# Portions created by Jacob Steenhagen are
+# Copyright (C) 2001 Jacob Steenhagen. All
+# Rights Reserved.
+#
+# Contributor(s): Gervase Markham <gerv@gerv.net>
#################
#Bugzilla Test 8#
@@ -15,11 +29,10 @@
# Sample exploit code: '>"><script>alert('Oh dear...')</script>
-use 5.10.1;
use strict;
-use warnings;
+use lib qw(. lib t);
-use lib qw(. lib local/lib/perl5 t);
+use vars qw(%safe);
use Bugzilla::Constants;
use Support::Templates;
@@ -31,7 +44,6 @@ use Cwd;
my $oldrecsep = $/;
my $topdir = cwd;
$/ = undef;
-our %safe;
foreach my $path (@Support::Templates::include_paths) {
$path =~ s|\\|/|g if ON_WINDOWS; # convert \ to / in path if on windows
@@ -82,13 +94,13 @@ foreach my $path (@Support::Templates::include_paths) {
foreach my $file (@testitems) {
# There are some files we don't check, because there is no need to
# filter their contents due to their content-type.
- if ($file =~ /\.(pm|txt|rst|png)\.tmpl$/) {
+ if ($file =~ /\.(pm|txt|png)\.tmpl$/) {
ok(1, "($lang/$flavor) $file is filter-safe");
next;
}
-
+
# Read the entire file into a string
- open (FILE, "<$file") || die "Can't open $file: $!\n";
+ open (FILE, "<$file") || die "Can't open $file: $!\n";
my $slurp = <FILE>;
close (FILE);
@@ -213,8 +225,8 @@ sub directive_ok {
return 1 if $directive =~ /FILTER\ (html|csv|js|base64|css_class_quote|ics|
quoteUrls|time|uri|xml|lower|html_light|
obsolete|inactive|closed|unitconvert|
- txt|html_linebreak|none|json|null|id|
- markdown)\b/x;
+ txt|html_linebreak|none|json|null|id)\b/x;
+
return 0;
}
diff --git a/t/009bugwords.t b/t/009bugwords.t
index 740cbf6aa..242ac478d 100644
--- a/t/009bugwords.t
+++ b/t/009bugwords.t
@@ -1,9 +1,24 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+# -*- Mode: perl; indent-tabs-mode: nil -*-
+#
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code are the Bugzilla tests.
+#
+# The Initial Developer of the Original Code is Jacob Steenhagen.
+# Portions created by Jacob Steenhagen are
+# Copyright (C) 2001 Jacob Steenhagen. All
+# Rights Reserved.
+#
+# Contributor(s): Gervase Markham <gerv@gerv.net>
#
-# This Source Code Form is "Incompatible With Secondary Licenses", as
-# defined by the Mozilla Public License, v. 2.0.
#################
#Bugzilla Test 9#
@@ -15,11 +30,9 @@
# "[% terms.bug %]". This test makes sure the relevant words aren't used
# bare.
-use 5.10.1;
use strict;
-use warnings;
-use lib qw(. lib local/lib/perl5 t);
+use lib 't';
use Support::Files;
use Support::Templates;
@@ -62,6 +75,15 @@ foreach my $file (@testitems) {
next;
}
}
+
+ # "Bugzilla"
+ if (grep /(?<!X\-)Bugzilla(?!_|::|-&gt|\.pm)/, $text) {
+ # Exclude JS comments, hyperlinks, USE, and variable assignment.
+ unless (grep /(\/\/.*|org.*>|api\/|USE |= )Bugzilla/, $text) {
+ push(@errors, [$lineno, $text]);
+ next;
+ }
+ }
}
if (scalar(@errors)) {
diff --git a/t/010dependencies.t b/t/010dependencies.t
index 777d42ed1..3289d098e 100644
--- a/t/010dependencies.t
+++ b/t/010dependencies.t
@@ -1,20 +1,27 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+# -*- Mode: perl; indent-tabs-mode: nil -*-
#
-# This Source Code Form is "Incompatible With Secondary Licenses", as
-# defined by the Mozilla Public License, v. 2.0.
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code are the Bugzilla Tests.
+#
+# Contributor(s): David Miller <justdave@bugzilla.org>
+# Frédéric Buclin <LpSolit@gmail.com>
##################
#Bugzilla Test 10#
## dependencies ##
-use 5.10.1;
use strict;
-use warnings;
-
-use lib qw(. lib local/lib/perl5 t);
+use lib qw(. lib t);
use Support::Files;
use Test::More qw(no_plan);
@@ -30,7 +37,7 @@ use constant MODULE_REGEX => qr/
['"]?
([\w:\.\\]+)
/x;
-use constant BASE_REGEX => qr/^use (?:base|parent) (?:-norequire, )?qw\(([^\)]+)/;
+use constant BASE_REGEX => qr/^use base qw\(([^\)]+)/;
# Extract all Perl modules.
foreach my $file (@Support::Files::testitems) {
@@ -62,7 +69,7 @@ foreach my $module (keys %mods) {
}
elsif ($line =~ BASE_REGEX or $line =~ MODULE_REGEX) {
my $used_string = $1;
- # "use base"/"use parent" can have multiple modules
+ # "use base" can have multiple modules
my @used_array = split(/\s+/, $used_string);
foreach my $used (@used_array) {
next if $used !~ /^Bugzilla/;
diff --git a/t/011pod.t b/t/011pod.t
index 4f5fa87f7..517ca03ad 100644
--- a/t/011pod.t
+++ b/t/011pod.t
@@ -1,19 +1,27 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-# This Source Code Form is "Incompatible With Secondary Licenses", as
-# defined by the Mozilla Public License, v. 2.0.
+# -*- Mode: perl; indent-tabs-mode: nil -*-
+#
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code are the Bugzilla Tests.
+#
+# Contributor(s): Frédéric Buclin <LpSolit@gmail.com>
+
##################
#Bugzilla Test 11#
##POD validation##
-use 5.10.1;
use strict;
-use warnings;
-use lib qw(. lib local/lib/perl5 t);
+use lib 't';
use Support::Files;
use Pod::Checker;
@@ -24,7 +32,7 @@ use Test::More tests => scalar(@Support::Files::testitems);
# This will handle verbosity for us automatically.
my $fh;
{
- no warnings 'unopened';
+ local $^W = 0; # Don't complain about non-existent filehandles
if (-e \*Test::More::TESTOUT) {
$fh = \*Test::More::TESTOUT;
} elsif (-e \*Test::Builder::TESTOUT) {
diff --git a/t/012throwables.t b/t/012throwables.t
index 4317c0e89..590fb8aa5 100644
--- a/t/012throwables.t
+++ b/t/012throwables.t
@@ -1,9 +1,25 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-# This Source Code Form is "Incompatible With Secondary Licenses", as
-# defined by the Mozilla Public License, v. 2.0.
+# -*- Mode: perl; indent-tabs-mode: nil -*-
+# vim: ts=4 sw=4 et tw=80
+#
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code are the Bugzilla Tests.
+#
+# The Initial Developer of the Original Code is Zach Lipton
+# Portions created by Zach Lipton are
+# Copyright (C) 2001 Zach Lipton. All
+# Rights Reserved.
+#
+# Contributor(s): Dennis Melentyev <dennis.melentyev@infopulse.com.ua>
+# Max Kanat-Alexander <mkanat@bugzilla.org>
@@ -11,11 +27,8 @@
#Bugzilla Test 12#
######Errors######
-use 5.10.1;
use strict;
-use warnings;
-
-use lib qw(. lib local/lib/perl5 t);
+use lib qw(. lib t);
use Bugzilla::Constants;
use Bugzilla::WebService::Constants;
@@ -50,13 +63,6 @@ foreach my $include_path (@include_paths) {
$file =~ s|\\|/|g if ON_WINDOWS; # convert \ to / in path if on windows
$test_templates{$file} = ()
if $file =~ m#global/(code|user)-error(?:-errors)?\.html\.tmpl#;
-
- # Make sure the extension is not disabled
- if ($file =~ m#^(extensions/[^/]+/)#) {
- $test_templates{$file} = ()
- if ! -e "${1}disabled"
- && $file =~ m#global/(code|user)-error-errors\.html\.tmpl#;
- }
}
}
diff --git a/t/013remote_ip.t b/t/013remote_ip.t
new file mode 100644
index 000000000..4bba7c95e
--- /dev/null
+++ b/t/013remote_ip.t
@@ -0,0 +1,82 @@
+#!/usr/bin/perl
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# This Source Code Form is "Incompatible With Secondary Licenses", as
+# defined by the Mozilla Public License, v. 2.0.
+
+use strict;
+use lib qw(. lib t);
+use Test::More qw(no_plan);
+use Bugzilla;
+use Bugzilla::Util qw(remote_ip);
+
+my $params = Bugzilla->params;
+local Bugzilla->localconfig->{param_override}{inbound_proxies} = undef;
+
+{
+ local $params->{inbound_proxies} = '10.0.0.1,10.0.0.2';
+ local $ENV{REMOTE_ADDR} = '10.0.0.2';
+ local $ENV{HTTP_X_FORWARDED_FOR} = '10.42.42.42';
+
+ is(remote_ip(), '10.42.42.42', "from proxy 2");
+}
+
+{
+ local $params->{inbound_proxies} = '10.0.0.1,10.0.0.2';
+ local $ENV{REMOTE_ADDR} = '10.0.0.1';
+ local $ENV{HTTP_X_FORWARDED_FOR} = '10.42.42.42';
+
+ is(remote_ip(), '10.42.42.42', "from proxy 1");
+}
+
+{
+ local $params->{inbound_proxies} = '10.0.0.1,10.0.0.2';
+ local $ENV{REMOTE_ADDR} = '10.0.0.3';
+ local $ENV{HTTP_X_FORWARDED_FOR} = '10.42.42.42';
+
+ is(remote_ip(), '10.0.0.3', "not a proxy");
+}
+
+{
+ local $params->{inbound_proxies} = '*';
+ local $ENV{REMOTE_ADDR} = '10.0.0.3';
+ local $ENV{HTTP_X_FORWARDED_FOR} = '10.42.42.42,1.4.9.2';
+
+ is(remote_ip(), '10.42.42.42', "always proxy");
+}
+
+{
+ local $params->{inbound_proxies} = '';
+ local $ENV{REMOTE_ADDR} = '10.9.8.7';
+ local $ENV{HTTP_X_FORWARDED_FOR} = '10.42.42.42,1.4.9.2';
+
+ is(remote_ip(), '10.9.8.7', "never proxy");
+}
+
+
+{
+ local $params->{inbound_proxies} = '10.0.0.1,2600:cafe::cafe:ffff:bf42:4998';
+ local $ENV{REMOTE_ADDR} = '2600:cafe::cafe:ffff:bf42:4998';
+ local $ENV{HTTP_X_FORWARDED_FOR} = '2600:cafe::cafe:ffff:bf42:BEEF';
+
+ is(remote_ip(), '2600:cafe::cafe:ffff:bf42:BEEF', "from proxy ipv6");
+}
+
+{
+ local $params->{inbound_proxies} = '10.0.0.1,2600:cafe::cafe:ffff:bf42:4998';
+ local $ENV{REMOTE_ADDR} = '2600:cafe::cafe:ffff:bf42:DEAD';
+ local $ENV{HTTP_X_FORWARDED_FOR} = '2600:cafe::cafe:ffff:bf42:BEEF';
+
+ is(remote_ip(), '2600:cafe::cafe:ffff:bf42:DEAD', "invalid proxy ipv6");
+}
+
+
+{
+ local $params->{inbound_proxies} = '*';
+ local $ENV{REMOTE_ADDR} = '2600:cafe::cafe:ffff:bf42:DEAD';
+ local $ENV{HTTP_X_FORWARDED_FOR} = '';
+
+ is(remote_ip(), '2600:cafe::cafe:ffff:bf42:DEAD', "always proxy ipv6");
+}
diff --git a/t/Support/Files.pm b/t/Support/Files.pm
index 1bdf2eac7..00e0efd34 100644
--- a/t/Support/Files.pm
+++ b/t/Support/Files.pm
@@ -1,40 +1,45 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-# This Source Code Form is "Incompatible With Secondary Licenses", as
-# defined by the Mozilla Public License, v. 2.0.
+# -*- Mode: perl; indent-tabs-mode: nil -*-
+#
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code are the Bugzilla Tests.
+#
+# The Initial Developer of the Original Code is Zach Lipton
+# Portions created by Zach Lipton are
+# Copyright (C) 2001 Zach Lipton. All
+# Rights Reserved.
+#
+# Contributor(s): Zach Lipton <zach@zachlipton.com>
+# Joel Peshkin <bugreport@peshkin.net>
package Support::Files;
-use 5.10.1;
-use strict;
-use warnings;
+use Bugzilla;
use File::Find;
-our @additional_files = ();
-
use constant IGNORE => qw(
Bugzilla/DuoAPI.pm
Bugzilla/DuoWeb.pm
);
-our @files = glob('*');
-find(sub { push(@files, $File::Find::name) if $_ =~ /\.pm$/;}, qw(Bugzilla docs));
-push(@files, 'extensions/create.pl', 'docs/makedocs.pl', 'cpanfile');
-
-our @extensions =
- grep { $_ ne 'extensions/create.pl' && ! -e "$_/disabled" }
- glob('extensions/*');
-
-foreach my $extension (@extensions) {
- find(sub { push(@files, $File::Find::name) if $_ =~ /\.pm$/;}, $extension);
-}
+@additional_files = ();
-our @test_files = glob('t/*.t xt/*/*.t');
+@files = glob('*');
+my @extension_paths = map { $_->package_dir } @{ Bugzilla->extensions };
+find(sub { push(@files, $File::Find::name) if $_ =~ /\.pm$/;}, 'Bugzilla', @extension_paths);
+push(@files, 'extensions/create.pl');
+my @extensions = glob('extensions/*');
foreach my $extension (@extensions) {
# Skip disabled extensions
next if -e "$extension/disabled";
@@ -50,7 +55,7 @@ sub isTestingFile {
return undef if $ignore eq $file;
}
- if ($file =~ /\.psgi$|\.cgi$|\.pl$|\.pm$/) {
+ if ($file =~ /\.cgi$|\.pl$|\.pm$/) {
return 1;
}
my $additional;
@@ -60,13 +65,11 @@ sub isTestingFile {
return undef;
}
-our (@testitems, @module_files);
-
-foreach my $currentfile (@files) {
+foreach $currentfile (@files) {
if (isTestingFile($currentfile)) {
- push(@testitems, $currentfile);
+ push(@testitems,$currentfile);
}
- push(@module_files, $currentfile) if $currentfile =~ /\.pm$/;
}
+
1;
diff --git a/t/Support/Systemexec.pm b/t/Support/Systemexec.pm
index e73763f8f..676ee02a4 100644
--- a/t/Support/Systemexec.pm
+++ b/t/Support/Systemexec.pm
@@ -1,25 +1,14 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-# This Source Code Form is "Incompatible With Secondary Licenses", as
-# defined by the Mozilla Public License, v. 2.0.
+# -*- Mode: perl; indent-tabs-mode: nil -*-
package Support::Systemexec;
-
-use 5.10.1;
-use strict;
-use warnings;
-
-use parent qw(Exporter);
-@Support::Systemexec::EXPORT = qw(system exec);
-
+require Exporter;
+@ISA = qw(Exporter);
+@EXPORT = qw(system exec);
+@EXPORT_OK = qw();
sub system($$@) {
1;
}
-
sub exec($$@) {
1;
}
-
1;
diff --git a/t/Support/Templates.pm b/t/Support/Templates.pm
index 5071d67ae..81dc8cc3f 100644
--- a/t/Support/Templates.pm
+++ b/t/Support/Templates.pm
@@ -1,21 +1,38 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+# -*- Mode: perl; indent-tabs-mode: nil -*-
+#
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code are the Bugzilla tests.
+#
+# The Initial Developer of the Original Code is Jacob Steenhagen.
+# Portions created by Jacob Steenhagen are
+# Copyright (C) 2001 Jacob Steenhagen. All
+# Rights Reserved.
+#
+# Contributor(s): Jacob Steenhagen <jake@bugzilla.org>
+# David D. Kilzer <ddkilzer@kilzer.net>
+# Tobias Burnus <burnus@net-b.de>
#
-# This Source Code Form is "Incompatible With Secondary Licenses", as
-# defined by the Mozilla Public License, v. 2.0.
package Support::Templates;
-use 5.10.1;
use strict;
-use warnings;
use lib 't';
use base qw(Exporter);
-@Support::Templates::EXPORT =
- qw(@languages @include_paths @english_default_include_paths
- %include_path @referenced_files %actual_files $num_actual_files);
+@Support::Templates::EXPORT =
+ qw(@languages @include_paths $english_default_include_path
+ %include_path @referenced_files %actual_files $num_actual_files);
+use vars qw(@languages @include_paths $english_default_include_path
+ %include_path @referenced_files %actual_files $num_actual_files);
use Bugzilla;
use Bugzilla::Constants;
@@ -25,32 +42,33 @@ use Support::Files;
use File::Find;
use File::Spec;
-# English default include paths
-our @english_default_include_paths =
- (File::Spec->catdir(bz_locations()->{'templatedir'}, 'en', 'default'));
+# The available template languages
+@languages = ();
-# And the extensions too
-foreach my $extension (@Support::Files::extensions) {
- my $dir = File::Spec->catdir($extension, 'template', 'en', 'default');
- if (-e $dir) {
- push @english_default_include_paths, $dir;
- }
-}
+# The colon separated includepath per language
+%include_path = ();
+
+# All include paths
+@include_paths = ();
+
+# English default include path
+$english_default_include_path =
+ File::Spec->catdir(bz_locations()->{'templatedir'}, 'en', 'default');
# Files which are referenced in the cgi files
-our @referenced_files = ();
+@referenced_files = ();
# All files sorted by include_path
-our %actual_files = ();
+%actual_files = ();
# total number of actual_files
-our $num_actual_files = 0;
+$num_actual_files = 0;
# Set the template available languages and include paths
-our @languages = @{ Bugzilla->languages };
-our @include_paths = @{ template_include_path({ language => Bugzilla->languages }) };
+@languages = @{ Bugzilla->languages };
+@include_paths = @{ template_include_path({ language => Bugzilla->languages }) };
-our @files;
+my @files;
# Local subroutine used with File::Find
sub find_templates {