ruby_on_ruby 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +18 -0
- data/.rvmrc +1 -0
- data/Gemfile +6 -0
- data/LICENSE +22 -0
- data/README.md +66 -0
- data/Rakefile +1 -0
- data/lib/ruby_on_ruby.rb +5 -0
- data/lib/ruby_on_ruby/console.rb +7 -0
- data/lib/ruby_on_ruby/context.rb +33 -0
- data/lib/ruby_on_ruby/file_loader.rb +31 -0
- data/lib/ruby_on_ruby/ruby_stream.rb +27 -0
- data/lib/ruby_on_ruby/version.rb +3 -0
- data/lib/rubyonruby.rb +1 -0
- data/ruby_in_ruby.gemspec +19 -0
- data/vendor/javascripts/emscripted-ruby/lib/.document +106 -0
- data/vendor/javascripts/emscripted-ruby/lib/English.rb +155 -0
- data/vendor/javascripts/emscripted-ruby/lib/Env.rb +18 -0
- data/vendor/javascripts/emscripted-ruby/lib/README +96 -0
- data/vendor/javascripts/emscripted-ruby/lib/abbrev.rb +103 -0
- data/vendor/javascripts/emscripted-ruby/lib/base64.rb +133 -0
- data/vendor/javascripts/emscripted-ruby/lib/benchmark.rb +572 -0
- data/vendor/javascripts/emscripted-ruby/lib/cgi-lib.rb +272 -0
- data/vendor/javascripts/emscripted-ruby/lib/cgi.rb +2308 -0
- data/vendor/javascripts/emscripted-ruby/lib/cgi/.document +2 -0
- data/vendor/javascripts/emscripted-ruby/lib/cgi/session.rb +498 -0
- data/vendor/javascripts/emscripted-ruby/lib/cgi/session/pstore.rb +111 -0
- data/vendor/javascripts/emscripted-ruby/lib/complex.rb +663 -0
- data/vendor/javascripts/emscripted-ruby/lib/csv.rb +992 -0
- data/vendor/javascripts/emscripted-ruby/lib/date.rb +1767 -0
- data/vendor/javascripts/emscripted-ruby/lib/date/format.rb +1190 -0
- data/vendor/javascripts/emscripted-ruby/lib/date2.rb +5 -0
- data/vendor/javascripts/emscripted-ruby/lib/debug.rb +947 -0
- data/vendor/javascripts/emscripted-ruby/lib/delegate.rb +337 -0
- data/vendor/javascripts/emscripted-ruby/lib/drb.rb +2 -0
- data/vendor/javascripts/emscripted-ruby/lib/drb/acl.rb +146 -0
- data/vendor/javascripts/emscripted-ruby/lib/drb/drb.rb +1782 -0
- data/vendor/javascripts/emscripted-ruby/lib/drb/eq.rb +16 -0
- data/vendor/javascripts/emscripted-ruby/lib/drb/extserv.rb +64 -0
- data/vendor/javascripts/emscripted-ruby/lib/drb/extservm.rb +89 -0
- data/vendor/javascripts/emscripted-ruby/lib/drb/gw.rb +122 -0
- data/vendor/javascripts/emscripted-ruby/lib/drb/invokemethod.rb +36 -0
- data/vendor/javascripts/emscripted-ruby/lib/drb/observer.rb +22 -0
- data/vendor/javascripts/emscripted-ruby/lib/drb/ssl.rb +190 -0
- data/vendor/javascripts/emscripted-ruby/lib/drb/timeridconv.rb +91 -0
- data/vendor/javascripts/emscripted-ruby/lib/drb/unix.rb +108 -0
- data/vendor/javascripts/emscripted-ruby/lib/e2mmap.rb +195 -0
- data/vendor/javascripts/emscripted-ruby/lib/erb.rb +880 -0
- data/vendor/javascripts/emscripted-ruby/lib/eregex.rb +37 -0
- data/vendor/javascripts/emscripted-ruby/lib/fileutils.rb +1591 -0
- data/vendor/javascripts/emscripted-ruby/lib/finalize.rb +193 -0
- data/vendor/javascripts/emscripted-ruby/lib/find.rb +79 -0
- data/vendor/javascripts/emscripted-ruby/lib/forwardable.rb +218 -0
- data/vendor/javascripts/emscripted-ruby/lib/ftools.rb +261 -0
- data/vendor/javascripts/emscripted-ruby/lib/generator.rb +418 -0
- data/vendor/javascripts/emscripted-ruby/lib/getoptlong.rb +621 -0
- data/vendor/javascripts/emscripted-ruby/lib/getopts.rb +127 -0
- data/vendor/javascripts/emscripted-ruby/lib/gserver.rb +253 -0
- data/vendor/javascripts/emscripted-ruby/lib/importenv.rb +33 -0
- data/vendor/javascripts/emscripted-ruby/lib/ipaddr.rb +814 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb.rb +346 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/cmd/chws.rb +33 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/cmd/fork.rb +39 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/cmd/help.rb +34 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/cmd/load.rb +67 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/cmd/nop.rb +39 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/cmd/pushws.rb +39 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/cmd/subirb.rb +43 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/completion.rb +205 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/context.rb +255 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/ext/change-ws.rb +62 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/ext/history.rb +110 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/ext/loader.rb +120 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/ext/math-mode.rb +37 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/ext/multi-irb.rb +241 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/ext/save-history.rb +85 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/ext/tracer.rb +61 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/ext/use-loader.rb +65 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/ext/workspaces.rb +56 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/extend-command.rb +264 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/frame.rb +67 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/help.rb +33 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/init.rb +259 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/input-method.rb +120 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/lc/error.rb +30 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/lc/help-message +35 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/lc/ja/error.rb +27 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/lc/ja/help-message +36 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/locale.rb +184 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/notifier.rb +145 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/output-method.rb +85 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/ruby-lex.rb +1149 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/ruby-token.rb +273 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/slex.rb +285 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/version.rb +16 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/workspace.rb +107 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/ws-for-case-2.rb +15 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/xmp.rb +86 -0
- data/vendor/javascripts/emscripted-ruby/lib/jcode.rb +220 -0
- data/vendor/javascripts/emscripted-ruby/lib/logger.rb +703 -0
- data/vendor/javascripts/emscripted-ruby/lib/mailread.rb +62 -0
- data/vendor/javascripts/emscripted-ruby/lib/mathn.rb +308 -0
- data/vendor/javascripts/emscripted-ruby/lib/matrix.rb +1278 -0
- data/vendor/javascripts/emscripted-ruby/lib/mkmf.rb +1811 -0
- data/vendor/javascripts/emscripted-ruby/lib/monitor.rb +352 -0
- data/vendor/javascripts/emscripted-ruby/lib/mutex_m.rb +122 -0
- data/vendor/javascripts/emscripted-ruby/lib/net/ftp.rb +927 -0
- data/vendor/javascripts/emscripted-ruby/lib/net/http.rb +2277 -0
- data/vendor/javascripts/emscripted-ruby/lib/net/https.rb +173 -0
- data/vendor/javascripts/emscripted-ruby/lib/net/imap.rb +3371 -0
- data/vendor/javascripts/emscripted-ruby/lib/net/pop.rb +999 -0
- data/vendor/javascripts/emscripted-ruby/lib/net/protocol.rb +392 -0
- data/vendor/javascripts/emscripted-ruby/lib/net/smtp.rb +1014 -0
- data/vendor/javascripts/emscripted-ruby/lib/net/telnet.rb +756 -0
- data/vendor/javascripts/emscripted-ruby/lib/observer.rb +192 -0
- data/vendor/javascripts/emscripted-ruby/lib/open-uri.rb +678 -0
- data/vendor/javascripts/emscripted-ruby/lib/open3.rb +101 -0
- data/vendor/javascripts/emscripted-ruby/lib/optparse.rb +1790 -0
- data/vendor/javascripts/emscripted-ruby/lib/optparse/date.rb +17 -0
- data/vendor/javascripts/emscripted-ruby/lib/optparse/shellwords.rb +6 -0
- data/vendor/javascripts/emscripted-ruby/lib/optparse/time.rb +10 -0
- data/vendor/javascripts/emscripted-ruby/lib/optparse/uri.rb +6 -0
- data/vendor/javascripts/emscripted-ruby/lib/optparse/version.rb +70 -0
- data/vendor/javascripts/emscripted-ruby/lib/ostruct.rb +146 -0
- data/vendor/javascripts/emscripted-ruby/lib/parsearg.rb +87 -0
- data/vendor/javascripts/emscripted-ruby/lib/parsedate.rb +53 -0
- data/vendor/javascripts/emscripted-ruby/lib/pathname.rb +1062 -0
- data/vendor/javascripts/emscripted-ruby/lib/ping.rb +64 -0
- data/vendor/javascripts/emscripted-ruby/lib/pp.rb +654 -0
- data/vendor/javascripts/emscripted-ruby/lib/prettyprint.rb +896 -0
- data/vendor/javascripts/emscripted-ruby/lib/profile.rb +6 -0
- data/vendor/javascripts/emscripted-ruby/lib/profiler.rb +59 -0
- data/vendor/javascripts/emscripted-ruby/lib/pstore.rb +395 -0
- data/vendor/javascripts/emscripted-ruby/lib/racc/parser.rb +442 -0
- data/vendor/javascripts/emscripted-ruby/lib/rational.rb +564 -0
- data/vendor/javascripts/emscripted-ruby/lib/readbytes.rb +41 -0
- data/vendor/javascripts/emscripted-ruby/lib/resolv-replace.rb +62 -0
- data/vendor/javascripts/emscripted-ruby/lib/resolv.rb +2210 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/attlistdecl.rb +62 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/attribute.rb +185 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/cdata.rb +67 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/child.rb +96 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/comment.rb +80 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/doctype.rb +271 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/document.rb +208 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/dtd/attlistdecl.rb +10 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/dtd/dtd.rb +51 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/dtd/elementdecl.rb +17 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/dtd/entitydecl.rb +56 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/dtd/notationdecl.rb +39 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/element.rb +1227 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/encoding.rb +71 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/CP-1252.rb +103 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/EUC-JP.rb +35 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/ICONV.rb +22 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/ISO-8859-1.rb +7 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/ISO-8859-15.rb +72 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/SHIFT-JIS.rb +37 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/SHIFT_JIS.rb +1 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/UNILE.rb +34 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/US-ASCII.rb +30 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/UTF-16.rb +35 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/UTF-8.rb +18 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/entity.rb +165 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/formatters/default.rb +109 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/formatters/pretty.rb +137 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/formatters/transitive.rb +56 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/functions.rb +382 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/instruction.rb +70 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/light/node.rb +196 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/namespace.rb +47 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/node.rb +75 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/output.rb +24 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/parent.rb +166 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/parseexception.rb +51 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/baseparser.rb +503 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/lightparser.rb +60 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/pullparser.rb +196 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/sax2parser.rb +238 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/streamparser.rb +46 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/treeparser.rb +97 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/ultralightparser.rb +56 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/xpathparser.rb +698 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/quickpath.rb +266 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/rexml.rb +32 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/sax2listener.rb +97 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/source.rb +251 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/streamlistener.rb +92 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/syncenumerator.rb +33 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/text.rb +344 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/undefinednamespaceexception.rb +8 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/validation/relaxng.rb +559 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/validation/validation.rb +155 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/validation/validationexception.rb +9 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/xmldecl.rb +119 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/xmltokens.rb +18 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/xpath.rb +66 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/xpath_parser.rb +792 -0
- data/vendor/javascripts/emscripted-ruby/lib/rinda/rinda.rb +283 -0
- data/vendor/javascripts/emscripted-ruby/lib/rinda/ring.rb +271 -0
- data/vendor/javascripts/emscripted-ruby/lib/rinda/tuplespace.rb +642 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss.rb +19 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/0.9.rb +428 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/1.0.rb +452 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/2.0.rb +111 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/atom.rb +749 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/content.rb +31 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/content/1.0.rb +10 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/content/2.0.rb +12 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/converter.rb +162 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/dublincore.rb +161 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/dublincore/1.0.rb +13 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/dublincore/2.0.rb +13 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/dublincore/atom.rb +17 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/image.rb +193 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/itunes.rb +410 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker.rb +44 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/0.9.rb +467 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/1.0.rb +434 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/2.0.rb +223 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/atom.rb +172 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/base.rb +868 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/content.rb +21 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/dublincore.rb +124 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/entry.rb +163 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/feed.rb +429 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/image.rb +111 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/itunes.rb +242 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/slash.rb +33 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/syndication.rb +18 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/taxonomy.rb +118 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/trackback.rb +61 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/parser.rb +541 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/rexmlparser.rb +54 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/rss.rb +1312 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/slash.rb +49 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/syndication.rb +67 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/taxonomy.rb +145 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/trackback.rb +288 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/utils.rb +111 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/xml-stylesheet.rb +105 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/xml.rb +71 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/xmlparser.rb +93 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/xmlscanner.rb +121 -0
- data/vendor/javascripts/emscripted-ruby/lib/rubyunit.rb +6 -0
- data/vendor/javascripts/emscripted-ruby/lib/runit/assert.rb +73 -0
- data/vendor/javascripts/emscripted-ruby/lib/runit/cui/testrunner.rb +51 -0
- data/vendor/javascripts/emscripted-ruby/lib/runit/error.rb +9 -0
- data/vendor/javascripts/emscripted-ruby/lib/runit/testcase.rb +45 -0
- data/vendor/javascripts/emscripted-ruby/lib/runit/testresult.rb +44 -0
- data/vendor/javascripts/emscripted-ruby/lib/runit/testsuite.rb +26 -0
- data/vendor/javascripts/emscripted-ruby/lib/runit/topublic.rb +8 -0
- data/vendor/javascripts/emscripted-ruby/lib/scanf.rb +702 -0
- data/vendor/javascripts/emscripted-ruby/lib/securerandom.rb +137 -0
- data/vendor/javascripts/emscripted-ruby/lib/set.rb +1233 -0
- data/vendor/javascripts/emscripted-ruby/lib/shell.rb +269 -0
- data/vendor/javascripts/emscripted-ruby/lib/shell/builtin-command.rb +154 -0
- data/vendor/javascripts/emscripted-ruby/lib/shell/command-processor.rb +592 -0
- data/vendor/javascripts/emscripted-ruby/lib/shell/error.rb +26 -0
- data/vendor/javascripts/emscripted-ruby/lib/shell/filter.rb +110 -0
- data/vendor/javascripts/emscripted-ruby/lib/shell/process-controller.rb +260 -0
- data/vendor/javascripts/emscripted-ruby/lib/shell/system-command.rb +168 -0
- data/vendor/javascripts/emscripted-ruby/lib/shell/version.rb +16 -0
- data/vendor/javascripts/emscripted-ruby/lib/shellwords.rb +172 -0
- data/vendor/javascripts/emscripted-ruby/lib/singleton.rb +360 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/attachment.rb +107 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/baseData.rb +942 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/element.rb +258 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/encodingstyle/aspDotNetHandler.rb +213 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/encodingstyle/handler.rb +100 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/encodingstyle/literalHandler.rb +226 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/encodingstyle/soapHandler.rb +582 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/generator.rb +268 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/header/handler.rb +57 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/header/handlerset.rb +70 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/header/simplehandler.rb +44 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/httpconfigloader.rb +119 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/mapping.rb +10 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/mapping/factory.rb +355 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/mapping/mapping.rb +381 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/mapping/registry.rb +541 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/mapping/rubytypeFactory.rb +475 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/mapping/typeMap.rb +50 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/mapping/wsdlencodedregistry.rb +280 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/mapping/wsdlliteralregistry.rb +418 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/marshal.rb +59 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/mimemessage.rb +240 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/netHttpClient.rb +190 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/parser.rb +251 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/processor.rb +66 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/property.rb +333 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/cgistub.rb +206 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/driver.rb +254 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/element.rb +325 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/httpserver.rb +129 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/proxy.rb +497 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/router.rb +594 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/rpc.rb +25 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/soaplet.rb +162 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/standaloneServer.rb +43 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/soap.rb +140 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/streamHandler.rb +229 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/wsdlDriver.rb +575 -0
- data/vendor/javascripts/emscripted-ruby/lib/sync.rb +311 -0
- data/vendor/javascripts/emscripted-ruby/lib/tempfile.rb +209 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit.rb +280 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/assertionfailederror.rb +14 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/assertions.rb +622 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/autorunner.rb +220 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/collector.rb +43 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/collector/dir.rb +107 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/collector/objectspace.rb +34 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/error.rb +56 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/failure.rb +51 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/testcase.rb +160 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/testresult.rb +80 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/testsuite.rb +76 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/ui/console/testrunner.rb +127 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/ui/fox/testrunner.rb +268 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/ui/gtk/testrunner.rb +416 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/ui/gtk2/testrunner.rb +465 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/ui/testrunnermediator.rb +68 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/ui/testrunnerutilities.rb +46 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/ui/tk/testrunner.rb +260 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/util/backtracefilter.rb +40 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/util/observable.rb +90 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/util/procwrapper.rb +48 -0
- data/vendor/javascripts/emscripted-ruby/lib/thread.rb +479 -0
- data/vendor/javascripts/emscripted-ruby/lib/thwait.rb +169 -0
- data/vendor/javascripts/emscripted-ruby/lib/time.rb +797 -0
- data/vendor/javascripts/emscripted-ruby/lib/timeout.rb +122 -0
- data/vendor/javascripts/emscripted-ruby/lib/tmpdir.rb +130 -0
- data/vendor/javascripts/emscripted-ruby/lib/tracer.rb +167 -0
- data/vendor/javascripts/emscripted-ruby/lib/tsort.rb +290 -0
- data/vendor/javascripts/emscripted-ruby/lib/un.rb +235 -0
- data/vendor/javascripts/emscripted-ruby/lib/uri.rb +29 -0
- data/vendor/javascripts/emscripted-ruby/lib/uri/common.rb +611 -0
- data/vendor/javascripts/emscripted-ruby/lib/uri/ftp.rb +198 -0
- data/vendor/javascripts/emscripted-ruby/lib/uri/generic.rb +1122 -0
- data/vendor/javascripts/emscripted-ruby/lib/uri/http.rb +100 -0
- data/vendor/javascripts/emscripted-ruby/lib/uri/https.rb +20 -0
- data/vendor/javascripts/emscripted-ruby/lib/uri/ldap.rb +190 -0
- data/vendor/javascripts/emscripted-ruby/lib/uri/ldaps.rb +12 -0
- data/vendor/javascripts/emscripted-ruby/lib/uri/mailto.rb +266 -0
- data/vendor/javascripts/emscripted-ruby/lib/weakref.rb +100 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick.rb +29 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/accesslog.rb +67 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/cgi.rb +257 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/compat.rb +15 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/config.rb +97 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/cookie.rb +110 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/htmlutils.rb +25 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth.rb +45 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth/authenticator.rb +79 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth/basicauth.rb +65 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth/digestauth.rb +343 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth/htdigest.rb +91 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth/htgroup.rb +61 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth/htpasswd.rb +83 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth/userdb.rb +29 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpproxy.rb +254 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httprequest.rb +365 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpresponse.rb +327 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/https.rb +63 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpserver.rb +210 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpservlet.rb +22 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpservlet/abstract.rb +71 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpservlet/cgi_runner.rb +47 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpservlet/cgihandler.rb +108 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpservlet/erbhandler.rb +54 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpservlet/filehandler.rb +435 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpservlet/prochandler.rb +33 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpstatus.rb +126 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httputils.rb +399 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpversion.rb +49 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/log.rb +88 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/server.rb +200 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/ssl.rb +126 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/utils.rb +100 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/version.rb +13 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/binding.rb +65 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/data.rb +64 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/definitions.rb +250 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/documentation.rb +32 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/import.rb +80 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/importer.rb +38 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/info.rb +39 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/message.rb +54 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/operation.rb +130 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/operationBinding.rb +108 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/param.rb +85 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/parser.rb +163 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/part.rb +52 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/port.rb +84 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/portType.rb +73 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/service.rb +61 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/address.rb +40 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/binding.rb +49 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/body.rb +56 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/cgiStubCreator.rb +76 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/classDefCreator.rb +314 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/classDefCreatorSupport.rb +126 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/clientSkeltonCreator.rb +78 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/complexType.rb +161 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/data.rb +42 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/definitions.rb +149 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/driverCreator.rb +95 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/element.rb +28 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/fault.rb +56 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/header.rb +86 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/headerfault.rb +56 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/mappingRegistryCreator.rb +92 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/methodDefCreator.rb +228 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/operation.rb +122 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/servantSkeltonCreator.rb +67 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/standaloneServerStubCreator.rb +85 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/wsdl2ruby.rb +176 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/types.rb +43 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/wsdl.rb +23 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/all.rb +69 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/annotation.rb +34 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/any.rb +56 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/attribute.rb +127 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/choice.rb +69 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/complexContent.rb +92 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/complexType.rb +139 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/content.rb +96 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/data.rb +80 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/element.rb +154 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/enumeration.rb +36 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/import.rb +65 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/importer.rb +87 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/include.rb +54 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/length.rb +35 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/parser.rb +166 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/pattern.rb +36 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/schema.rb +143 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/sequence.rb +69 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/simpleContent.rb +65 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/simpleExtension.rb +54 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/simpleRestriction.rb +73 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/simpleType.rb +73 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/unique.rb +34 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/xsd2ruby.rb +107 -0
- data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/.document +1 -0
- data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/README.txt +31 -0
- data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/base64.rb +81 -0
- data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/client.rb +624 -0
- data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/config.rb +40 -0
- data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/create.rb +290 -0
- data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/datetime.rb +142 -0
- data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/httpserver.rb +178 -0
- data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/marshal.rb +76 -0
- data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/parser.rb +813 -0
- data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/server.rb +780 -0
- data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/utils.rb +165 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/charset.rb +187 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/codegen.rb +12 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/codegen/classdef.rb +203 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/codegen/commentdef.rb +34 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/codegen/gensupport.rb +166 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/codegen/methoddef.rb +63 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/codegen/moduledef.rb +191 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/datatypes.rb +1269 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/datatypes1999.rb +20 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/iconvcharset.rb +33 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/mapping.rb +42 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/namedelements.rb +95 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/ns.rb +140 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/qname.rb +78 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/xmlparser.rb +61 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/xmlparser/parser.rb +96 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/xmlparser/rexmlparser.rb +54 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/xmlparser/xmlparser.rb +50 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/xmlparser/xmlscanner.rb +147 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml.rb +440 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/baseemitter.rb +247 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/basenode.rb +216 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/constants.rb +45 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/dbm.rb +111 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/encoding.rb +33 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/error.rb +34 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/loader.rb +14 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/rubytypes.rb +408 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/store.rb +43 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/stream.rb +40 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/stringio.rb +83 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/syck.rb +19 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/tag.rb +91 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/types.rb +192 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/yamlnode.rb +54 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/ypath.rb +52 -0
- data/vendor/javascripts/emscripted-ruby/ruby.closure.js +7201 -0
- metadata +554 -0
@@ -0,0 +1,280 @@
|
|
1
|
+
require 'test/unit/testcase'
|
2
|
+
require 'test/unit/autorunner'
|
3
|
+
|
4
|
+
module Test # :nodoc:
|
5
|
+
#
|
6
|
+
# = Test::Unit - Ruby Unit Testing Framework
|
7
|
+
#
|
8
|
+
# == Introduction
|
9
|
+
#
|
10
|
+
# Unit testing is making waves all over the place, largely due to the
|
11
|
+
# fact that it is a core practice of XP. While XP is great, unit testing
|
12
|
+
# has been around for a long time and has always been a good idea. One
|
13
|
+
# of the keys to good unit testing, though, is not just writing tests,
|
14
|
+
# but having tests. What's the difference? Well, if you just _write_ a
|
15
|
+
# test and throw it away, you have no guarantee that something won't
|
16
|
+
# change later which breaks your code. If, on the other hand, you _have_
|
17
|
+
# tests (obviously you have to write them first), and run them as often
|
18
|
+
# as possible, you slowly build up a wall of things that cannot break
|
19
|
+
# without you immediately knowing about it. This is when unit testing
|
20
|
+
# hits its peak usefulness.
|
21
|
+
#
|
22
|
+
# Enter Test::Unit, a framework for unit testing in Ruby, helping you to
|
23
|
+
# design, debug and evaluate your code by making it easy to write and
|
24
|
+
# have tests for it.
|
25
|
+
#
|
26
|
+
#
|
27
|
+
# == Notes
|
28
|
+
#
|
29
|
+
# Test::Unit has grown out of and superceded Lapidary.
|
30
|
+
#
|
31
|
+
#
|
32
|
+
# == Feedback
|
33
|
+
#
|
34
|
+
# I like (and do my best to practice) XP, so I value early releases,
|
35
|
+
# user feedback, and clean, simple, expressive code. There is always
|
36
|
+
# room for improvement in everything I do, and Test::Unit is no
|
37
|
+
# exception. Please, let me know what you think of Test::Unit as it
|
38
|
+
# stands, and what you'd like to see expanded/changed/improved/etc. If
|
39
|
+
# you find a bug, let me know ASAP; one good way to let me know what the
|
40
|
+
# bug is is to submit a new test that catches it :-) Also, I'd love to
|
41
|
+
# hear about any successes you have with Test::Unit, and any
|
42
|
+
# documentation you might add will be greatly appreciated. My contact
|
43
|
+
# info is below.
|
44
|
+
#
|
45
|
+
#
|
46
|
+
# == Contact Information
|
47
|
+
#
|
48
|
+
# A lot of discussion happens about Ruby in general on the ruby-talk
|
49
|
+
# mailing list (http://www.ruby-lang.org/en/ml.html), and you can ask
|
50
|
+
# any questions you might have there. I monitor the list, as do many
|
51
|
+
# other helpful Rubyists, and you're sure to get a quick answer. Of
|
52
|
+
# course, you're also welcome to email me (Nathaniel Talbott) directly
|
53
|
+
# at mailto:testunit@talbott.ws, and I'll do my best to help you out.
|
54
|
+
#
|
55
|
+
#
|
56
|
+
# == Credits
|
57
|
+
#
|
58
|
+
# I'd like to thank...
|
59
|
+
#
|
60
|
+
# Matz, for a great language!
|
61
|
+
#
|
62
|
+
# Masaki Suketa, for his work on RubyUnit, which filled a vital need in
|
63
|
+
# the Ruby world for a very long time. I'm also grateful for his help in
|
64
|
+
# polishing Test::Unit and getting the RubyUnit compatibility layer
|
65
|
+
# right. His graciousness in allowing Test::Unit to supercede RubyUnit
|
66
|
+
# continues to be a challenge to me to be more willing to defer my own
|
67
|
+
# rights.
|
68
|
+
#
|
69
|
+
# Ken McKinlay, for his interest and work on unit testing, and for his
|
70
|
+
# willingness to dialog about it. He was also a great help in pointing
|
71
|
+
# out some of the holes in the RubyUnit compatibility layer.
|
72
|
+
#
|
73
|
+
# Dave Thomas, for the original idea that led to the extremely simple
|
74
|
+
# "require 'test/unit'", plus his code to improve it even more by
|
75
|
+
# allowing the selection of tests from the command-line. Also, without
|
76
|
+
# RDoc, the documentation for Test::Unit would stink a lot more than it
|
77
|
+
# does now.
|
78
|
+
#
|
79
|
+
# Everyone who's helped out with bug reports, feature ideas,
|
80
|
+
# encouragement to continue, etc. It's a real privilege to be a part of
|
81
|
+
# the Ruby community.
|
82
|
+
#
|
83
|
+
# The guys at RoleModel Software, for putting up with me repeating, "But
|
84
|
+
# this would be so much easier in Ruby!" whenever we're coding in Java.
|
85
|
+
#
|
86
|
+
# My Creator, for giving me life, and giving it more abundantly.
|
87
|
+
#
|
88
|
+
#
|
89
|
+
# == License
|
90
|
+
#
|
91
|
+
# Test::Unit is copyright (c) 2000-2003 Nathaniel Talbott. It is free
|
92
|
+
# software, and is distributed under the Ruby license. See the COPYING
|
93
|
+
# file in the standard Ruby distribution for details.
|
94
|
+
#
|
95
|
+
#
|
96
|
+
# == Warranty
|
97
|
+
#
|
98
|
+
# This software is provided "as is" and without any express or
|
99
|
+
# implied warranties, including, without limitation, the implied
|
100
|
+
# warranties of merchantibility and fitness for a particular
|
101
|
+
# purpose.
|
102
|
+
#
|
103
|
+
#
|
104
|
+
# == Author
|
105
|
+
#
|
106
|
+
# Nathaniel Talbott.
|
107
|
+
# Copyright (c) 2000-2003, Nathaniel Talbott
|
108
|
+
#
|
109
|
+
# ----
|
110
|
+
#
|
111
|
+
# = Usage
|
112
|
+
#
|
113
|
+
# The general idea behind unit testing is that you write a _test_
|
114
|
+
# _method_ that makes certain _assertions_ about your code, working
|
115
|
+
# against a _test_ _fixture_. A bunch of these _test_ _methods_ are
|
116
|
+
# bundled up into a _test_ _suite_ and can be run any time the
|
117
|
+
# developer wants. The results of a run are gathered in a _test_
|
118
|
+
# _result_ and displayed to the user through some UI. So, lets break
|
119
|
+
# this down and see how Test::Unit provides each of these necessary
|
120
|
+
# pieces.
|
121
|
+
#
|
122
|
+
#
|
123
|
+
# == Assertions
|
124
|
+
#
|
125
|
+
# These are the heart of the framework. Think of an assertion as a
|
126
|
+
# statement of expected outcome, i.e. "I assert that x should be equal
|
127
|
+
# to y". If, when the assertion is executed, it turns out to be
|
128
|
+
# correct, nothing happens, and life is good. If, on the other hand,
|
129
|
+
# your assertion turns out to be false, an error is propagated with
|
130
|
+
# pertinent information so that you can go back and make your
|
131
|
+
# assertion succeed, and, once again, life is good. For an explanation
|
132
|
+
# of the current assertions, see Test::Unit::Assertions.
|
133
|
+
#
|
134
|
+
#
|
135
|
+
# == Test Method & Test Fixture
|
136
|
+
#
|
137
|
+
# Obviously, these assertions have to be called within a context that
|
138
|
+
# knows about them and can do something meaningful with their
|
139
|
+
# pass/fail value. Also, it's handy to collect a bunch of related
|
140
|
+
# tests, each test represented by a method, into a common test class
|
141
|
+
# that knows how to run them. The tests will be in a separate class
|
142
|
+
# from the code they're testing for a couple of reasons. First of all,
|
143
|
+
# it allows your code to stay uncluttered with test code, making it
|
144
|
+
# easier to maintain. Second, it allows the tests to be stripped out
|
145
|
+
# for deployment, since they're really there for you, the developer,
|
146
|
+
# and your users don't need them. Third, and most importantly, it
|
147
|
+
# allows you to set up a common test fixture for your tests to run
|
148
|
+
# against.
|
149
|
+
#
|
150
|
+
# What's a test fixture? Well, tests do not live in a vacuum; rather,
|
151
|
+
# they're run against the code they are testing. Often, a collection
|
152
|
+
# of tests will run against a common set of data, also called a
|
153
|
+
# fixture. If they're all bundled into the same test class, they can
|
154
|
+
# all share the setting up and tearing down of that data, eliminating
|
155
|
+
# unnecessary duplication and making it much easier to add related
|
156
|
+
# tests.
|
157
|
+
#
|
158
|
+
# Test::Unit::TestCase wraps up a collection of test methods together
|
159
|
+
# and allows you to easily set up and tear down the same test fixture
|
160
|
+
# for each test. This is done by overriding #setup and/or #teardown,
|
161
|
+
# which will be called before and after each test method that is
|
162
|
+
# run. The TestCase also knows how to collect the results of your
|
163
|
+
# assertions into a Test::Unit::TestResult, which can then be reported
|
164
|
+
# back to you... but I'm getting ahead of myself. To write a test,
|
165
|
+
# follow these steps:
|
166
|
+
#
|
167
|
+
# * Make sure Test::Unit is in your library path.
|
168
|
+
# * require 'test/unit' in your test script.
|
169
|
+
# * Create a class that subclasses Test::Unit::TestCase.
|
170
|
+
# * Add a method that begins with "test" to your class.
|
171
|
+
# * Make assertions in your test method.
|
172
|
+
# * Optionally define #setup and/or #teardown to set up and/or tear
|
173
|
+
# down your common test fixture.
|
174
|
+
# * You can now run your test as you would any other Ruby
|
175
|
+
# script... try it and see!
|
176
|
+
#
|
177
|
+
# A really simple test might look like this (#setup and #teardown are
|
178
|
+
# commented out to indicate that they are completely optional):
|
179
|
+
#
|
180
|
+
# require 'test/unit'
|
181
|
+
#
|
182
|
+
# class TC_MyTest < Test::Unit::TestCase
|
183
|
+
# # def setup
|
184
|
+
# # end
|
185
|
+
#
|
186
|
+
# # def teardown
|
187
|
+
# # end
|
188
|
+
#
|
189
|
+
# def test_fail
|
190
|
+
# assert(false, 'Assertion was false.')
|
191
|
+
# end
|
192
|
+
# end
|
193
|
+
#
|
194
|
+
#
|
195
|
+
# == Test Runners
|
196
|
+
#
|
197
|
+
# So, now you have this great test class, but you still need a way to
|
198
|
+
# run it and view any failures that occur during the run. This is
|
199
|
+
# where Test::Unit::UI::Console::TestRunner (and others, such as
|
200
|
+
# Test::Unit::UI::GTK::TestRunner) comes into play. The console test
|
201
|
+
# runner is automatically invoked for you if you require 'test/unit'
|
202
|
+
# and simply run the file. To use another runner, or to manually
|
203
|
+
# invoke a runner, simply call its run class method and pass in an
|
204
|
+
# object that responds to the suite message with a
|
205
|
+
# Test::Unit::TestSuite. This can be as simple as passing in your
|
206
|
+
# TestCase class (which has a class suite method). It might look
|
207
|
+
# something like this:
|
208
|
+
#
|
209
|
+
# require 'test/unit/ui/console/testrunner'
|
210
|
+
# Test::Unit::UI::Console::TestRunner.run(TC_MyTest)
|
211
|
+
#
|
212
|
+
#
|
213
|
+
# == Test Suite
|
214
|
+
#
|
215
|
+
# As more and more unit tests accumulate for a given project, it
|
216
|
+
# becomes a real drag running them one at a time, and it also
|
217
|
+
# introduces the potential to overlook a failing test because you
|
218
|
+
# forget to run it. Suddenly it becomes very handy that the
|
219
|
+
# TestRunners can take any object that returns a Test::Unit::TestSuite
|
220
|
+
# in response to a suite method. The TestSuite can, in turn, contain
|
221
|
+
# other TestSuites or individual tests (typically created by a
|
222
|
+
# TestCase). In other words, you can easily wrap up a group of
|
223
|
+
# TestCases and TestSuites like this:
|
224
|
+
#
|
225
|
+
# require 'test/unit/testsuite'
|
226
|
+
# require 'tc_myfirsttests'
|
227
|
+
# require 'tc_moretestsbyme'
|
228
|
+
# require 'ts_anothersetoftests'
|
229
|
+
#
|
230
|
+
# class TS_MyTests
|
231
|
+
# def self.suite
|
232
|
+
# suite = Test::Unit::TestSuite.new
|
233
|
+
# suite << TC_MyFirstTests.suite
|
234
|
+
# suite << TC_MoreTestsByMe.suite
|
235
|
+
# suite << TS_AnotherSetOfTests.suite
|
236
|
+
# return suite
|
237
|
+
# end
|
238
|
+
# end
|
239
|
+
# Test::Unit::UI::Console::TestRunner.run(TS_MyTests)
|
240
|
+
#
|
241
|
+
# Now, this is a bit cumbersome, so Test::Unit does a little bit more
|
242
|
+
# for you, by wrapping these up automatically when you require
|
243
|
+
# 'test/unit'. What does this mean? It means you could write the above
|
244
|
+
# test case like this instead:
|
245
|
+
#
|
246
|
+
# require 'test/unit'
|
247
|
+
# require 'tc_myfirsttests'
|
248
|
+
# require 'tc_moretestsbyme'
|
249
|
+
# require 'ts_anothersetoftests'
|
250
|
+
#
|
251
|
+
# Test::Unit is smart enough to find all the test cases existing in
|
252
|
+
# the ObjectSpace and wrap them up into a suite for you. It then runs
|
253
|
+
# the dynamic suite using the console TestRunner.
|
254
|
+
#
|
255
|
+
#
|
256
|
+
# == Questions?
|
257
|
+
#
|
258
|
+
# I'd really like to get feedback from all levels of Ruby
|
259
|
+
# practitioners about typos, grammatical errors, unclear statements,
|
260
|
+
# missing points, etc., in this document (or any other).
|
261
|
+
#
|
262
|
+
|
263
|
+
module Unit
|
264
|
+
# If set to false Test::Unit will not automatically run at exit.
|
265
|
+
def self.run=(flag)
|
266
|
+
@run = flag
|
267
|
+
end
|
268
|
+
|
269
|
+
# Automatically run tests at exit?
|
270
|
+
def self.run?
|
271
|
+
@run ||= false
|
272
|
+
end
|
273
|
+
end
|
274
|
+
end
|
275
|
+
|
276
|
+
at_exit do
|
277
|
+
unless $! || Test::Unit.run?
|
278
|
+
exit Test::Unit::AutoRunner.run
|
279
|
+
end
|
280
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
#--
|
2
|
+
#
|
3
|
+
# Author:: Nathaniel Talbott.
|
4
|
+
# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
|
5
|
+
# License:: Ruby license.
|
6
|
+
|
7
|
+
module Test
|
8
|
+
module Unit
|
9
|
+
|
10
|
+
# Thrown by Test::Unit::Assertions when an assertion fails.
|
11
|
+
class AssertionFailedError < StandardError
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,622 @@
|
|
1
|
+
# Author:: Nathaniel Talbott.
|
2
|
+
# Copyright:: Copyright (c) 2000-2003 Nathaniel Talbott. All rights reserved.
|
3
|
+
# License:: Ruby license.
|
4
|
+
|
5
|
+
require 'test/unit/assertionfailederror'
|
6
|
+
require 'test/unit/util/backtracefilter'
|
7
|
+
|
8
|
+
module Test
|
9
|
+
module Unit
|
10
|
+
|
11
|
+
##
|
12
|
+
# Test::Unit::Assertions contains the standard Test::Unit assertions.
|
13
|
+
# Assertions is included in Test::Unit::TestCase.
|
14
|
+
#
|
15
|
+
# To include it in your own code and use its functionality, you simply
|
16
|
+
# need to rescue Test::Unit::AssertionFailedError. Additionally you may
|
17
|
+
# override add_assertion to get notified whenever an assertion is made.
|
18
|
+
#
|
19
|
+
# Notes:
|
20
|
+
# * The message to each assertion, if given, will be propagated with the
|
21
|
+
# failure.
|
22
|
+
# * It is easy to add your own assertions based on assert_block().
|
23
|
+
#
|
24
|
+
# = Example Custom Assertion
|
25
|
+
#
|
26
|
+
# def deny(boolean, message = nil)
|
27
|
+
# message = build_message message, '<?> is not false or nil.', boolean
|
28
|
+
# assert_block message do
|
29
|
+
# not boolean
|
30
|
+
# end
|
31
|
+
# end
|
32
|
+
|
33
|
+
module Assertions
|
34
|
+
|
35
|
+
##
|
36
|
+
# The assertion upon which all other assertions are based. Passes if the
|
37
|
+
# block yields true.
|
38
|
+
#
|
39
|
+
# Example:
|
40
|
+
# assert_block "Couldn't do the thing" do
|
41
|
+
# do_the_thing
|
42
|
+
# end
|
43
|
+
|
44
|
+
public
|
45
|
+
def assert_block(message="assert_block failed.") # :yields:
|
46
|
+
_wrap_assertion do
|
47
|
+
if (! yield)
|
48
|
+
raise AssertionFailedError.new(message.to_s)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
##
|
54
|
+
# Asserts that +boolean+ is not false or nil.
|
55
|
+
#
|
56
|
+
# Example:
|
57
|
+
# assert [1, 2].include?(5)
|
58
|
+
|
59
|
+
public
|
60
|
+
def assert(boolean, message=nil)
|
61
|
+
_wrap_assertion do
|
62
|
+
assert_block("assert should not be called with a block.") { !block_given? }
|
63
|
+
assert_block(build_message(message, "<?> is not true.", boolean)) { boolean }
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
##
|
68
|
+
# Passes if +expected+ == +actual.
|
69
|
+
#
|
70
|
+
# Note that the ordering of arguments is important, since a helpful
|
71
|
+
# error message is generated when this one fails that tells you the
|
72
|
+
# values of expected and actual.
|
73
|
+
#
|
74
|
+
# Example:
|
75
|
+
# assert_equal 'MY STRING', 'my string'.upcase
|
76
|
+
|
77
|
+
public
|
78
|
+
def assert_equal(expected, actual, message=nil)
|
79
|
+
full_message = build_message(message, <<EOT, expected, actual)
|
80
|
+
<?> expected but was
|
81
|
+
<?>.
|
82
|
+
EOT
|
83
|
+
assert_block(full_message) { expected == actual }
|
84
|
+
end
|
85
|
+
|
86
|
+
private
|
87
|
+
def _check_exception_class(args) # :nodoc:
|
88
|
+
args.partition do |klass|
|
89
|
+
next if klass.instance_of?(Module)
|
90
|
+
assert(Exception >= klass, "Should expect a class of exception, #{klass}")
|
91
|
+
true
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
private
|
96
|
+
def _expected_exception?(actual_exception, exceptions, modules) # :nodoc:
|
97
|
+
exceptions.include?(actual_exception.class) or
|
98
|
+
modules.any? {|mod| actual_exception.is_a?(mod)}
|
99
|
+
end
|
100
|
+
|
101
|
+
##
|
102
|
+
# Passes if the block raises one of the given exceptions.
|
103
|
+
#
|
104
|
+
# Example:
|
105
|
+
# assert_raise RuntimeError, LoadError do
|
106
|
+
# raise 'Boom!!!'
|
107
|
+
# end
|
108
|
+
|
109
|
+
public
|
110
|
+
def assert_raise(*args)
|
111
|
+
_wrap_assertion do
|
112
|
+
if Module === args.last
|
113
|
+
message = ""
|
114
|
+
else
|
115
|
+
message = args.pop
|
116
|
+
end
|
117
|
+
exceptions, modules = _check_exception_class(args)
|
118
|
+
expected = args.size == 1 ? args.first : args
|
119
|
+
actual_exception = nil
|
120
|
+
full_message = build_message(message, "<?> exception expected but none was thrown.", expected)
|
121
|
+
assert_block(full_message) do
|
122
|
+
begin
|
123
|
+
yield
|
124
|
+
rescue Exception => actual_exception
|
125
|
+
break
|
126
|
+
end
|
127
|
+
false
|
128
|
+
end
|
129
|
+
full_message = build_message(message, "<?> exception expected but was\n?", expected, actual_exception)
|
130
|
+
assert_block(full_message) {_expected_exception?(actual_exception, exceptions, modules)}
|
131
|
+
actual_exception
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
##
|
136
|
+
# Alias of assert_raise.
|
137
|
+
#
|
138
|
+
# Will be deprecated in 1.9, and removed in 2.0.
|
139
|
+
|
140
|
+
public
|
141
|
+
def assert_raises(*args, &block)
|
142
|
+
assert_raise(*args, &block)
|
143
|
+
end
|
144
|
+
|
145
|
+
##
|
146
|
+
# Passes if +object+ .instance_of? +klass+
|
147
|
+
#
|
148
|
+
# Example:
|
149
|
+
# assert_instance_of String, 'foo'
|
150
|
+
|
151
|
+
public
|
152
|
+
def assert_instance_of(klass, object, message="")
|
153
|
+
_wrap_assertion do
|
154
|
+
assert_equal(Class, klass.class, "assert_instance_of takes a Class as its first argument")
|
155
|
+
full_message = build_message(message, <<EOT, object, klass, object.class)
|
156
|
+
<?> expected to be an instance of
|
157
|
+
<?> but was
|
158
|
+
<?>.
|
159
|
+
EOT
|
160
|
+
assert_block(full_message){object.instance_of?(klass)}
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
##
|
165
|
+
# Passes if +object+ is nil.
|
166
|
+
#
|
167
|
+
# Example:
|
168
|
+
# assert_nil [1, 2].uniq!
|
169
|
+
|
170
|
+
public
|
171
|
+
def assert_nil(object, message="")
|
172
|
+
assert_equal(nil, object, message)
|
173
|
+
end
|
174
|
+
|
175
|
+
##
|
176
|
+
# Passes if +object+ .kind_of? +klass+
|
177
|
+
#
|
178
|
+
# Example:
|
179
|
+
# assert_kind_of Object, 'foo'
|
180
|
+
|
181
|
+
public
|
182
|
+
def assert_kind_of(klass, object, message="")
|
183
|
+
_wrap_assertion do
|
184
|
+
assert(klass.kind_of?(Module), "The first parameter to assert_kind_of should be a kind_of Module.")
|
185
|
+
full_message = build_message(message, "<?>\nexpected to be kind_of\\?\n<?> but was\n<?>.", object, klass, object.class)
|
186
|
+
assert_block(full_message){object.kind_of?(klass)}
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
##
|
191
|
+
# Passes if +object+ .respond_to? +method+
|
192
|
+
#
|
193
|
+
# Example:
|
194
|
+
# assert_respond_to 'bugbear', :slice
|
195
|
+
|
196
|
+
public
|
197
|
+
def assert_respond_to(object, method, message="")
|
198
|
+
_wrap_assertion do
|
199
|
+
full_message = build_message(nil, "<?>\ngiven as the method name argument to #assert_respond_to must be a Symbol or #respond_to\\?(:to_str).", method)
|
200
|
+
|
201
|
+
assert_block(full_message) do
|
202
|
+
method.kind_of?(Symbol) || method.respond_to?(:to_str)
|
203
|
+
end
|
204
|
+
full_message = build_message(message, <<EOT, object, object.class, method)
|
205
|
+
<?>
|
206
|
+
of type <?>
|
207
|
+
expected to respond_to\\?<?>.
|
208
|
+
EOT
|
209
|
+
assert_block(full_message) { object.respond_to?(method) }
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
##
|
214
|
+
# Passes if +string+ =~ +pattern+.
|
215
|
+
#
|
216
|
+
# Example:
|
217
|
+
# assert_match(/\d+/, 'five, 6, seven')
|
218
|
+
|
219
|
+
public
|
220
|
+
def assert_match(pattern, string, message="")
|
221
|
+
_wrap_assertion do
|
222
|
+
pattern = case(pattern)
|
223
|
+
when String
|
224
|
+
Regexp.new(Regexp.escape(pattern))
|
225
|
+
else
|
226
|
+
pattern
|
227
|
+
end
|
228
|
+
full_message = build_message(message, "<?> expected to be =~\n<?>.", string, pattern)
|
229
|
+
assert_block(full_message) { string =~ pattern }
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
##
|
234
|
+
# Passes if +actual+ .equal? +expected+ (i.e. they are the same
|
235
|
+
# instance).
|
236
|
+
#
|
237
|
+
# Example:
|
238
|
+
# o = Object.new
|
239
|
+
# assert_same o, o
|
240
|
+
|
241
|
+
public
|
242
|
+
def assert_same(expected, actual, message="")
|
243
|
+
full_message = build_message(message, <<EOT, expected, expected.__id__, actual, actual.__id__)
|
244
|
+
<?>
|
245
|
+
with id <?> expected to be equal\\? to
|
246
|
+
<?>
|
247
|
+
with id <?>.
|
248
|
+
EOT
|
249
|
+
assert_block(full_message) { actual.equal?(expected) }
|
250
|
+
end
|
251
|
+
|
252
|
+
##
|
253
|
+
# Compares the +object1+ with +object2+ using +operator+.
|
254
|
+
#
|
255
|
+
# Passes if object1.__send__(operator, object2) is true.
|
256
|
+
#
|
257
|
+
# Example:
|
258
|
+
# assert_operator 5, :>=, 4
|
259
|
+
|
260
|
+
public
|
261
|
+
def assert_operator(object1, operator, object2, message="")
|
262
|
+
_wrap_assertion do
|
263
|
+
full_message = build_message(nil, "<?>\ngiven as the operator for #assert_operator must be a Symbol or #respond_to\\?(:to_str).", operator)
|
264
|
+
assert_block(full_message){operator.kind_of?(Symbol) || operator.respond_to?(:to_str)}
|
265
|
+
full_message = build_message(message, <<EOT, object1, AssertionMessage.literal(operator), object2)
|
266
|
+
<?> expected to be
|
267
|
+
?
|
268
|
+
<?>.
|
269
|
+
EOT
|
270
|
+
assert_block(full_message) { object1.__send__(operator, object2) }
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
##
|
275
|
+
# Passes if block does not raise an exception.
|
276
|
+
#
|
277
|
+
# Example:
|
278
|
+
# assert_nothing_raised do
|
279
|
+
# [1, 2].uniq
|
280
|
+
# end
|
281
|
+
|
282
|
+
public
|
283
|
+
def assert_nothing_raised(*args)
|
284
|
+
_wrap_assertion do
|
285
|
+
if Module === args.last
|
286
|
+
message = ""
|
287
|
+
else
|
288
|
+
message = args.pop
|
289
|
+
end
|
290
|
+
exceptions, modules = _check_exception_class(args)
|
291
|
+
begin
|
292
|
+
yield
|
293
|
+
rescue Exception => e
|
294
|
+
if ((args.empty? && !e.instance_of?(AssertionFailedError)) ||
|
295
|
+
_expected_exception?(e, exceptions, modules))
|
296
|
+
assert_block(build_message(message, "Exception raised:\n?", e)){false}
|
297
|
+
else
|
298
|
+
raise
|
299
|
+
end
|
300
|
+
end
|
301
|
+
nil
|
302
|
+
end
|
303
|
+
end
|
304
|
+
|
305
|
+
##
|
306
|
+
# Flunk always fails.
|
307
|
+
#
|
308
|
+
# Example:
|
309
|
+
# flunk 'Not done testing yet.'
|
310
|
+
|
311
|
+
public
|
312
|
+
def flunk(message="Flunked")
|
313
|
+
assert_block(build_message(message)){false}
|
314
|
+
end
|
315
|
+
|
316
|
+
##
|
317
|
+
# Passes if ! +actual+ .equal? +expected+
|
318
|
+
#
|
319
|
+
# Example:
|
320
|
+
# assert_not_same Object.new, Object.new
|
321
|
+
|
322
|
+
public
|
323
|
+
def assert_not_same(expected, actual, message="")
|
324
|
+
full_message = build_message(message, <<EOT, expected, expected.__id__, actual, actual.__id__)
|
325
|
+
<?>
|
326
|
+
with id <?> expected to not be equal\\? to
|
327
|
+
<?>
|
328
|
+
with id <?>.
|
329
|
+
EOT
|
330
|
+
assert_block(full_message) { !actual.equal?(expected) }
|
331
|
+
end
|
332
|
+
|
333
|
+
##
|
334
|
+
# Passes if +expected+ != +actual+
|
335
|
+
#
|
336
|
+
# Example:
|
337
|
+
# assert_not_equal 'some string', 5
|
338
|
+
|
339
|
+
public
|
340
|
+
def assert_not_equal(expected, actual, message="")
|
341
|
+
full_message = build_message(message, "<?> expected to be != to\n<?>.", expected, actual)
|
342
|
+
assert_block(full_message) { expected != actual }
|
343
|
+
end
|
344
|
+
|
345
|
+
##
|
346
|
+
# Passes if ! +object+ .nil?
|
347
|
+
#
|
348
|
+
# Example:
|
349
|
+
# assert_not_nil '1 two 3'.sub!(/two/, '2')
|
350
|
+
|
351
|
+
public
|
352
|
+
def assert_not_nil(object, message="")
|
353
|
+
full_message = build_message(message, "<?> expected to not be nil.", object)
|
354
|
+
assert_block(full_message){!object.nil?}
|
355
|
+
end
|
356
|
+
|
357
|
+
##
|
358
|
+
# Passes if +regexp+ !~ +string+
|
359
|
+
#
|
360
|
+
# Example:
|
361
|
+
# assert_no_match(/two/, 'one 2 three')
|
362
|
+
|
363
|
+
public
|
364
|
+
def assert_no_match(regexp, string, message="")
|
365
|
+
_wrap_assertion do
|
366
|
+
assert_instance_of(Regexp, regexp, "The first argument to assert_no_match should be a Regexp.")
|
367
|
+
full_message = build_message(message, "<?> expected to not match\n<?>.", regexp, string)
|
368
|
+
assert_block(full_message) { regexp !~ string }
|
369
|
+
end
|
370
|
+
end
|
371
|
+
|
372
|
+
UncaughtThrow = {NameError => /^uncaught throw \`(.+)\'$/,
|
373
|
+
ThreadError => /^uncaught throw \`(.+)\' in thread /} #`
|
374
|
+
|
375
|
+
##
|
376
|
+
# Passes if the block throws +expected_symbol+
|
377
|
+
#
|
378
|
+
# Example:
|
379
|
+
# assert_throws :done do
|
380
|
+
# throw :done
|
381
|
+
# end
|
382
|
+
|
383
|
+
public
|
384
|
+
def assert_throws(expected_symbol, message="", &proc)
|
385
|
+
_wrap_assertion do
|
386
|
+
assert_instance_of(Symbol, expected_symbol, "assert_throws expects the symbol that should be thrown for its first argument")
|
387
|
+
assert_block("Should have passed a block to assert_throws."){block_given?}
|
388
|
+
caught = true
|
389
|
+
begin
|
390
|
+
catch(expected_symbol) do
|
391
|
+
proc.call
|
392
|
+
caught = false
|
393
|
+
end
|
394
|
+
full_message = build_message(message, "<?> should have been thrown.", expected_symbol)
|
395
|
+
assert_block(full_message){caught}
|
396
|
+
rescue NameError, ThreadError => error
|
397
|
+
if UncaughtThrow[error.class] !~ error.message
|
398
|
+
raise error
|
399
|
+
end
|
400
|
+
full_message = build_message(message, "<?> expected to be thrown but\n<?> was thrown.", expected_symbol, $1.intern)
|
401
|
+
flunk(full_message)
|
402
|
+
end
|
403
|
+
end
|
404
|
+
end
|
405
|
+
|
406
|
+
##
|
407
|
+
# Passes if block does not throw anything.
|
408
|
+
#
|
409
|
+
# Example:
|
410
|
+
# assert_nothing_thrown do
|
411
|
+
# [1, 2].uniq
|
412
|
+
# end
|
413
|
+
|
414
|
+
public
|
415
|
+
def assert_nothing_thrown(message="", &proc)
|
416
|
+
_wrap_assertion do
|
417
|
+
assert(block_given?, "Should have passed a block to assert_nothing_thrown")
|
418
|
+
begin
|
419
|
+
proc.call
|
420
|
+
rescue NameError, ThreadError => error
|
421
|
+
if UncaughtThrow[error.class] !~ error.message
|
422
|
+
raise error
|
423
|
+
end
|
424
|
+
full_message = build_message(message, "<?> was thrown when nothing was expected", $1.intern)
|
425
|
+
flunk(full_message)
|
426
|
+
end
|
427
|
+
assert(true, "Expected nothing to be thrown")
|
428
|
+
end
|
429
|
+
end
|
430
|
+
|
431
|
+
##
|
432
|
+
# Passes if +expected_float+ and +actual_float+ are equal
|
433
|
+
# within +delta+ tolerance.
|
434
|
+
#
|
435
|
+
# Example:
|
436
|
+
# assert_in_delta 0.05, (50000.0 / 10**6), 0.00001
|
437
|
+
|
438
|
+
public
|
439
|
+
def assert_in_delta(expected_float, actual_float, delta, message="")
|
440
|
+
_wrap_assertion do
|
441
|
+
{expected_float => "first float", actual_float => "second float", delta => "delta"}.each do |float, name|
|
442
|
+
assert_respond_to(float, :to_f, "The arguments must respond to to_f; the #{name} did not")
|
443
|
+
end
|
444
|
+
assert_operator(delta, :>=, 0.0, "The delta should not be negative")
|
445
|
+
full_message = build_message(message, <<EOT, expected_float, actual_float, delta)
|
446
|
+
<?> and
|
447
|
+
<?> expected to be within
|
448
|
+
<?> of each other.
|
449
|
+
EOT
|
450
|
+
assert_block(full_message) { (expected_float.to_f - actual_float.to_f).abs <= delta.to_f }
|
451
|
+
end
|
452
|
+
end
|
453
|
+
|
454
|
+
##
|
455
|
+
# Passes if the method send returns a true value.
|
456
|
+
#
|
457
|
+
# +send_array+ is composed of:
|
458
|
+
# * A receiver
|
459
|
+
# * A method
|
460
|
+
# * Arguments to the method
|
461
|
+
#
|
462
|
+
# Example:
|
463
|
+
# assert_send [[1, 2], :include?, 4]
|
464
|
+
|
465
|
+
public
|
466
|
+
def assert_send(send_array, message="")
|
467
|
+
_wrap_assertion do
|
468
|
+
assert_instance_of(Array, send_array, "assert_send requires an array of send information")
|
469
|
+
assert(send_array.size >= 2, "assert_send requires at least a receiver and a message name")
|
470
|
+
full_message = build_message(message, <<EOT, send_array[0], AssertionMessage.literal(send_array[1].to_s), send_array[2..-1])
|
471
|
+
<?> expected to respond to
|
472
|
+
<?(?)> with a true value.
|
473
|
+
EOT
|
474
|
+
assert_block(full_message) { send_array[0].__send__(send_array[1], *send_array[2..-1]) }
|
475
|
+
end
|
476
|
+
end
|
477
|
+
|
478
|
+
##
|
479
|
+
# Builds a failure message. +head+ is added before the +template+ and
|
480
|
+
# +arguments+ replaces the '?'s positionally in the template.
|
481
|
+
|
482
|
+
public
|
483
|
+
def build_message(head, template=nil, *arguments)
|
484
|
+
template &&= template.chomp
|
485
|
+
return AssertionMessage.new(head, template, arguments)
|
486
|
+
end
|
487
|
+
|
488
|
+
private
|
489
|
+
def _wrap_assertion
|
490
|
+
@_assertion_wrapped ||= false
|
491
|
+
unless (@_assertion_wrapped)
|
492
|
+
@_assertion_wrapped = true
|
493
|
+
begin
|
494
|
+
add_assertion
|
495
|
+
return yield
|
496
|
+
ensure
|
497
|
+
@_assertion_wrapped = false
|
498
|
+
end
|
499
|
+
else
|
500
|
+
return yield
|
501
|
+
end
|
502
|
+
end
|
503
|
+
|
504
|
+
##
|
505
|
+
# Called whenever an assertion is made. Define this in classes that
|
506
|
+
# include Test::Unit::Assertions to record assertion counts.
|
507
|
+
|
508
|
+
private
|
509
|
+
def add_assertion
|
510
|
+
end
|
511
|
+
|
512
|
+
##
|
513
|
+
# Select whether or not to use the pretty-printer. If this option is set
|
514
|
+
# to false before any assertions are made, pp.rb will not be required.
|
515
|
+
|
516
|
+
public
|
517
|
+
def self.use_pp=(value)
|
518
|
+
AssertionMessage.use_pp = value
|
519
|
+
end
|
520
|
+
|
521
|
+
# :stopdoc:
|
522
|
+
|
523
|
+
class AssertionMessage
|
524
|
+
@use_pp = true
|
525
|
+
class << self
|
526
|
+
attr_accessor :use_pp
|
527
|
+
end
|
528
|
+
|
529
|
+
class Literal
|
530
|
+
def initialize(value)
|
531
|
+
@value = value
|
532
|
+
end
|
533
|
+
|
534
|
+
def inspect
|
535
|
+
@value.to_s
|
536
|
+
end
|
537
|
+
end
|
538
|
+
|
539
|
+
class Template
|
540
|
+
def self.create(string)
|
541
|
+
parts = (string ? string.scan(/(?=[^\\])\?|(?:\\\?|[^\?])+/m) : [])
|
542
|
+
self.new(parts)
|
543
|
+
end
|
544
|
+
|
545
|
+
attr_reader :count
|
546
|
+
|
547
|
+
def initialize(parts)
|
548
|
+
@parts = parts
|
549
|
+
@count = parts.find_all{|e| e == '?'}.size
|
550
|
+
end
|
551
|
+
|
552
|
+
def result(parameters)
|
553
|
+
raise "The number of parameters does not match the number of substitutions." if(parameters.size != count)
|
554
|
+
params = parameters.dup
|
555
|
+
@parts.collect{|e| e == '?' ? params.shift : e.gsub(/\\\?/m, '?')}.join('')
|
556
|
+
end
|
557
|
+
end
|
558
|
+
|
559
|
+
def self.literal(value)
|
560
|
+
Literal.new(value)
|
561
|
+
end
|
562
|
+
|
563
|
+
include Util::BacktraceFilter
|
564
|
+
|
565
|
+
def initialize(head, template_string, parameters)
|
566
|
+
@head = head
|
567
|
+
@template_string = template_string
|
568
|
+
@parameters = parameters
|
569
|
+
end
|
570
|
+
|
571
|
+
def convert(object)
|
572
|
+
case object
|
573
|
+
when Exception
|
574
|
+
<<EOM.chop
|
575
|
+
Class: <#{convert(object.class)}>
|
576
|
+
Message: <#{convert(object.message)}>
|
577
|
+
---Backtrace---
|
578
|
+
#{filter_backtrace(object.backtrace).join("\n")}
|
579
|
+
---------------
|
580
|
+
EOM
|
581
|
+
else
|
582
|
+
if(self.class.use_pp)
|
583
|
+
begin
|
584
|
+
require 'pp'
|
585
|
+
rescue LoadError
|
586
|
+
self.class.use_pp = false
|
587
|
+
return object.inspect
|
588
|
+
end unless(defined?(PP))
|
589
|
+
PP.pp(object, '').chomp
|
590
|
+
else
|
591
|
+
object.inspect
|
592
|
+
end
|
593
|
+
end
|
594
|
+
end
|
595
|
+
|
596
|
+
def template
|
597
|
+
@template ||= Template.create(@template_string)
|
598
|
+
end
|
599
|
+
|
600
|
+
def add_period(string)
|
601
|
+
(string =~ /\.\Z/ ? string : string + '.')
|
602
|
+
end
|
603
|
+
|
604
|
+
def to_s
|
605
|
+
message_parts = []
|
606
|
+
if (@head)
|
607
|
+
head = @head.to_s
|
608
|
+
unless(head.empty?)
|
609
|
+
message_parts << add_period(head)
|
610
|
+
end
|
611
|
+
end
|
612
|
+
tail = template.result(@parameters.collect{|e| convert(e)})
|
613
|
+
message_parts << tail unless(tail.empty?)
|
614
|
+
message_parts.join("\n")
|
615
|
+
end
|
616
|
+
end
|
617
|
+
|
618
|
+
# :startdoc:
|
619
|
+
|
620
|
+
end
|
621
|
+
end
|
622
|
+
end
|