From fd0f6ce3f9b0dc8e240ff8e791ddf1703131bd35 Mon Sep 17 00:00:00 2001 From: Christian Mehlmauer Date: Sun, 10 Feb 2013 22:07:46 +0100 Subject: [PATCH] syntax error checks for all ruby files --- spec/wpscan_spec.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/spec/wpscan_spec.rb b/spec/wpscan_spec.rb index 115a55bf..e7c5ebfd 100644 --- a/spec/wpscan_spec.rb +++ b/spec/wpscan_spec.rb @@ -21,9 +21,16 @@ require 'spec_helper' describe 'wpscan main checks' do - it 'check for errors on running the mainscript' do + it 'should check for errors on running the mainscript' do a = %x[ruby #{ROOT_DIR}/wpscan.rb] a.should =~ /\[ERROR\] No argument supplied/ end + it 'should check for valid syntax' do + Dir.glob("**/*.rb") do |file| + res = %x{ruby -c #{file} 2>&1}.split("\n") + ok = res.select {|msg| msg =~ /Syntax OK/} + fail("Syntax error in #{file}:\n" + res.join("\n")) if ok.size != 1 + end + end end