Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ivan Ivlev
bugzilla
Commits
ccf9d404
Commit
ccf9d404
authored
May 09, 2002
by
zach%zachlipton.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for bug 143124, Fix warning messages about *::TESTOUT and clean up
test code. Patch makes the tests much better now. r=zach x2
parent
1d10fae3
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
100 additions
and
70 deletions
+100
-70
001compile.t
t/001compile.t
+45
-41
002goodperl.t
t/002goodperl.t
+6
-5
003safesys.t
t/003safesys.t
+31
-18
004template.t
t/004template.t
+17
-5
005no_tabs.t
t/005no_tabs.t
+1
-1
No files found.
t/001compile.t
View file @
ccf9d404
...
...
@@ -32,57 +32,61 @@
# GPL.
#
#################
#Bugzilla Test 1#
###Compilation###
BEGIN
{
use
lib
't/'
;
}
BEGIN
{
use
Support::
Files
;
}
BEGIN
{
$tests
=
@
Support::Files::
testitems
;
}
BEGIN
{
use
Test::
More
tests
=>
$tests
;
}
use
strict
;
# First now we test the scripts
my
@testitems
=
@
Support::Files::
testitems
;
# Capture the TESTERR from Test::More for printing errors.
# This will handle verbosity for us automatically
*
TESTOUT
=
\*
Test::More::
TESTOUT
;
my
$perlapp
=
$^X
;
foreach
my
$file
(
@testitems
)
{
$file
=~
s/\s.*$//
;
# nuke everything after the first space (#comment)
next
if
(
!
$file
);
# skip null entries
open
(
FILE
,
$file
);
my
$bang
=
<
FILE
>
;
close
(
FILE
);
my
$T
=
""
;
if
(
$bang
=~
m/#!\S*perl\s+-.*T/
)
{
$T
=
"T"
;
}
my
$command
=
"$perlapp"
.
" -c$T $file 2>&1"
;
my
$loginfo
=
`$command`
;
#print '@@'.$loginfo.'##';
if
(
$loginfo
=~
/syntax ok$/im
)
{
if
(
$loginfo
ne
"$file syntax OK\n"
)
{
print
TESTOUT
$loginfo
;
ok
(
0
,
$file
.
"--WARNING"
);
}
else
{
ok
(
1
,
$file
);
}
}
else
{
print
TESTOUT
$loginfo
;
ok
(
0
,
$file
.
"--ERROR"
);
}
}
# Remove the lib testing from here since it is now done
# in Files.pm
use
lib
't'
;
use
Support::
Files
;
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
;
# Test the scripts by compiling them
foreach
my
$file
(
@testitems
)
{
$file
=~
s/\s.*$//
;
# nuke everything after the first space (#comment)
next
if
(
!
$file
);
# skip null entries
open
(
FILE
,
$file
);
my
$bang
=
<
FILE
>
;
close
(
FILE
);
my
$T
=
""
;
if
(
$bang
=~
m/#!\S*perl\s+-.*T/
)
{
$T
=
"T"
;
}
my
$command
=
"$perlapp -c$T $file 2>&1"
;
my
$loginfo
=
`$command`
;
#print '@@'.$loginfo.'##';
if
(
$loginfo
=~
/syntax ok$/im
)
{
if
(
$loginfo
ne
"$file syntax OK\n"
)
{
ok
(
0
,
$file
.
" --WARNING"
);
print
$fh
$loginfo
;
}
else
{
ok
(
1
,
$file
);
}
}
else
{
ok
(
0
,
$file
.
" --ERROR"
);
print
$fh
$loginfo
;
}
}
exit
0
;
t/002goodperl.t
View file @
ccf9d404
...
...
@@ -38,13 +38,14 @@
#Bugzilla Test 2#
####GoodPerl#####
BEGIN
{
use
lib
't/'
;
}
BEGIN
{
use
Support::
Files
;
}
BEGIN
{
$tests
=
@
Support::Files::
testitems
*
2
;
}
BEGIN
{
use
Test::
More
tests
=>
$tests
;
}
use
strict
;
use
lib
't'
;
use
Support::
Files
;
use
Test::
More
tests
=>
(
scalar
(
@
Support::Files::
testitems
)
*
2
);
my
@testitems
=
@
Support::Files::
testitems
;
# get the files to test.
foreach
my
$file
(
@testitems
)
{
...
...
t/003safesys.t
View file @
ccf9d404
...
...
@@ -36,29 +36,42 @@
#Bugzilla Test 3#
###Safesystem####
BEGIN
{
use
lib
't/'
;
}
BEGIN
{
use
Support::
Files
;
}
BEGIN
{
$tests
=
@
Support::Files::
testitems
;
}
BEGIN
{
use
Test::
More
tests
=>
$tests
;
}
use
strict
;
use
lib
't'
;
use
Support::
Files
;
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
;
# Capture the TESTERR from Test::More for printing errors.
# This will handle verbosity for us automatically
*
TESTOUT
=
\*
Test::More::
TESTOUT
;
my
$perlapp
=
$^X
;
foreach
my
$file
(
@testitems
)
{
$file
=~
s/\s.*$//
;
# nuke everything after the first space (#comment)
next
if
(
!
$file
);
# skip null entries
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
TESTOUT
$loginfo
;
}
else
{
ok
(
1
,
"$file uses proper system and exec calls"
);
}
$file
=~
s/\s.*$//
;
# nuke everything after the first space (#comment)
next
if
(
!
$file
);
# skip null entries
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
;
t/004template.t
View file @
ccf9d404
...
...
@@ -26,7 +26,6 @@
#Bugzilla Test 4#
####Templates####
use
diagnostics
;
use
strict
;
use
lib
't'
;
...
...
@@ -41,10 +40,21 @@ use Template;
use
Test::
More
tests
=>
(
scalar
(
@
Support::Templates::
referenced_files
)
+
scalar
(
@
Support::Templates::
actual_files
)
*
2
);
# 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
$include_path
=
$
Support::Templates::
include_path
;
# Capture the TESTERR from Test::More for printing errors.
# This will handle verbosity for us automatically
*
TESTOUT
=
\*
Test::More::
TESTOUT
;
# Check to make sure all templates that are referenced in
# Bugzilla exist in the proper place.
...
...
@@ -86,8 +96,8 @@ foreach my $file(@Support::Templates::actual_files) {
ok
(
1
,
"$file syntax ok"
);
}
else
{
print
TESTOUT
$template
->
error
()
.
"\n"
;
ok
(
0
,
"$file has bad syntax --ERROR"
);
print
$fh
$template
->
error
()
.
"\n"
;
}
}
else
{
...
...
@@ -112,3 +122,5 @@ foreach my $file(@Support::Templates::actual_files) {
}
close
(
TMPL
);
}
exit
0
;
t/005no_tabs.t
View file @
ccf9d404
...
...
@@ -25,7 +25,6 @@
#Bugzilla Test 5#
#####no_tabs#####
use
diagnostics
;
use
strict
;
use
lib
't'
;
...
...
@@ -52,3 +51,4 @@ foreach my $file (@testitems) {
close
(
FILE
);
}
exit
0
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment