mirror of
				https://github.com/drwetter/testssl.sh.git
				synced 2025-10-31 13:55:25 +01:00 
			
		
		
		
	Use test::diff so that errors are spotted better
This commit is contained in:
		| @@ -6,6 +6,7 @@ | |||||||
| use strict; | use strict; | ||||||
| use Test::More; | use Test::More; | ||||||
| use Data::Dumper; | use Data::Dumper; | ||||||
|  | use Text::Diff; | ||||||
|  |  | ||||||
| my $tests = 0; | my $tests = 0; | ||||||
| my $prg="./testssl.sh"; | my $prg="./testssl.sh"; | ||||||
| @@ -15,7 +16,7 @@ my $html=""; | |||||||
| my $debughtml=""; | my $debughtml=""; | ||||||
| my $edited_html=""; | my $edited_html=""; | ||||||
| my $check2run="--ip=one --color 0 --htmlfile tmp.html"; | my $check2run="--ip=one --color 0 --htmlfile tmp.html"; | ||||||
|  | my $diff=""; | ||||||
| die "Unable to open $prg" unless -f $prg; | die "Unable to open $prg" unless -f $prg; | ||||||
|  |  | ||||||
| printf "\n%s\n", "Doing HTML output checks"; | printf "\n%s\n", "Doing HTML output checks"; | ||||||
| @@ -47,6 +48,9 @@ $edited_html =~ s/'/'/g; | |||||||
| cmp_ok($edited_html, "eq", $out, "HTML file matches terminal output"); | cmp_ok($edited_html, "eq", $out, "HTML file matches terminal output"); | ||||||
| $tests++; | $tests++; | ||||||
|  |  | ||||||
|  | $diff = diff \$edited_html, \$out; | ||||||
|  | printf "\n%s\n", "$diff"; | ||||||
|  |  | ||||||
| #2 | #2 | ||||||
| printf "\n%s\n", " .. running again $prg against \"$uri\", now with --debug 4 to create HTML output (may take another ~2 minutes)"; | printf "\n%s\n", " .. running again $prg against \"$uri\", now with --debug 4 to create HTML output (may take another ~2 minutes)"; | ||||||
| # Redirect stderr to /dev/null in order to avoid some unexplained "date: invalid date" error messages | # Redirect stderr to /dev/null in order to avoid some unexplained "date: invalid date" error messages | ||||||
| @@ -72,5 +76,10 @@ $debughtml =~ s/.*DEBUG:.*\n//g; | |||||||
| cmp_ok($debughtml, "eq", $html, "HTML file created with --debug 4 matches HTML file created without --debug"); | cmp_ok($debughtml, "eq", $html, "HTML file created with --debug 4 matches HTML file created without --debug"); | ||||||
| $tests++; | $tests++; | ||||||
|  |  | ||||||
|  | $diff = diff \$debughtml, \$html; | ||||||
|  | printf "\n%s\n", "$diff"; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| printf "\n"; | printf "\n"; | ||||||
| done_testing($tests); | done_testing($tests); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Dirk
					Dirk