C0 code coverage information

Generated on Fri Jul 11 15:55:29 -0700 2008 with rcov 0.7.0


Code reported as executed by Ruby looks like this...
and this: this line is also marked as covered.
Lines considered as run by rcov, but not reported by Ruby, look like this,
and this: these lines were inferred by rcov (using simple heuristics).
Finally, here's a line marked as not executed.
Name Total lines Lines of code Total coverage Code coverage
lib/openid/util.rb 110 85
85.5% 
82.4% 
  1 require "cgi"
  2 require "uri"
  3 require "logger"
  4 
  5 require "openid/extras"
  6 
  7 # See OpenID::Consumer or OpenID::Server modules, as well as the store classes
  8 module OpenID
  9   class AssertionError < Exception
 10   end
 11 
 12   # Exceptions that are raised by the library are subclasses of this
 13   # exception type, so if you want to catch all exceptions raised by
 14   # the library, you can catch OpenIDError
 15   class OpenIDError < StandardError
 16   end
 17 
 18   module Util
 19 
 20     BASE64_CHARS = ('ABCDEFGHIJKLMNOPQRSTUVWXYZ' \
 21                     'abcdefghijklmnopqrstuvwxyz0123456789+/')
 22     BASE64_RE = Regexp.compile("
 23     \\A
 24     ([#{BASE64_CHARS}]{4})*
 25     ([#{BASE64_CHARS}]{2}==|
 26      [#{BASE64_CHARS}]{3}=)?
 27     \\Z", Regexp::EXTENDED)
 28 
 29     def Util.assert(value, message=nil)
 30       if not value
 31         raise AssertionError, message or value
 32       end
 33     end
 34 
 35     def Util.to_base64(s)
 36       [s].pack('m').gsub("\n", "")
 37     end
 38 
 39     def Util.from_base64(s)
 40       without_newlines = s.gsub(/[\r\n]+/, '')
 41       if !BASE64_RE.match(without_newlines)
 42         raise ArgumentError, "Malformed input: #{s.inspect}"
 43       end
 44       without_newlines.unpack('m').first
 45     end
 46 
 47     def Util.urlencode(args)
 48       a = []
 49       args.each do |key, val|
 50         val = '' unless val
 51         a << (CGI::escape(key) + "=" + CGI::escape(val))
 52       end
 53       a.join("&")
 54     end
 55 
 56     def Util.parse_query(qs)
 57       query = {}
 58       CGI::parse(qs).each {|k,v| query[k] = v[0]}
 59       return query
 60     end
 61 
 62     def Util.append_args(url, args)
 63       url = url.dup
 64       return url if args.length == 0
 65 
 66       if args.respond_to?('each_pair')
 67         args = args.sort
 68       end
 69 
 70       url << (url.include?("?") ? "&" : "?")
 71       url << Util.urlencode(args)
 72     end
 73 
 74     @@logger = Logger.new(STDERR)
 75     @@logger.progname = "OpenID"
 76 
 77     def Util.logger=(logger)
 78       @@logger = logger
 79     end
 80 
 81     def Util.logger
 82       @@logger
 83     end
 84 
 85     # change the message below to do whatever you like for logging
 86     def Util.log(message)
 87       logger.info(message)
 88     end
 89 
 90     def Util.auto_submit_html(form, title='OpenID transaction in progress')
 91       return "
 92 <html>
 93 <head>
 94   <title>#{title}</title>
 95 </head>
 96 <body onload='document.forms[0].submit();'>
 97 #{form}
 98 <script>
 99 var elements = document.forms[0].elements;
100 for (var i = 0; i < elements.length; i++) {
101   elements[i].style.display = \"none\";
102 }
103 </script>
104 </body>
105 </html>
106 "
107     end
108   end
109 
110 end

Generated using the rcov code coverage analysis tool for Ruby version 0.7.0.

Valid XHTML 1.0! Valid CSS!