[javascriptlint-commit] SF.net SVN: javascriptlint: [179] trunk/tests
Status: Beta
Brought to you by:
matthiasmiller
|
From: <mat...@us...> - 2008-03-31 14:01:25
|
Revision: 179
http://javascriptlint.svn.sourceforge.net/javascriptlint/?rev=179&view=rev
Author: matthiasmiller
Date: 2008-03-31 07:01:17 -0700 (Mon, 31 Mar 2008)
Log Message:
-----------
Use consistent indentation in tests.
Modified Paths:
--------------
trunk/tests/conf/define.js
trunk/tests/conf/legacy_control_comments.js
trunk/tests/control_comments/invalid_fallthru.js
trunk/tests/html/script_tag_in_js_literal.html
trunk/tests/path_resolution/is_a_dir.js
trunk/tests/path_resolution/is_a_dir_not_file.js
trunk/tests/path_resolution/is_a_file.js
trunk/tests/path_resolution/process/error-2.ecmascript
trunk/tests/path_resolution/process/error.ecmascript
trunk/tests/path_resolution/process/included.ecmascript
trunk/tests/run_tests.pl
trunk/tests/warnings/default_not_at_end.js
trunk/tests/warnings/legacy_cc_not_understood.js
trunk/tests/warnings/missing_semicolon.js
Modified: trunk/tests/conf/define.js
===================================================================
--- trunk/tests/conf/define.js 2008-03-31 13:45:14 UTC (rev 178)
+++ trunk/tests/conf/define.js 2008-03-31 14:01:17 UTC (rev 179)
@@ -1,8 +1,8 @@
/*conf:+define window*/
/*jsl:option explicit*/
function define() {
- window.alert('http://www.javascriptlint.com/');
+ window.alert('http://www.javascriptlint.com/');
- /* cannot use document, however */
- document.write('<a href="http://www.javascriptlint.com/">JavaScript Lint</a>'); /*warning:undeclared_identifier*/
+ /* cannot use document, however */
+ document.write('<a href="http://www.javascriptlint.com/">JavaScript Lint</a>'); /*warning:undeclared_identifier*/
}
Modified: trunk/tests/conf/legacy_control_comments.js
===================================================================
--- trunk/tests/conf/legacy_control_comments.js 2008-03-31 13:45:14 UTC (rev 178)
+++ trunk/tests/conf/legacy_control_comments.js 2008-03-31 14:01:17 UTC (rev 179)
@@ -2,7 +2,7 @@
/* Make sure that legacy control comments aren't respected */
function legacy_control_comments() {
- /*@ignore@*/
- ; /*warning:empty_statement*/
- /*@end@*/
+ /*@ignore@*/
+ ; /*warning:empty_statement*/
+ /*@end@*/
}
Modified: trunk/tests/control_comments/invalid_fallthru.js
===================================================================
--- trunk/tests/control_comments/invalid_fallthru.js 2008-03-31 13:45:14 UTC (rev 178)
+++ trunk/tests/control_comments/invalid_fallthru.js 2008-03-31 14:01:17 UTC (rev 179)
@@ -2,12 +2,12 @@
function invalid_fallthru() {
/* mistake - invalid use of fallthru */
/*jsl:fallthru*/ /*warning:invalid_fallthru*/
- var i;
+ var i;
switch (i) {
/*jsl:fallthru*/ /*warning:invalid_fallthru*/
case /*jsl:fallthru*/1: /*warning:invalid_fallthru*/
break;
default /*jsl:fallthru*/: /*warning:invalid_fallthru*/
- break;
+ break;
}
}
Modified: trunk/tests/html/script_tag_in_js_literal.html
===================================================================
--- trunk/tests/html/script_tag_in_js_literal.html 2008-03-31 13:45:14 UTC (rev 178)
+++ trunk/tests/html/script_tag_in_js_literal.html 2008-03-31 14:01:17 UTC (rev 179)
@@ -1,13 +1,13 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
- <title>JavaScript Lint Test Page</title>
- <script type="text/javascript"><!--
- /* alert the </script> end tag */
- var x = "</script>";
- window.alert(x);
- //-->
- </script>
+ <title>JavaScript Lint Test Page</title>
+ <script type="text/javascript"><!--
+ /* alert the </script> end tag */
+ var x = "</script>";
+ window.alert(x);
+ //-->
+ </script>
</head>
<body>
</body>
Modified: trunk/tests/path_resolution/is_a_dir.js
===================================================================
--- trunk/tests/path_resolution/is_a_dir.js 2008-03-31 13:45:14 UTC (rev 178)
+++ trunk/tests/path_resolution/is_a_dir.js 2008-03-31 14:01:17 UTC (rev 179)
@@ -1,4 +1,4 @@
/*conf:+process dir/ */
function zero() {
- return 0;
+ return 0;
}
Modified: trunk/tests/path_resolution/is_a_dir_not_file.js
===================================================================
--- trunk/tests/path_resolution/is_a_dir_not_file.js 2008-03-31 13:45:14 UTC (rev 178)
+++ trunk/tests/path_resolution/is_a_dir_not_file.js 2008-03-31 14:01:17 UTC (rev 179)
@@ -1,4 +1,4 @@
/*conf:+process dir*/
function zero() {
- return 0;
+ return 0;
}
Modified: trunk/tests/path_resolution/is_a_file.js
===================================================================
--- trunk/tests/path_resolution/is_a_file.js 2008-03-31 13:45:14 UTC (rev 178)
+++ trunk/tests/path_resolution/is_a_file.js 2008-03-31 14:01:17 UTC (rev 179)
@@ -1,4 +1,4 @@
/*conf:+process file*/
function zero() {
- return 0;
+ return 0;
}
Modified: trunk/tests/path_resolution/process/error-2.ecmascript
===================================================================
--- trunk/tests/path_resolution/process/error-2.ecmascript 2008-03-31 13:45:14 UTC (rev 178)
+++ trunk/tests/path_resolution/process/error-2.ecmascript 2008-03-31 14:01:17 UTC (rev 179)
@@ -1,3 +1,3 @@
function process() {
- error!
+ error!
}
Modified: trunk/tests/path_resolution/process/error.ecmascript
===================================================================
--- trunk/tests/path_resolution/process/error.ecmascript 2008-03-31 13:45:14 UTC (rev 178)
+++ trunk/tests/path_resolution/process/error.ecmascript 2008-03-31 14:01:17 UTC (rev 179)
@@ -1,3 +1,3 @@
function process() {
- error!
+ error!
}
Modified: trunk/tests/path_resolution/process/included.ecmascript
===================================================================
--- trunk/tests/path_resolution/process/included.ecmascript 2008-03-31 13:45:14 UTC (rev 178)
+++ trunk/tests/path_resolution/process/included.ecmascript 2008-03-31 14:01:17 UTC (rev 179)
@@ -1,3 +1,3 @@
function zero() {
- return 0;
+ return 0;
}
Modified: trunk/tests/run_tests.pl
===================================================================
--- trunk/tests/run_tests.pl 2008-03-31 13:45:14 UTC (rev 178)
+++ trunk/tests/run_tests.pl 2008-03-31 14:01:17 UTC (rev 179)
@@ -8,7 +8,7 @@
# require a path to jsl
#
if (scalar(@ARGV) != 1) {
- die("Usage: run_tests.pl <path to jsl>\n");
+ die("Usage: run_tests.pl <path to jsl>\n");
}
my $jsl_path = File::Spec->rel2abs($ARGV[0]);
my $tests_path = $FindBin::Bin;
@@ -16,84 +16,84 @@
my $num_tests = 0;
my $num_passed = 0;
sub TestFile {
- /\.(js|htm|html)$/ or return;
- my $filename = $_;
- my $pretty_name = $File::Find::name;
+ /\.(js|htm|html)$/ or return;
+ my $filename = $_;
+ my $pretty_name = $File::Find::name;
- my $conf_file = ".jsl.conf";
+ my $conf_file = ".jsl.conf";
- # open the path being validated
- open(FILE, $filename) or die("Could not open $filename: $!");
- my @contents = <FILE>;
+ # open the path being validated
+ open(FILE, $filename) or die("Could not open $filename: $!");
+ my @contents = <FILE>;
- # look for special configuration directives
- my @conf = grep(s/\/\*conf:(([^*]|(\*[^\/]))*)\*\//\1\n/g, @contents);
- open(FILE, ">$conf_file") or die("Could not open configuration file $conf_file: $!");
- print FILE join("",@conf);
- close FILE;
+ # look for special configuration directives
+ my @conf = grep(s/\/\*conf:(([^*]|(\*[^\/]))*)\*\//\1\n/g, @contents);
+ open(FILE, ">$conf_file") or die("Could not open configuration file $conf_file: $!");
+ print FILE join("",@conf);
+ close FILE;
- my $this_passed = 1;
+ my $this_passed = 1;
- # look for expected configuration error
- my @all_conf_errors = grep(s/\/\*conf_error:(([^*]|(\*[^\/]))*)\*\//\1/g, @contents);
- my $conf_error;
- if (scalar(@all_conf_errors) > 1) {
- print "Only one conf_error allowed per script.";
- $this_passed = 0;
- }
- elsif (scalar(@all_conf_errors) == 1) {
- $conf_error = $all_conf_errors[0];
- unless ($conf_error) {
- print "Missing conf_error text.";
- $this_passed = 0;
- }
- }
+ # look for expected configuration error
+ my @all_conf_errors = grep(s/\/\*conf_error:(([^*]|(\*[^\/]))*)\*\//\1/g, @contents);
+ my $conf_error;
+ if (scalar(@all_conf_errors) > 1) {
+ print "Only one conf_error allowed per script.";
+ $this_passed = 0;
+ }
+ elsif (scalar(@all_conf_errors) == 1) {
+ $conf_error = $all_conf_errors[0];
+ unless ($conf_error) {
+ print "Missing conf_error text.";
+ $this_passed = 0;
+ }
+ }
- # run the lint
- print "Testing $pretty_name...\n";
- my $results = `$jsl_path --conf $conf_file --process $filename --nologo --nofilelisting --nocontext --nosummary -output-format __LINE__,__ERROR_NAME__`;
- my $exit_code = $? >> 8;
- unlink $conf_file;
- die "Error executing $jsl_path" unless defined $results;
+ # run the lint
+ print "Testing $pretty_name...\n";
+ my $results = `$jsl_path --conf $conf_file --process $filename --nologo --nofilelisting --nocontext --nosummary -output-format __LINE__,__ERROR_NAME__`;
+ my $exit_code = $? >> 8;
+ unlink $conf_file;
+ die "Error executing $jsl_path" unless defined $results;
- if ($conf_error) {
- unless ($exit_code == 2) {
- print "Expected exit code: $exit_code\n";
- $this_passed = 0;
- }
- unless (index($results, "configuration error: $conf_error") > 0) {
- print "Expected configuration error: $conf_error";
- print "Got configuration error: $results";
- $this_passed = 0;
- }
- }
- elsif ($exit_code == 2) {
- print "Usage or configuration error:\n$results";
- $this_passed = 0;
- }
+ if ($conf_error) {
+ unless ($exit_code == 2) {
+ print "Expected exit code: $exit_code\n";
+ $this_passed = 0;
+ }
+ unless (index($results, "configuration error: $conf_error") > 0) {
+ print "Expected configuration error: $conf_error";
+ print "Got configuration error: $results";
+ $this_passed = 0;
+ }
+ }
+ elsif ($exit_code == 2) {
+ print "Usage or configuration error:\n$results";
+ $this_passed = 0;
+ }
- foreach my $result (split("\n", $results)) {
- my ($line, $error) = split(",", $result);
- next unless $error; # for now, skip blank errors (such as inability to open file)
+ foreach my $result (split("\n", $results)) {
+ my ($line, $error) = split(",", $result);
+ next unless $error; # for now, skip blank errors (such as inability to open file)
- # some warnings point beyond the end of the file
- $line = scalar(@contents) if $line > scalar(@contents);
+ # some warnings point beyond the end of the file
+ $line = scalar(@contents) if $line > scalar(@contents);
- unless ($contents[$line-1] =~ s/\/\*warning:$error\*\///) {
- print "Error in $filename, line $line: $error\n";
- $this_passed = 0;
- }
- }
- for (my $i = 1; $i <= scalar(@contents); $i++) {
- if ($contents[$i-1] =~ /\/\*warning:([^*]*)\*\//) {
- print "Error in $filename, line $i: no $1 warning\n";
- $this_passed = 0;
- }
- }
- close(FILE);
+ unless ($contents[$line-1] =~ s/\/\*warning:$error\*\///) {
+ print "Error in $filename, line $line: $error\n";
+ $this_passed = 0;
+ }
+ }
+ for (my $i = 1; $i <= scalar(@contents); $i++) {
+ if ($contents[$i-1] =~ /\/\*warning:([^*]*)\*\//) {
+ print "Error in $filename, line $i: no $1 warning\n";
+ $this_passed = 0;
+ }
+ }
+ close(FILE);
- $num_tests++;
- $num_passed++ if $this_passed;
+ $num_tests++;
+ $num_passed++ if $this_passed;
}
# locate all files in the test folder
Modified: trunk/tests/warnings/default_not_at_end.js
===================================================================
--- trunk/tests/warnings/default_not_at_end.js 2008-03-31 13:45:14 UTC (rev 178)
+++ trunk/tests/warnings/default_not_at_end.js 2008-03-31 14:01:17 UTC (rev 179)
@@ -4,9 +4,9 @@
/*default case at top*/
switch (i) {
- default:
- i++;
- break;
+ default:
+ i++;
+ break;
case 1: /*warning:default_not_at_end*/
return 1;
}
Modified: trunk/tests/warnings/legacy_cc_not_understood.js
===================================================================
--- trunk/tests/warnings/legacy_cc_not_understood.js 2008-03-31 13:45:14 UTC (rev 178)
+++ trunk/tests/warnings/legacy_cc_not_understood.js 2008-03-31 14:01:17 UTC (rev 179)
@@ -5,5 +5,5 @@
/* illegal - unrecognized */
/*@bogon@*/ /*warning:legacy_cc_not_understood*/
- return;
+ return;
}
Modified: trunk/tests/warnings/missing_semicolon.js
===================================================================
--- trunk/tests/warnings/missing_semicolon.js 2008-03-31 13:45:14 UTC (rev 178)
+++ trunk/tests/warnings/missing_semicolon.js 2008-03-31 14:01:17 UTC (rev 179)
@@ -8,12 +8,12 @@
/* missing semicolon after return */
/* missing semicolon after lambda */
function x() {
- this.y = function() { return 0 } /*warning:missing_semicolon*/
+ this.y = function() { return 0 } /*warning:missing_semicolon*/
} /*warning:missing_semicolon*/
/* missing semicolon after return */
/* missing semicolon after lambda */
x.prototype.z = function() {
- return 1
+ return 1
} /*warning:missing_semicolon*/
} /*warning:missing_semicolon*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|