lib/tryouts/cli/run.rb in tryouts-0.7.2 vs lib/tryouts/cli/run.rb in tryouts-0.7.3

- old
+ new

@@ -39,17 +39,18 @@ if Tryouts.verbose > 0 print "Tryouts #{Tryouts::VERSION} -- " print "#{Tryouts.sysinfo.to_s} (#{RUBY_VERSION}) -- " puts "#{start.strftime("%Y-%m-%d %H:%M:%S")}" + puts end load_available_tryouts_files passed, failed = 0, 0 Tryouts.instances.each_pair do |group,tryouts_inst| - puts '', ' %-79s'.att(:reverse) % group unless Tryouts.verbose < 0 + puts ' %-79s'.att(:reverse) % group unless Tryouts.verbose < 0 puts " #{tryouts_inst.paths.join("\n ")}" if Tryouts.verbose > 0 tryouts_inst.tryouts.each_pair do |name,to| begin to.run to.report @@ -59,20 +60,28 @@ end STDOUT.flush passed += to.passed failed += to.failed end - + unless tryouts_inst.errors.empty? title = '%-78s' % " RUNTIME ERRORS !?" puts $/, ' ' << title.color(:red).att(:reverse).bright tryouts_inst.errors.each do |ex| - trace = Tryouts.verbose > 1 ? ex.backtrace : [ex.backtrace.first] + puts '%4s%s: %s' % ['', ex.class, ex.message.to_s.split($/).join($/ + ' '*16)] puts - puts '%14s %s' % ["", trace.join($/ + ' '*16)] - puts + + if [SyntaxError].member? ex.class + # don't print anymore. + else + unless ex.backtrace.nil? + trace = Tryouts.verbose > 1 ? ex.backtrace : [ex.backtrace.first] + puts '%14s %s' % ["", trace.join($/ + ' '*16)] + puts + end + end end end end if Tryouts.verbose < 0 @@ -137,10 +146,13 @@ def load_available_tryouts_files @tryouts_files = [] # If file paths were given, check those only. unless @argv.empty? @argv.each do |file| + unless File.exists?(file) + raise Tryouts::Exception, "Not found: #{file}" + end file = File.join(file, '**', '*_tryouts.rb') if File.directory?(file) @tryouts_files += Dir.glob file end # Otherwise check the default globs else @@ -188,10 +200,10 @@ `. ; ; .' ; ;'\ /`; ; `; .'.'/. ,\`.`. ;' `-=;_-' `-----' `-_;=-' -bodom- } -PUG = %q{ + PUG = %q{ __,-----._ ,-. ,' ,-. \`---. ,-----<._/ (,.-. o:.` )),"\\\-._ ,' `. ('"-` .\ \`:_ )\ `-;'-._ \ ,,-. \` ; : \( `-' ) -._ : `: