├── .autotest ├── History.txt ├── Manifest.txt ├── README.txt ├── Rakefile ├── articles ├── Article.css └── how_to_use_zentest.txt ├── bin ├── multigem ├── multiruby ├── unit_diff └── zentest ├── example.txt ├── example1.rb ├── example2.rb ├── lib ├── focus.rb ├── functional_test_matrix.rb ├── unit_diff.rb ├── zentest.rb └── zentest_mapping.rb └── test ├── test_focus.rb ├── test_unit_diff.rb ├── test_zentest.rb └── test_zentest_mapping.rb /.autotest: -------------------------------------------------------------------------------- 1 | # -*- ruby -*- 2 | 3 | require 'autotest/restart' 4 | 5 | Autotest.add_hook :initialize do |at| 6 | at.add_exception 'coverage' 7 | at.add_exception 'coverage.info' 8 | 9 | at.libs << ':../../minitest/dev/lib' 10 | 11 | %w(TestZenTest).each do |klass| 12 | at.extra_class_map[klass] = "test/test_zentest.rb" 13 | end 14 | end 15 | 16 | Autotest.add_hook :all_good do |at| 17 | system "rake rcov_info" 18 | end if ENV['RCOV'] 19 | 20 | -------------------------------------------------------------------------------- /History.txt: -------------------------------------------------------------------------------- 1 | === 4.12.2 / 2024-07-02 2 | 3 | * 1 bug fix: 4 | 5 | * Fix errors created when string literals are frozen. 6 | 7 | === 4.12.1 / 2022-01-17 8 | 9 | * 1 bug fix: 10 | 11 | * ruby 3.1: Fixed YAML.load switching to safe_load. 12 | 13 | === 4.12.0 / 2019-09-22 14 | 15 | * 3 major enhancements: 16 | 17 | * Deleted autotest from project. Use minitest-autotest instead. 18 | * Removed multiruby_setup. Use ruby-install or ruby-build or install your own. 19 | * Update multiruby to use ~/.rubies (default for ruby-install). 20 | 21 | * 4 minor enhancements: 22 | 23 | * Find and use the multiruby next to multigem. 24 | * multiruby ignores GEM_HOME and GEM_PATH (to allow multigem to work). 25 | * multiruby respects global `multiruby_skip` entries in `~/.hoerc`. 26 | * multiruby sorts versions properly so glob ordering is consistent. 27 | 28 | * 1 bug fix: 29 | 30 | * Removed hacks for rbx because nobody uses rbx. 31 | 32 | === 4.11.2 / 2019-01-02 33 | 34 | * 1 bug fix: 35 | 36 | * Removed unneeded and out-of-date require_rubygems_version. 37 | 38 | === 4.11.1 / 2016-06-13 39 | 40 | * 1 minor enhancement: 41 | 42 | * Expand autotest to load 'autotest/discover*' for discovery. 43 | 44 | === 4.11.0 / 2014-09-26 45 | 46 | * 1 minor enhancement: 47 | 48 | * Rearranged died hook so user can bypass default. (bhenderson) 49 | 50 | * 1 bug fix: 51 | 52 | * Fixed rubyforge urls. 53 | 54 | === 4.10.1 / 2014-07-07 55 | 56 | * 2 bug fixes: 57 | 58 | * Change require to minitest/autorun for non-test/unit style 59 | * Change the way files are gathered to avoid StackOverflow exception if you have a TOOON of files. (joshwand) 60 | 61 | === 4.10.0 / 2014-04-23 62 | 63 | * 2 minor enhancements: 64 | 65 | * Added test_mappings accessor methods (ivar already there). 66 | * Added test_prefix to allow you to run code ahead of test loading. (default: gem minitest) 67 | 68 | === 4.9.5 / 2013-11-01 69 | 70 | * 1 bug fix: 71 | 72 | * Updated require_rubygems_version AGAIN... going too fast. (zzak) 73 | 74 | === 4.9.4 / 2013-09-20 75 | 76 | * 2 bug fixes: 77 | 78 | * Expand required rubygems version to be < 2.2 79 | * Fix parsing of minitest 5 output. 80 | 81 | === 4.9.3 / 2013-08-12 82 | 83 | * 1 minor enhancement: 84 | 85 | * Added --debug option. Probably need to add more to help bug reports. 86 | 87 | * 2 bug fixes: 88 | 89 | * Fixed completed_re and failed_results_re to match minitest 5 (and still mt 4). 90 | * Fixed handle_results to deal with minitest 5 output (eg ClassName#method_name). 91 | 92 | === 4.9.2 / 2013-05-29 93 | 94 | * 2 minor enhancements: 95 | 96 | * Added autotest-suffix description to readme. (blowmage) 97 | * zentest now outputs test classes for minitest 5 98 | 99 | === 4.9.1 / 2013-04-18 100 | 101 | * 2 minor enhancements: 102 | 103 | * Make banner more explicit about correct test file location. (rue) 104 | * Switched to #failed for calculating red/green hook. (bhenderson) 105 | 106 | === 4.9.0 / 2013-02-07 107 | 108 | * 1 minor enhancement: 109 | 110 | * Allow multiruby installs to be done entirely by symlink, bypassing build 111 | 112 | * 1 bug fix: 113 | 114 | * Fixes for maglev. 115 | 116 | === 4.8.4 / 2013-01-22 117 | 118 | * 2 minor enhancements: 119 | 120 | * Set required rubygems version to be >= 1.8 and < 2.1. (sanemat) 121 | * multiruby now just builds main, which skips rdoc and other stuff 122 | 123 | * 1 bug fix: 124 | 125 | * 1.9 proofed Module#focus 126 | 127 | === 4.8.3 / 2012-12-06 128 | 129 | * 1 bug fix: 130 | 131 | * 2.0: Minor tweak to test to get it to pass on 2.0 132 | 133 | === 4.8.2 / 2012-07-26 134 | 135 | * 1 bug fix: 136 | 137 | * Fixed 1.9+ warnings in multiruby. (bhenderson) 138 | 139 | === 4.8.1 / 2012-06-01 140 | 141 | * 1 bug fix: 142 | 143 | * Fixed 1.9 bug caused by differences between Hash#find_all and Hash#select. (semaperepelitsa) 144 | 145 | === 4.8.0 / 2012-05-04 146 | 147 | * 1 minor enhancement: 148 | 149 | * Added Minitest generation to zentest (use -t to generate for test/unit) 150 | 151 | * 1 bug fix: 152 | 153 | * Fixes and clarifications to Autotest#find_file. (hugh sasse) 154 | 155 | === 4.7.0 / 2012-03-15 156 | 157 | * 2 minor enhancements: 158 | 159 | * autotest/timestamp now uses ran_command hook. (bhenderson) 160 | * run_command hook is now passed cmd. (bhenderson) 161 | 162 | * 1 bug fix: 163 | 164 | * Fixed run_command hook to only trigger when there are test files to run. (bhenderson) 165 | 166 | === 4.6.2 / 2011-08-24 167 | 168 | * 1 minor enhancement: 169 | 170 | * Added Autotest Tips section to Readme 171 | 172 | * 1 bug fix: 173 | 174 | * Fixed mri 1.9.3 change to Find.find with autotest/restart and missing files. 175 | 176 | === 4.6.1 / 2011-08-11 177 | 178 | * 3 bug fixes: 179 | 180 | * Fix for option flags and unhandled error warning in autotest. (dbackeus) 181 | * Fix option w/ args handling and restart by storing ARGV in options[:args] 182 | * Fixed autotest --rc option handling. (simplybusiness) 183 | 184 | === 4.6.0 / 2011-07-22 185 | 186 | * 6 minor enhancements: 187 | 188 | * Added -p (plain diff) and made -u (unified diff) the default for unit_diff. 189 | * Added ./tmp to default exclusions. 190 | * Autotest defaults unit_diff to nil now, to allow minitest's enhanced assert_equal to shine. 191 | * Autotest will raise if the :died handler doesn't handle the exception. (ralfebert) 192 | * Dropped 1.8.6 as a default tag/branch to build in multiruby. 193 | * autotest can now be automatically 'narrowed' on the command-line. 194 | * eg: `autotest lib test/test_blah.rb` 195 | 196 | * 7 bug fixes: 197 | 198 | * Believe it or not... but some ppl use zentest. Fixed nested class vs module bug 199 | * Fix to turn on jruby's support for ObjectSpace. (stepheneb) 200 | * Fixed a rubygems deprecation in autotest 201 | * Fixed unit_diff scanning for minitest output. 202 | * Normalized shebangs to fix problems on windows (luis) 203 | * autotest/isolate.rb sets GEM_HOME as well as GEM_PATH. 204 | * Fixed 1.9.3 warnings. 205 | 206 | === 4.5.0 / 2011-02-18 207 | 208 | * 6 minor enhancements: 209 | 210 | * Added autotest -w flag to turn on warnings. Turned off warnings by default. 211 | * Added autotest/preload.rb to deal with rails being egregiously slow. 212 | * Added child process handling/cleanup on signals. 213 | * Added postinitialize hook. 214 | * Improved restart mechanism to include all flags. 215 | * Refactored restart plugin to Autotest#restart. 216 | 217 | * 5 bug fixes: 218 | 219 | * Added sigquit handler to restart app straight up. 220 | * Fixed autotest/isolate so it works 221 | * Fixed parse_options to take args array (default ARGV) and to be non-destructive. 222 | * Strip ascii color to avoid false positives. (graemeworthy) 223 | * Use RbConfig to remove warning 224 | 225 | === 4.4.2 / 2010-12-10 226 | 227 | * 2 bug fixes: 228 | 229 | * Added a temporary hack to deal with rspec(2?) discovery hacks. 230 | * Fixed windoze detection for unit_diff (thyresias) 231 | 232 | === 4.4.1 / 2010-12-01 233 | 234 | * 12 minor enhancements: 235 | 236 | * Merged in most things from the autotest gem: 237 | * Added --no-full-after-failed. (grosser) 238 | * Added --rc path-to-dot-autotest. (grosser) 239 | * Added --style autotest-style. (grosser) 240 | * Added clarification comments. (grosser) 241 | * Added rake task descriptions. (grosser) 242 | * Switched to optparse. (grosser) 243 | * Switched windoze detection. (grosser, tenderlove) 244 | * Did not merge test parallelization. It should be a plugin. Awaiting patch. 245 | * Added autotest/bundler plugin. 246 | * Added autotest/isolate plugin. 247 | * Added capture of skips (for minitest) from result line. 248 | * Added focus_re to focus.rb. 249 | * Added latest_results hash. 250 | * Cleaned up unit_diff matcher by using any? 251 | * Enhanced the help/usage for autotest and zentest. (hugh sasse) 252 | * Refactored autotest runner discovery. 253 | * Refactored ruby_cmd to allow plugins to affect ruby execution. 254 | * Removed befuddling override of Dir.[] from 2007. *shrug* 255 | * Removed deny method in favor of aliasing refute. 256 | 257 | * 2 bug fixes: 258 | 259 | * 1.9 shadowed variable fix 260 | * autotest/restart now passes ARGV back through to exec. yay! 261 | 262 | === 4.4.0 / 2010-09-01 263 | 264 | * 1 major enhancement: 265 | 266 | * Removed git building. I'm dropping direct support for rubinius. 267 | 268 | * 3 minor enhancements: 269 | 270 | * Added multiruby mri:list:x.y.z command so you can see what's available. 271 | * Enabled installing specific patch versions of ruby. 272 | * multiruby rubygems:update now forces a build to be less confusing. 273 | 274 | * 1 bug fix: 275 | 276 | * Removed redundant test_to_normal, now in zentest_mappings 277 | 278 | === 4.3.3 / 2010-06-17 279 | 280 | * 2 minor enhancements: 281 | 282 | * Added options and removed pattern from Autotest::RCov 283 | * update_rubygems now deletes cached rubygems installs 284 | 285 | === 4.3.2 / 2010-06-02 286 | 287 | * 1 minor enhancement: 288 | 289 | * Removed support for rbx builds. 290 | 291 | * 2 bug fixes: 292 | 293 | * Removed 'preview' from version filter so I can test with 1.9.2 294 | * Put PATH tweaks at front of PATH 295 | 296 | === 4.3.1 / 2010-03-30 297 | 298 | * 1 bug fix: 299 | 300 | * Fixed autotest output on 1.8. That's what I get for not having 301 | tests for dots. 302 | 303 | === 4.3.0 / 2010-03-27 304 | 305 | * 1 minor enhancement: 306 | 307 | * Added gemcutter rubyforge and hoe to the_usual setup 308 | 309 | * 4 bug fixes: 310 | 311 | * 1.9 compat: don't use putc anymore. (fistfvck (hah!)) 312 | * Added note that included articles are out of date 313 | * Fixed rcov plugin so multiple all_good hooks can coexist 314 | * Fixed typo in doco 315 | 316 | === 4.2.1 / 2009-12-09 317 | 318 | * 1 minor enhancement: 319 | 320 | * Added GEM_HOME/GEM_PATH setting to multiruby. 321 | 322 | * 1 bug fix: 323 | 324 | * Fixed multiruby refactoring bug from previous release. 325 | 326 | === 4.2.0 / 2009-12-08 327 | 328 | * 3 minor enhancements: 329 | 330 | * Added 'multiruby -1 $version' for easier execution (idea from flori) 331 | * Set up and tear down PATH in multiruby (luis) 332 | * died hook now gets passed the exception (amikula) 333 | 334 | * 3 bug fixes: 335 | 336 | * Deal with windoze getc returning nil (undees) 337 | * Fix unit_diff for multiline miniunit results. 338 | * Fix warning for 1.8.8+ 339 | 340 | === 4.1.4 / 2009-08-07 341 | 342 | * 2 minor enhancements: 343 | 344 | * Added ability to prepend file mappings in autotest. (irohiroki) 345 | * Switched autodiscover to use Gem.find_files. 346 | 347 | * 2 bug fixes: 348 | 349 | * Updated doco for API changes. (David Ruan) 350 | * Updated git URL for Rubinius. jbarnette 351 | 352 | === 4.1.3 / 2009-06-23 353 | 354 | * 1 bug fix: 355 | 356 | * Fixed rakefile to include seattlerb plugin. release was flubbed 357 | 358 | === 4.1.2 / 2009-06-23 359 | 360 | * 1 minor enhancement: 361 | 362 | * multiruby configure now passes --enable-shared to support wilson and friends. 363 | 364 | * 2 bug fixes: 365 | 366 | * Delete RUBYOPT in multiruby_setup to avoid catastrophe. dbalatero 367 | * Fixed version number munging for tarballs. 368 | 369 | === 4.1.1 / 2009-06-03 370 | 371 | * 1 bug fix: 372 | 373 | * some calls to Multiruby.run didn't have logging. fixed (jcoglan) 374 | 375 | === 4.1.0 / 2009-06-03 376 | 377 | * 1 major enhancement: 378 | 379 | * Removed all plugins I don't want to maintain anymore. (gem inst autotest-rails) 380 | 381 | * 4 minor enhancements: 382 | 383 | * Added #blur to focus.rb to nuke all other test classes 384 | * Clear RUBYOPT before installs (balatero) 385 | * Removed test/unit include in zentest so we can focus on miniunit 386 | * sort versions for builds. (Jens Wille) 387 | 388 | * 6 bug fixes: 389 | 390 | * Fixed a stupid bug when running on some versions of bash >= 3.2.x and using '&>' in a system call. (Jens Wille) 391 | * Fixed inconsistent test commands in autotest. (jbarnette) 392 | * Fixed unit_diff's usage generation when installed as gem. (borior) 393 | * Fixed zentest to deal with unnamed classes. (Bill Dortch) 394 | * Removed buggy/unused -l support in unit_diff. (borior) 395 | * make twice to make it more resilient to makefile parallel bugs 396 | 397 | === 4.0.0 / 2009-03-02 398 | 399 | * 2 minor enhancements: 400 | 401 | * Deleted autotest/screen - releasing as a separate gem soon. 402 | * Deleted test-rails and rails_test_audit. 403 | 404 | * 8 minor enhancements: 405 | 406 | * Added "tags" command to multiruby_setup. 407 | * Added "the_usual" as a recipe for multiruby_setup. Motivated by Dr. Nic. 408 | * Added :died hook to Autotest (yoshuki). 409 | * Added focus.rb, helping you ignore extra tests while you focus on something. 410 | * Added multigem command line tool! 411 | * Cleaned up multiruby to make it easier to tweak. 412 | * Parameterized testlib so you can override test/unit in autotest. Thanks JB! 413 | * Switched tests and rakefile to minitest. 20% faster! 414 | 415 | * 7 bug fixes: 416 | 417 | * Fix Autotest::Screen to distinguish between errors and failures. (khalsah) 418 | * Fixed some hook commands from overriding others. 419 | * Hopefully fixed growl support on 10.5.x? 420 | * Supposedly adding -w to growlnotify will fix autotest/growl. 421 | * Updated missing entries in Autotest::ALL_HOOKS. 422 | * Updated rubygems download location. (carletti) 423 | * Still not automated :( 424 | * ruby 1.9.1 fixes. 425 | 426 | === 3.11.1 / 2009-01-20 427 | 428 | * 1 minor enhancement: 429 | 430 | * Parameterized test_lib so you can override test/unit. Thanks JB! 431 | 432 | * 1 bug fix: 433 | 434 | * Fixed growl autotest plugin hooks to not return true, preempting other plugins. 435 | 436 | === 3.11.0 / 2008-10-22 437 | 438 | * 19 minor enhancements: 439 | 440 | * Added :updated hook, gets list of updated files before running tests. 441 | * Added autotest/restart.rb - restarts autotest if .autotest updated. 442 | * Added better help to multiruby. 443 | * Added dummy build command to multiruby_setup. 444 | * Added git support. 445 | * Added rbx:ln:$dir and rbx:git:current. 446 | * Added rubygems:merge as a nice little hack to share rubygems setups. 447 | * Added svn tag updating (eg will svn sw from mri 1.8.6 222 to 1.8.6 231). 448 | * Autotest hooks now take *args as well as instance of autotest. 449 | * Made it possible to have manually specified tags. 450 | * Made multiruby a little more self-repairing wrt symlinks and build dirs. 451 | * Refactored into mri_latest_tag(v). 452 | * Refactored unit_diff to make it a bit easier to use as a library. 453 | * Refactored zentest mapping main methods into munge/unmunge. 454 | * Removed rubinius specific symlink hacks, now fully supported. 455 | * mri:svn:releases figures out all the latest patch levels. 456 | * multiruby_setup clean now checks for rakefile first, since rbx has both. :( 457 | * multiruby_setup help now exits instead of building. 458 | * multiruby_setup list and clean now exit 459 | 460 | * 2 bug fixes: 461 | 462 | * ZenTestMapping converts operator prefixes to operators only when an _ follows. 463 | * Apparently Tempfile.open doesn't return it's last value. fixed. 464 | 465 | * 2 bug fixes: 466 | 467 | * Fixed bug in mri:svn:branch:xxx with svn dir name. 468 | * multiruby_setup rm now smarter about tarballs. 469 | 470 | === 3.10.0 / 2008-06-17 471 | 472 | * 1 major enhancement: 473 | 474 | * Added multiruby_setup to help manage multiruby installed versions. 475 | 476 | * 3 minor enhancements: 477 | 478 | * Added autotest/once plugin to help plugin developers. 479 | * Heavily refactored multiruby. 480 | * Switched rubinius from shotgun/rubinius to bin/rbx, finally. 481 | 482 | * 2 bug fixes: 483 | 484 | * Refactored zentest_mapping test to avoid zentest altogether. 485 | * zentest tests bail gracefully for rubinius. 486 | 487 | === 3.9.3 / 2008-06-09 488 | 489 | * 12 minor enhancements: 490 | 491 | * Added $RUBY env support to autotest so you can swap what ruby to run. 492 | * Added ALL_HOOKS array to autotest for hook devs. 493 | * Added EXCLUDED_VERSIONS to multiruby. Integrated with hoe. 494 | * Added miniunit compatibility to unit_diff's output. 495 | * Multiruby now determines the latest versions 1.8/1.9 automatically. 496 | * Removed deprecated :run hook. 497 | * Fixed zentest_assertions to be compatible with miniunit. Will phase out. 498 | * Minor autotest plugin cleanup / fixes. 499 | * Moved assert_callback to test/rails/test_case.rb 500 | * Reversed assert_includes' arguments. 501 | * Updated requirements info for other ruby impls. 502 | * util_capture now returns strings, not iostrings. 503 | 504 | * 1 bug fixes: 505 | 506 | * (add|remove)_(mappings|exceptions) now all return nil to help fix autotest hooks. 507 | 508 | === 3.9.2 / 2008-03-20 509 | 510 | * 4 minor enhancements: 511 | 512 | * Added compatibility with miniunit differences. 513 | * Added email_notify, jabber_notify, and rcov autotest plugins. 514 | * Updated rakefile to include examples automatically in example_dot_autotest. 515 | * multiruby now outputs each command so you can grab it easily. 516 | 517 | * 5 bug fixes: 518 | 519 | * Ensure tests are run after reset. 520 | * Fixed all test/rails tests to run in any combo. 521 | * Fixed up growl.rb a bit... still buggy (growlnotify, not growl.rb). 522 | * Fixes for -f (fast start) and last_mtime in general. 523 | * Fixes for 1.9 and rubinius 524 | 525 | === 3.9.1 / 2008-01-31 526 | 527 | * 1 bug fix: 528 | 529 | * OMG I'm so dumb... fixed memory leak. 530 | 531 | === 3.9.0 / 2008-01-30 532 | 533 | * 15 minor enhancements: 534 | 535 | * Added Wilson's patch to allow unit_diff to work with mspec. Adding rspec next. 536 | * Minor overhaul for autotest: 537 | * Added -f flag to start up without testing. 538 | * Added -q flag to autotest to make it extra quiet. Patch by Aaron Patterson. 539 | * Added ability to set test execution order, defaults to :random. EVIL! 540 | * Added completed_re and failed_results_re to help subclasses like rspec. 541 | * Added deprecation warnings for hooks. Deprecated :run. 542 | * Added find_directories accessor, defaults to ['.'] 543 | * Added sleep accessor, defaults to 1 second. 544 | * Changed find_files to order files in the same order as find_directories. 545 | * Changed how autodiscover works with $:, added lib to the front. 546 | * Cleaned out nearly every @ and use accessor methods instead. You should too. 547 | * Made test_mappings ordered. 548 | * Removed @files, adding @find_order and @known_files. 549 | * Renamed tests_for_file to test_files_for. 550 | * test_files_for now only returns known files. 551 | 552 | === 3.8.0 / 2008-01-12 553 | 554 | * 10 minor enhancements: 555 | 556 | * Added basic support for rubinius in multiruby. 557 | * Changed Dunno! message to only output on -v 558 | * Added Getting Started with Autotest by Philippe Hanrigou (with permission) 559 | * Updated example_dot_autotest.rb for newer plugins. 560 | * Cleaned up rdoc. 561 | * Worked with David Chelimsky to make Autotest more uber for subclasses. 562 | * Removed exceptions and test_mappings accessors and replaced with add/remove/clear methods. Updating .autotest should be very straightforward. 563 | * Moved :initialize hook to beginning of run method 564 | * Changed load/customization order to be: 565 | * Autotest 566 | * AutotestSubClass 567 | * ~/.autotest 568 | * ./.autotest (yes, both .autotest files). 569 | * Moved away from using instance variables to encourage subclasses to use accessors. 570 | 571 | === 3.7.2 / 2008-01-09 572 | 573 | * 2 minor enhancements: 574 | 575 | * Extended file map for tests to include subdirs correctly. 576 | * Added debugging output on bad maps if -v set. 577 | 578 | === 3.7.1 / 2007-12-27 579 | 580 | * 2 minor enhancements: 581 | 582 | * multiruby now downloads 1.8.6 and 1.9 on virgin run. 583 | * Improved output for the downloads. 584 | 585 | === 3.7.0 / 2007-12-21 586 | 587 | * 8 minor enhancements: 588 | 589 | * Added add_mapping to make file mappings cleaner. 590 | * Added assert_callback thanks to Aaron Patterson. 591 | * Added autotest/cctray. 592 | * Added extra_files and extra_class_map, allowing .autotest files to be awesome. 593 | * Added url for lettuce principal thanks to Hugh Sasse. 594 | * Added zentest.rb refactorings thanks to Hugh Sasse. 595 | * Exceptions are now an array of regexps, built after :initialize hook. 596 | * Removed ruby_fork and ruby_fork_client. Eric got a faster laptop. :P 597 | 598 | * 6 bug fixes: 599 | 600 | * Fixed all my annoyances with @exceptions. 601 | * Fixed crasher in autotest/redgreen for non-matches. 602 | * Fixed everything to work with ruby 1.9. 603 | * Fixed rubygem requires causing strangeness in tests. 604 | * Fixed zentest mapping so ruby2ruby and test_ruby2ruby work. 605 | * Removed stupid YAML methods from TrueClass during 606 | testing. (Infected by Test::Rails' use of rubygems) 607 | 608 | === 3.6.1 / 2007-07-23 609 | 610 | * 4 minor enhancements: 611 | 612 | * Test::Rails::ViewTestCase now uses assert_select. 613 | * assert_form and friends now work with blocks like assert_select 614 | does. 615 | * Allow path_parameters in view tests to be ammended, making working 616 | with routes easier. 617 | * New version of autotest/notify.rb uses notify-send. 618 | * Fixed rdoc formatting on autotest and a couple plugins. 619 | 620 | === 3.6.0 / 2007-05-25 621 | 622 | * 4 major enhancements: 623 | 624 | * New auto-discovery mechanism to make rspec and friends work independently! 625 | * Moved and restructured camping and rails as plugins. 626 | * Removed rspec - now packaged with rspec and/or as plugin. 627 | * Changed the way FTM tests are named. Allows multiple matricies. 628 | 629 | * 3 minor enhancements: 630 | 631 | * Added :OK special result value to FTM. 632 | * Hugh Sasse is awesome. Rdoc happiness. 633 | * Parameterized emacs client command. 634 | 635 | * 3 bug fixes: 636 | 637 | * Dup load path because I'm dum. 638 | * Fixed a lame syntax error in emacs.rb. 639 | * autotest now builds command separator with '&' on windoze. ARGH! Why is this the first I've heard of this?!? 640 | 641 | === 3.5.2 / 2007-04-30 642 | 643 | * 4 bug fixes: 644 | 645 | * Patch up Rails fixture defaults for Test::Rails::TestCase. 646 | * Session now properly hooked up to controllers. 647 | * ruby 1.8.6 has a bug on 'raise Interrupt' with no args. Fixed on both sides. 648 | * Fixed redgreen to work with new getc/putc-based output. (from Finn Smith) 649 | 650 | === 3.5.1 / 2007-04-17 651 | 652 | * 4 bug fixes: 653 | 654 | * Fixed gem name to be camel-case again. Fixed on rubyforge too. 655 | * Fixed rdoc for hooks. 656 | * Fixed redgreen, results changed to an array. 657 | * Patch up Rails fixture defaults, since they're not inheriting properly. 658 | 659 | === 3.5.0 / 2007-04-12 660 | 661 | * 4 major enhancements: 662 | 663 | * Now requires RubyGems 0.9.1 or newer. 664 | * Autotest and unit_diff are both unbuffered. Results are more live. 665 | * Refactored and redesigned how files map to test from Sean Carley. See fixtures plugin as an example. 666 | * Generalize how autotest handler is instantiated and invoked, allowing for many more autotest types, including combos. 667 | 668 | * 23 minor enhancements: 669 | 670 | * Added all_good hook if initial run was all_good as well. 671 | * Added assert_in_epsilon to ZentestAssertions. 672 | * Added autotest plugin to auto-update source ala tinderbox/cruisecontrol. 673 | * Added autotest plugin to update ichat/adium IM status with code stats. 674 | * Added autotest plugin to update the GNU screen statusbar from Yuichi Tateno. 675 | * Added autotest syntax error handling from Ryan Platte. 676 | * Added autotest/emacs emacs integration plugin!!! YAY! 677 | * Added autotest/migrate.rb. 678 | * Added camping support from Geoffrey Grossenbach. 679 | * Added changed file reporting to autotest via -v flag. 680 | * Added informative summary and filtering via ENV['VERSIONS'] to multiruby. 681 | * Added libnotify support from Kazuo Saito. 682 | * Added lots of rdoc patches from Hugh Sasse. 683 | * Added rjs files to view_test_case. 684 | * Added rspec_autotest "stolen" from caldersphere.net 685 | * Added run_command hook to trigger the start of a test run. 686 | * Added tmp to rails' exceptions list. 687 | * Added unit_diff command variable to autotest for customizing flags and such. 688 | * Added zentest_mapping.rb and test. 689 | * Allow session to work in Test::Rails view tests. 690 | * Improved autotest/growl.rb output from imajes. 691 | * Improved autotest/timestamp output from Josh Susser. 692 | * Test::Rails works with Rails 1.2. 693 | 694 | * 2 bug fixes: 695 | 696 | * Accelerated Test::Rails unit tests via sensible defaults. 697 | * Better assertion messages for ZentestAssertions. 698 | 699 | === 3.4.3 / 2006-12-19 700 | 701 | * 2 minor enhancements: 702 | 703 | * Add assert_title and assert_h (for header). 704 | 705 | * 2 bug fixes: 706 | 707 | * Rereleased against latest version of hoe to fix load path problems. 708 | * Fix case ViewTestCase for case-sensitive file systems. 709 | 710 | === 3.4.2 / 2006-11-09 711 | 712 | * 2 minor enhancements: 713 | 714 | * Add TextHelper for pluralize. 715 | * Add deny_nil to Test::Rails. 716 | 717 | * 7 bug fixes: 718 | 719 | * Fixed test_help's Flash. It's is a module. Oops... 720 | * Don't run util_audit_assert_assigned if tests didn't pass, results will be bogus. 721 | * Fixed AssertionsTest names to match what autotest expects. 722 | * Fixed bug where deny_includes failed for Symbol keys. 723 | * Switched autotest to use require instead of load... Why??? I don't know!! 724 | * Fixed a minor but annoying whitespace difference in unit_diff. 725 | * Switched argument order of assert_includes and deny_includes to match Test::Unit convention. 726 | 727 | === 3.4.1 / 2006-10-13 728 | 729 | * 3 minor enhancements: 730 | 731 | * FUNDAMENTALLY changed the way failures map back to tests. This REQUIRES users of autotest to ensure that their tests and impls map 1:1 at every scoping level. I'll blog more details. 732 | * Hoe'd rakefile 733 | * Added support for render :collection to RenderTree. 734 | 735 | * 7 bug fixes: 736 | 737 | * Fixed autotest tests for custom ruby names. 738 | * Fixed some documentation errors in ControllerTestCase. 739 | * Fixed setup in FunctionalTestCase. 740 | * Allowed @assigns_ignored to contain either Symbols or Strings, bug 5233. 741 | * Using Object.path2class to look up classes in helper test cases, bug 5493. 742 | * Added assert_text_area, bug 5452. 743 | * Renamed assert_select to assert_select_tag. Stupid rails. We were here first. 744 | 745 | === 3.4.0 / 2006-09-12 746 | 747 | * 13 minor enhancements: 748 | 749 | * Broke out example_dot_autotest into multiple files in lib. 750 | * Enhanced hook system so it can return true if event handled. 751 | * Sleep is now 1 second by default because life is too short. 752 | * Hooked interrupt with new hook system. First handler wins. 753 | * Hooked test results before output 754 | * Accurate test counts for Test::Rails. 755 | * Added snarl autotest plugin, thanks to Patrick Hurley. 756 | * Added timestamp autotest plugin, thanks to Joe Goldberg. 757 | * Added redgreen, thanks to Pat Eyler, Sean Carley, and Rob Sanheim. 758 | * Added kdenotify autotest plugin, thanks to Geir Freysson. 759 | * Added markaby support for Test::Rails. 760 | * Added hack to display a tree of render calls. 761 | * Added hook to perform extra setup for 762 | 763 | * 5 bug fixes: 764 | 765 | * Extended zentest to deal with rails a bit better... ugh. 766 | * Fixed @libs for windoze. 767 | * Fixed inner class/test identification in autotest. 768 | * Namespaced all plugins... eric is anal. 769 | * No longer freak out if rubygems tarball not in multiruby/versions. 770 | 771 | === 3.3.0 / 2006-07-28 772 | 773 | * 1 major enhancement: 774 | 775 | * autotest has been rewritten to be much cleaner, now has a plugin system. 776 | 777 | * 5 minor enhancements: 778 | 779 | * test/rails adds helper tests, "stolen" from Geoff's work, (which was "stolen" from ryan's work. :P) 780 | * autotest turnaround is now faster. 781 | * Added more prune dirs to autotest. 782 | * test/rails rewinds IOs containing captured output. Added assert_empty. 783 | * Document that autotest doesn't run the db:test:prepare rake task when in Rails mode. 784 | * Added ruby_fork, but haven't fully plugged into autotest yet. 785 | 786 | * 7 bug fixes: 787 | 788 | * Add SIGINT handler to unit_diff to give a more graceful exit. 789 | * Don't strip <> from tempfiles, parse_diff does it for us. 790 | * Fixed autotest problems on windoze. Ugh. 791 | * Fixed broken pipe bug and newline bug in unit_diff. 792 | * Make request_method in ControllerTestCase a String. 793 | * multitest installs rubygems if tarball found in versions dir. 794 | * multitest only configures when makefile is missing. Rebuilds much faster now. 795 | * ruby_fork exits without backtrace and allows redirection of output. 796 | 797 | === 3.2.0 / 2006-04-10 798 | 799 | * 1 major enhancement: 800 | 801 | * Added Test::Rails. 802 | 803 | * 1 minor enhancement: 804 | 805 | * Extended autotest for Test::Rails. 806 | 807 | * 4 bug fixes: 808 | 809 | * Autotest now detects changes in rhtml. 810 | * Improved autotest's file mapping and choice of ruby. 811 | * We've got RDoc, yes we do! 812 | * Removed redundancies in rakefile. Using gem spec for most stuff now. 813 | 814 | === 3.1.0 / 2006-03-29 815 | 816 | * 2 major enhancements: 817 | 818 | * Added multiruby! YAY! 819 | * Massive improvements to autotest: speed, reliability, reporting, etc. 820 | 821 | * 10 minor enhancements: 822 | 823 | * multiruby builds in a centralized location. YAY! 824 | * multiruby now allows reinstalls quickly and easily (can even skip config). 825 | * multiruby exits with total sum of exit codes. 826 | * autotest file search is muuuuch faster. 827 | * autotest automatically detects rails mode. 828 | * autotest deals with rails dependencies much better. 829 | * autotest reruns a full suite after you go green to ensure full coverage. 830 | * autotest always runs with unit_diff -u. 831 | * autotest can now run cvs/svn/p4 up periodically to be a mini-tinderbox. 832 | * autotest now has real help. 833 | 834 | * 4 bug fixes: 835 | 836 | * ZenTest is now zentest. Yay for consistency! (do a rake uninstall to clean) 837 | * ZenTest excludes pretty_print methods. 838 | * Fixed unary operator issues (they were backwards... oops!) for ZenTest. 839 | * unit_diff now runs diff.exe on Windoze. dunno if that will work. 840 | 841 | === 3.0.0 / 2006-03-06 842 | 843 | * 2 major enhancements: 844 | 845 | * Added autotest and rails_autotest. YAY for continous testing! 846 | * Repackaged and gemified. YAY for gemification! 847 | 848 | * 3 minor enhancements: 849 | 850 | * Added non-mappable tests starting with test_integration_. 851 | * Lots of code and test refactoring and cleanup. 852 | * Massive improvement on unit tests. 853 | 854 | * 3 bug fixes: 855 | 856 | * Cleaned up class method inheritence. Esp relevant for rails testing. 857 | * Finally fixed the unit_diff parse bug! 858 | * Fixed improper counting of errors if a class was missing, should be 1 + missing methods. 859 | 860 | === 2.4.0 / 2005-03-21 861 | 862 | * 3 minor enhancements: 863 | 864 | * Able to audit standard class library (so now we can audit rubicon!). 865 | * Able to map against class methods (self.blah <=> test_class_blah). 866 | * Added -I=rubypath support 867 | 868 | * 4 bug fixes: 869 | 870 | * bug:1151 Fixed stupid problem w/ unit_diff. 871 | * bug:1454 code generation correctly matches class/module for nested classes. 872 | * bug:1455 Updated method mapping to work on all operators listed in my quickref. 873 | * Realized I'm a moron and did NOT release in March like I thought... 874 | 875 | === 2.3.0 / 2004-11-18 876 | 877 | * 6 minor enhancements: 878 | 879 | * Massively expanded the method name mappings. 880 | * Added -r flag to reverse map names, for Rails style testing. 881 | * Added -e to auto eval tests generated. 882 | * Added -b & -c flags in unit_diff (passed to diff) 883 | * Added install and uninstall rules to Makefile. 884 | * Added some more doco to README.txt 885 | 886 | * 7 bug fixes: 887 | 888 | * Cleaned up and refactored tests. 889 | * Changed the way files are generated, to accomodate new flags. 890 | * Added some more tests. 891 | * Added $ZENTEST=true 892 | * Fixed the one-liner diff bug. 893 | * Cleaned up multi-line string diffs by unescaping \n 894 | * Cleaned result for flunks. 895 | 896 | === 2.2.0 / 2004-10-18 897 | 898 | * 4 minor enhancements: 899 | 900 | * Added LinuxJournalArticle.txt! WOOT! 901 | * Added unit_diff.rb - a very cool filter for test output! 902 | * Extended ZenTest to work with standard input 903 | * Added "ZenTest FULL" to force ZenTest to analyze inherited methods, for subclasses of the standard library. 904 | 905 | * 3 bug fixes: 906 | 907 | * Extended makefile to be more dynamic and stop diffing versions. ugh. 908 | * Expanded the method rename map to handle <<, *, +, and ==. 909 | * Added more test cases. 910 | 911 | === 2.1.2 / 2004-03-08 912 | 913 | * 4 bug fixes: 914 | 915 | * Fixed yet another 1.8ism, results will be the same in 1.8 and 1.6. 916 | * Fixed code responsible for method name conversion. 917 | * I am a moron... didn't run tests after updating version. 918 | * Need to convert my diff-based tests to unit tests. 919 | 920 | === 2.1.1 / 2004-03-06 921 | 922 | * 3 bug fixes: 923 | 924 | * Fixed a 1.8ism. 925 | * Removed zentestrunner. Older ruby users will just have to suffer. 926 | * Updated history to ZenWeb format. 927 | 928 | === 2.1.0 / 2003-01-07 929 | 930 | * 3 major enhancements: 931 | 932 | * Output is runnable as-is thanks to zentestrunner.rb. 933 | * Wrapped up all running functionality into ZenTest.fix 934 | * Added simple statistic output... Thanks Dave & Andy!!! 935 | 936 | * 2 minor enhancements: 937 | 938 | * Added zentestrunner.rb until Nathaniel accepts my changes! 939 | * Added a clean rule to Makefile 940 | 941 | * 3 bug fixes: 942 | 943 | * Removed at_exit override and avoided test/unit altogether. 944 | * Extended README.txt to include some of the rules. 945 | * Fixed several tests and added assertions for new stats 946 | 947 | === 2.0.0 / 2002-10-29 948 | 949 | * 2 major enhancements: 950 | 951 | * Rewrite of ZenTest.rb into actual OO design. 952 | * Added unit tests, finally... 953 | 954 | === 1.0.1 / 2002-09-28 955 | 956 | * 1 minor enhancement: 957 | 958 | * Only loads when a class is detected, allows some scripts to be skipped. 959 | 960 | * 3 bug fixes: 961 | 962 | * Cleaned up output. Verbose when $DEBUG is true. 963 | * Added an error count that is output at end. 964 | * Better filtering or conversion on some method names. 965 | 966 | === 1.0.0 / 2002-09-24 967 | 968 | * 1 major enhancement: 969 | 970 | * Birthday! 971 | -------------------------------------------------------------------------------- /Manifest.txt: -------------------------------------------------------------------------------- 1 | .autotest 2 | History.txt 3 | Manifest.txt 4 | README.txt 5 | Rakefile 6 | articles/Article.css 7 | articles/how_to_use_zentest.txt 8 | bin/multigem 9 | bin/multiruby 10 | bin/unit_diff 11 | bin/zentest 12 | example.txt 13 | example1.rb 14 | example2.rb 15 | lib/focus.rb 16 | lib/functional_test_matrix.rb 17 | lib/unit_diff.rb 18 | lib/zentest.rb 19 | lib/zentest_mapping.rb 20 | test/test_focus.rb 21 | test/test_unit_diff.rb 22 | test/test_zentest.rb 23 | test/test_zentest_mapping.rb 24 | -------------------------------------------------------------------------------- /README.txt: -------------------------------------------------------------------------------- 1 | = ZenTest 2 | 3 | home :: https://github.com/seattlerb/zentest 4 | rdoc :: http://docs.seattlerb.org/ZenTest 5 | 6 | == DESCRIPTION 7 | 8 | ZenTest provides 4 different tools: zentest, unit_diff, autotest, and 9 | multiruby. 10 | 11 | zentest scans your target and unit-test code and writes your missing 12 | code based on simple naming rules, enabling XP at a much quicker pace. 13 | zentest only works with Ruby and Minitest or Test::Unit. There is 14 | enough evidence to show that this is still proving useful to users, so 15 | it stays. 16 | 17 | unit_diff is a command-line filter to diff expected results from 18 | actual results and allow you to quickly see exactly what is wrong. 19 | Do note that minitest 2.2+ provides an enhanced assert_equal obviating 20 | the need for unit_diff 21 | 22 | autotest is a continous testing facility meant to be used during 23 | development. As soon as you save a file, autotest will run the 24 | corresponding dependent tests. 25 | 26 | multiruby runs anything you want on multiple versions of ruby. Great 27 | for compatibility checking! Use multiruby_setup to manage your 28 | installed versions. 29 | 30 | *NOTE:* The next major release of zentest will not include autotest 31 | (use minitest-autotest instead) and multiruby will use rbenv / 32 | ruby-build for version management. 33 | 34 | == FEATURES 35 | 36 | * Scans your ruby code and tests and generates missing methods for you. 37 | * Includes a very helpful filter for Test/Spec output called unit_diff. 38 | * Continually and intelligently test only those files you change with autotest. 39 | * Test against multiple versions with multiruby. 40 | * Includes a LinuxJournal article on testing with ZenTest written by Pat Eyler. 41 | * See also: http://blog.zenspider.com/archives/zentest/ 42 | * See also: http://blog.segment7.net/articles/category/zentest 43 | 44 | == STRATEGERY 45 | 46 | There are two strategeries intended for ZenTest: test conformance 47 | auditing and rapid XP. 48 | 49 | For auditing, ZenTest provides an excellent means of finding methods 50 | that have slipped through the testing process. I've run it against my 51 | own software and found I missed a lot in a well tested 52 | package. Writing those tests found 4 bugs I had no idea existed. 53 | 54 | ZenTest can also be used to evaluate generated code and execute your 55 | tests, allowing for very rapid development of both tests and 56 | implementation. 57 | 58 | == AUTOTEST TIPS 59 | 60 | Setting up your project with a custom setup is easily done by creating 61 | a ".autotest" file in your project. Here is an example of adding some 62 | plugins, using minitest as your test library, and running rcov on full 63 | passes: 64 | 65 | require 'autotest/restart' 66 | 67 | Autotest.add_hook :initialize do |at| 68 | at.testlib = "minitest/autorun" 69 | end 70 | 71 | Autotest.add_hook :all_good do |at| 72 | system "rake rcov_info" 73 | end if ENV['RCOV'] 74 | 75 | Do note, since minitest ships with ruby19, if you want to use the 76 | latest minitest gem you need to ensure that the gem activation occurs! 77 | To do this, add the gem activation and the proper require to a 78 | separate file (like ".minitest.rb" or even a test helper if you have 79 | one) and use that for your testlib instead: 80 | 81 | .minitest.rb: 82 | 83 | gem "minitest" 84 | require "minitest/autorun" 85 | 86 | .autotest: 87 | 88 | Autotest.add_hook :initialize do |at| 89 | at.testlib = ".minitest" 90 | end 91 | 92 | If you prefer to suffix test files with "_test.rb" (instead of the 93 | default which prefixes test files with "test_") you can change the 94 | mapping by installing the autotest-suffix plugin. To do this first 95 | install the autotest-suffix gem: 96 | 97 | $ gem install autotest-suffix 98 | 99 | Then add the following to the ".autotest" file: 100 | 101 | require "autotest/suffix" 102 | 103 | If you prefer minitest/spec to minitest/unit, you can still use autotest 104 | by installing the autotest-spec plugin. 105 | To do this first install the autotest-spec gem: 106 | 107 | $ gem install autotest-spec 108 | 109 | Then add the following to the ".autotest" file: 110 | 111 | require "autotest/spec" 112 | 113 | == SYNOPSIS 114 | 115 | ZenTest MyProject.rb TestMyProject.rb > missing.rb 116 | 117 | ./TestMyProject.rb | unit_diff 118 | 119 | autotest 120 | 121 | multiruby_setup mri:svn:current 122 | multiruby ./TestMyProject.rb 123 | 124 | == Windows and Color 125 | 126 | Read this: http://blog.mmediasys.com/2010/11/24/we-all-love-colors/ 127 | 128 | == REQUIREMENTS 129 | 130 | * Ruby 1.8+, JRuby 1.1.2+, or rubinius 131 | * A test/spec framework of your choice. 132 | * Hoe (development) 133 | * rubygems, 1.8+ 134 | * diff.exe on windows. Use http://gnuwin32.sourceforge.net/packages.html 135 | 136 | == INSTALL 137 | 138 | * sudo gem install ZenTest 139 | 140 | == LICENSE 141 | 142 | (The MIT License) 143 | 144 | Copyright (c) Ryan Davis, Eric Hodel, seattle.rb 145 | 146 | Permission is hereby granted, free of charge, to any person obtaining 147 | a copy of this software and associated documentation files (the 148 | "Software"), to deal in the Software without restriction, including 149 | without limitation the rights to use, copy, modify, merge, publish, 150 | distribute, sublicense, and/or sell copies of the Software, and to 151 | permit persons to whom the Software is furnished to do so, subject to 152 | the following conditions: 153 | 154 | The above copyright notice and this permission notice shall be 155 | included in all copies or substantial portions of the Software. 156 | 157 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 158 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 159 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 160 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 161 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 162 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 163 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 164 | 165 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # -*- ruby -*- 2 | 3 | $LOAD_PATH << 'lib' 4 | 5 | require 'rubygems' 6 | require 'hoe' 7 | 8 | Hoe.add_include_dirs("../../minitest/dev/lib") 9 | 10 | Hoe.plugin :seattlerb 11 | 12 | Hoe.spec "ZenTest" do 13 | developer 'Ryan Davis', 'ryand-ruby@zenspider.com' 14 | developer 'Eric Hodel', 'drbrain@segment7.net' 15 | 16 | license "MIT" 17 | end 18 | 19 | desc "run autotest on itself" 20 | task :autotest do 21 | ruby "-Ilib -w ./bin/autotest" 22 | end 23 | 24 | desc "update example_dot_autotest.rb with all possible constants" 25 | task :update do 26 | system "p4 edit example_dot_autotest.rb" 27 | File.open "example_dot_autotest.rb", "w" do |f| 28 | f.puts "# -*- ruby -*-" 29 | f.puts 30 | Dir.chdir "lib" do 31 | Dir["autotest/*.rb"].sort.each do |s| 32 | next if s =~ /rails|discover/ 33 | f.puts "# require '#{s[0..-4]}'" 34 | end 35 | end 36 | 37 | f.puts 38 | 39 | Dir["lib/autotest/*.rb"].sort.each do |file| 40 | file = File.read(file) 41 | m = file[/module.*/].split(/ /).last rescue nil 42 | next unless m 43 | 44 | file.grep(/def[^(]+=/).each do |setter| 45 | setter = setter.sub(/^ *def self\./, '').sub(/\s*=\s*/, ' = ') 46 | f.puts "# #{m}.#{setter}" 47 | end 48 | end 49 | end 50 | system "p4 diff -du example_dot_autotest.rb" 51 | end 52 | 53 | # vim:syntax=ruby 54 | 55 | -------------------------------------------------------------------------------- /articles/Article.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Basic styles for core document typography. 3 | * 4 | * Influenced by: 5 | * - "How to size text using ems" [http://www.clagnut.com/blog/348] 6 | */ 7 | 8 | /*************************** Basic Typography ******************************/ 9 | 10 | a:link { color: black; } /* unvisited link */ 11 | a:visited { color: black; } /* visited link */ 12 | a:hover { color: black; } /* mouse over link */ 13 | a:active { color: black; } /* selected link */ 14 | 15 | html { 16 | background: white; 17 | color: black; 18 | text-align: center; /* IE hack to workaround for block centering. */ 19 | margin: 0; 20 | padding: 0; 21 | } 22 | 23 | 24 | body { 25 | margin: 0; 26 | padding: 0; 27 | font-family: Lucida Grande, sans-serif; 28 | } 29 | 30 | * { 31 | font-family: Lucida Grande, sans-serif; 32 | } 33 | 34 | img { vertical-align: middle; } 35 | 36 | p, li, dt, dd { 37 | line-height: 1.5; 38 | font-size: .95em; 39 | } 40 | 41 | p, ul, ol, dl { 42 | margin-left: 3em; 43 | margin-right: 2em; 44 | } 45 | 46 | p + p { 47 | text-indent: 1.4em; 48 | } 49 | 50 | dl { 51 | margin: 1em 3em; 52 | } 53 | 54 | dl dt a { 55 | font: 1.5em bold Lucida Grande, sans-serif; 56 | } 57 | 58 | dl dt { 59 | font-weight: bold; 60 | } 61 | 62 | dl dd { 63 | margin: 0em 3em; 64 | } 65 | 66 | ul { 67 | list-style: square outside; 68 | } 69 | 70 | li p { /* Markdown define paragraphs for list items. */ 71 | margin: 0; 72 | } 73 | 74 | /* 75 | * Ensure that nested items have the same size as their parent as we are 76 | * using (relative) em sizing. 77 | */ 78 | li li, li p, td p, blockquote p { 79 | font-size: 1em; 80 | } 81 | 82 | abbr, acronym { 83 | letter-spacing:0.1em 84 | font-variant: small-caps; 85 | } 86 | 87 | em { 88 | font-style: italic; 89 | } 90 | 91 | term { 92 | font-style: italic; 93 | } 94 | 95 | cite { 96 | font-style: italic; 97 | } 98 | input, select, th, td {font-size:1em} 99 | 100 | /******************************* Headers ********************************/ 101 | 102 | h1 { 103 | text-align: center; 104 | padding: .3em 2em 0em 2em; 105 | margin: 0; 106 | color: black; 107 | font-size: 1.3em; 108 | } 109 | 110 | h2 { 111 | margin-left: 0.4em; 112 | font-weight: bold; 113 | font-size: 1.2em; 114 | border-bottom: medium #5089da solid; 115 | } 116 | 117 | h3 { 118 | font-size: 1.2em; 119 | margin-left: .5em; 120 | margin-right: auto; 121 | color: #929292; 122 | border-bottom: thin solid #929292; 123 | } 124 | 125 | /************************ Editing / Authoring ********************/ 126 | 127 | .todo { 128 | background: red; 129 | color: yellow; 130 | font-weight: bold; 131 | } 132 | 133 | /************************ Samples, Input, Code, Commands ********************/ 134 | 135 | code { 136 | font-family: monospace; 137 | } 138 | 139 | 140 | 141 | kbd:before { 142 | content: open-quote; 143 | } 144 | 145 | kbd:after { 146 | content: close-quote; 147 | } 148 | 149 | 150 | code, kbd, var, pre { 151 | font-family: monaco, "Courier New", courier, monospace; 152 | font-size: 14px; 153 | } 154 | 155 | .command-box { 156 | clear: right; /* Side notes. */ 157 | border: 1px dotted #888; 158 | background: #151515; 159 | color: #eee; 160 | margin: .5em 2em .5em 3em; 161 | padding: .5em; 162 | text-align: left; 163 | font-family: monospace; 164 | -moz-border-radius: .5em; 165 | -webkit-border-radius: .5em; 166 | border-radius: .5em; 167 | 168 | } 169 | 170 | span.placeholder { 171 | font-style: italic; 172 | } 173 | 174 | span.placeholder:before { 175 | content: "<"; 176 | } 177 | 178 | span.placeholder:after { 179 | content: ">"; 180 | } 181 | 182 | .command-box span.placeholder { 183 | font-style: normal; 184 | color: #cc2; 185 | } 186 | 187 | .source-code-box { 188 | border: 1px dotted #888; 189 | background: #151515; 190 | color: #eee; 191 | margin: .5em 2em .5em 3em; 192 | padding: .5em; 193 | text-align: left; 194 | font-family: monospace; 195 | -moz-border-radius: .5em; 196 | -webkit-border-radius: .5em; 197 | border-radius: .5em; 198 | } 199 | 200 | .output-box { 201 | border: 1px dotted #888; 202 | background: #151515; 203 | color: #eee; 204 | margin: .5em 2em .5em 3em; 205 | padding: .5em; 206 | text-align: left; 207 | font-family: monospace; 208 | } 209 | 210 | .sample-box { 211 | border: 1px dotted #444; 212 | margin: .5em 2em .5em 3em; 213 | padding: .5em; 214 | text-align: left; 215 | } 216 | 217 | /* 218 | * Global styles for PH Web 219 | */ 220 | 221 | /* 222 | * Banner and Main navigation menu 223 | */ 224 | 225 | div.banner { 226 | margin: 0; 227 | padding: 0; 228 | float: left; 229 | width: 100%; 230 | font-size: 110%; 231 | line-height: normal; 232 | background: #5089da url( Main-Menu-Background-2.jpg ) repeat-y bottom left; 233 | border-bottom: thin #666 solid; 234 | } 235 | 236 | div.banner div.signature span.by { 237 | font: italic .7em Didot, serif; 238 | padding-right: .6em; 239 | text-shadow: .2em .2em .2em #222; 240 | } 241 | 242 | div.banner div.signature { 243 | float: right; 244 | color: gainsboro; 245 | font: 1.1em Didot, serif; 246 | margin: 0; 247 | padding: 60px .1em 0 0; 248 | vertical-align: baseline; 249 | } 250 | 251 | img#banner-logo { 252 | float: left; 253 | margin: .3em 6em .1em 1em; 254 | border: 0; 255 | } 256 | 257 | 258 | div.banner a#feed_link img { 259 | vertical-align: middle; 260 | border: 0; 261 | float: right; 262 | margin: .5em 1em; 263 | } 264 | 265 | div.banner a#contact_me_link img { 266 | vertical-align: middle; 267 | border: 0; 268 | float: right; 269 | margin: .5em 1em; 270 | } 271 | 272 | ul.section-menu { 273 | float: left; 274 | margin: 0 auto; 275 | padding: 0; 276 | width: 40em; 277 | list-style: none; 278 | } 279 | 280 | ul.section-menu li { 281 | display:block; 282 | float: left; 283 | margin: .8em 1px .5em 1px; 284 | padding: 1em 0; 285 | background: transparent url( 'Button Gradient.png' ) repeat-x center; 286 | text-shadow: .1em .1em .2em #444; 287 | } 288 | 289 | 290 | ul.section-menu li a:visited { 291 | color: gainsboro; 292 | } 293 | 294 | ul.section-menu li a { 295 | padding: 0 1em; 296 | margin: 0; 297 | font: bold .9em Lucida Grande, sans-serif; 298 | text-decoration: none; 299 | color: gainsboro; 300 | } 301 | 302 | ul.section-menu li.first a { 303 | padding-left: .6em; 304 | } 305 | 306 | ul.section-menu li.last a { 307 | padding-left: .6em; 308 | } 309 | 310 | ul.section-menu li a:hover { 311 | color: white; 312 | } 313 | 314 | ul.section-menu li#current a { 315 | color: #ff8; 316 | } 317 | 318 | div.content { 319 | float: left; 320 | background: url(Shore.jpg) no-repeat left top; 321 | width: 100%; 322 | padding: 0; 323 | padding-top: 1.3em; 324 | padding-bottom: 1.3em; 325 | text-align: left; 326 | clear: both; 327 | margin: 0; 328 | } 329 | 330 | 331 | p.Cartouche { 332 | float: right; 333 | width: 15em; 334 | margin: 0 2em 2em 3em; 335 | background: #5089da; 336 | padding: 1em; 337 | text-align: center; 338 | color: white; 339 | font-weight: bold; 340 | border: 0; 341 | text-indent: 0; 342 | 343 | -moz-border-radius: .5em; 344 | -webkit-border-radius: .5em; 345 | border-radius: .5em; 346 | -webkit-box-shadow: 4px 4px 4px rgba(0, 0, 0, 0.5) 347 | } 348 | 349 | p.Cartouche a img { 350 | border: 0; 351 | } 352 | 353 | .Copyright { 354 | clear: both; 355 | text-align: center; 356 | font: italic 1em Lucida Grande, sans-serif; 357 | color: #444; 358 | margin-bottom: .2em; 359 | } 360 | 361 | .License { 362 | margin-top: 0; 363 | font: italic 1em Lucida Grande, sans-serif; 364 | color: #444; 365 | } 366 | 367 | a.discussion_link { 368 | text-decoration: none; 369 | } 370 | 371 | a.comment_counter { 372 | color: #5089da; 373 | padding: 0 1.5em; 374 | } 375 | 376 | h2.document_reference a { 377 | text-decoration: none; 378 | } 379 | 380 | span.tag_list { 381 | padding-left: 4em; 382 | font-weight: normal; 383 | } 384 | 385 | span.tag_list img { 386 | vertical-align: middle; 387 | } 388 | 389 | span.tag_list:before { 390 | content: '['; 391 | } 392 | 393 | span.tag_list:after { 394 | content: ']'; 395 | } 396 | 397 | p.read_more, p.read_more a { 398 | font-variant : small-caps; 399 | font-weight: bold; 400 | color: #5089da; 401 | } 402 | 403 | h2 span.post_date { 404 | padding-right: 1em; 405 | color: #5089da; 406 | } 407 | 408 | div#contact_form { 409 | margin: 2em; 410 | } 411 | 412 | div#contact_form label { 413 | margin-bottom: 100px; 414 | padding: 5em 1em 5em 0; 415 | } 416 | 417 | div#contact_form textarea { 418 | margin-top: 1.5em; 419 | width: 50em; 420 | } 421 | 422 | div.errorExplanation { 423 | background: #fbb; 424 | color: red; 425 | padding: 1em; 426 | margin: 1em; 427 | -moz-border-radius: 1em; 428 | -webkit-border-radius: 1em; 429 | border-radius: 1em; 430 | } 431 | 432 | div.errorExplanation h2 { 433 | font-size: 1em; 434 | border: 0; 435 | color: red; 436 | } 437 | 438 | /* 439 | * Round box 440 | */ 441 | table.box { 442 | table-layout: fixed; 443 | border-spacing: 0; 444 | border: none; 445 | } 446 | 447 | table.box tr, table.box tr td { 448 | padding: 0; 449 | margin: 0; 450 | border: none; 451 | } 452 | 453 | table.box tr.top, table.box tr.bottom { 454 | height: 30px; 455 | } 456 | 457 | table.box tr.bottom td { /* Fix for Safari who does not pick up height from the
\n"
308 | @rentals.each do
309 | |each|
310 | result += "#{each.aMovie.title}: #{each.getCharge}
\n"
311 | end
312 | result += "You owe #{getTotalCharge}
\n" 313 | result += 314 | "On this rental you earned #{getFrequentRenterPoints}" + 315 | " frequent renter points
"
316 | end
317 |
318 | def getTotalCharge
319 | result = 0.0
320 | @rentals.each do
321 | |each|
322 | result += each.getCharge()
323 | end
324 | result
325 | end
326 |
327 | def getFrequentRenterPoints
328 | result = 0
329 | @rentals.each do
330 | |each|
331 | result += each.getFrequentRenterPoints
332 | end
333 | result
334 | end
335 | end
336 |
337 | There's a lot of new stuff in here. If we run ZenTest again, it'll
338 | pick up the methods we don't have any coverage on (we should have
339 | written them as we wrote the new methods, but this is a bit more
340 | illustrative). This time, we'll invoke ZenTest a little bit
341 | differently:
342 |
343 | $ zentest videostore.rb testVideoStore.rb > Missing_tests
344 |
345 | and our (trimmed) output looks like this:
346 |
347 | # Code Generated by ZenTest v. 2.1.2
348 | # classname: asrt / meth = ratio%
349 | # Customer: 4 / 6 = 66.67%
350 |
351 |
352 | require 'test/unit'
353 |
354 | class TestCustomer < Test::Unit::TestCase
355 | def test_getFrequentRenterPoints
356 | raise NotImplementedError,
357 | 'Need to write test_getFrequentRenterPoints'
358 | end
359 |
360 | def test_getTotalCharge
361 | raise NotImplementedError, 'Need to write test_getTotalCharge'
362 | end
363 |
364 | def test_htmlStatement
365 | raise NotImplementedError, 'Need to write test_htmlStatement'
366 | end
367 | end
368 |
369 | Hmmm, three more test methods to fill in to get our complete
370 | coverage. As we write these, we can just migrate them into our
371 | existing testVideoStore.rb test suite. Then we can keep moving ahead
372 | with refactoring and adding new features. In the future, let's just
373 | be sure we add tests as we go along. ZenTest can help you here too.
374 | You can write stubs for new development, then run ZenTest to create
375 | your new test stubs as well. After some refactorings (like 'extract
376 | method'), ZenTest can be used the same way.
377 |
378 | Refactoring and unit testing are powerful tools for programmers, and
379 | ZenTest provides an easy way to start using them in a Ruby
380 | environment. Hopefully, this introduction has whetted your appetite.
381 |
382 | If you're interested in learning more about refactoring, please grab a
383 | copy of 'Refactoring: Improving the Design of Existing Code' and take
384 | a look at www.refactoring.com. For more information about unit
385 | testing, please see: c2.com/cgi/wiki?UnitTest,
386 | www.junit.org/index.htm, and
387 | www.extremeprogramming.org/rules/unittests.html.
388 |
389 | The latest information about Test::Unit and ZenTest are available at
390 | their home pages: testunit.talbott.ws (for Test::Unit) and
391 | www.zenspider.com/ZSS/Products/ZenTest.
392 |
393 |
394 |
--------------------------------------------------------------------------------
/bin/multigem:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby -w
2 |
3 | multiruby = File.expand_path "../multiruby", __FILE__
4 |
5 | exec multiruby, "-S", "gem", *ARGV
6 |
--------------------------------------------------------------------------------
/bin/multiruby:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby -w
2 |
3 | require "yaml"
4 |
5 | class Array
6 | def human_sort
7 | sort_by { |item| item.to_s.split(/(\d+)/).map { |e| [e.to_i, e] } }
8 | end
9 | end
10 |
11 | root_dir = File.expand_path "~/.rubies"
12 |
13 | versions = Dir.chdir(root_dir) { Dir["*"] }.human_sort
14 |
15 | def setenv dir
16 | ENV["PATH"] = "#{dir}/bin:#{ENV["PATH"]}"
17 | end
18 |
19 | def unsetenv key
20 | if ENV[key] then
21 | warn "WARNING: %s is set to %p. Removing..." % [key, ENV[key]]
22 | ENV.delete key
23 | end
24 | end
25 |
26 | unsetenv "GEM_HOME"
27 | unsetenv "GEM_PATH"
28 |
29 | ##
30 | # multiruby -1 2.0 ruby_args...
31 |
32 | if ARGV.first == "-1" then
33 | ARGV.shift
34 | vers = Dir["#{root_dir}/#{ARGV.shift}*"]
35 |
36 | abort "ambiguous version: #{vers.map { |p| File.basename p }.inspect}" if
37 | vers.size != 1
38 |
39 | dir = vers.first
40 | setenv dir
41 |
42 | exec "#{dir}/bin/ruby", *ARGV
43 | end
44 |
45 | def maybe_load_yaml_file config
46 | if config then
47 | if YAML.respond_to? :safe_load_file then
48 | YAML.safe_load_file config, permitted_classes: [Regexp, Symbol]
49 | else
50 | YAML.load_file config
51 | end
52 | end
53 | end
54 |
55 | rcpath = File.expand_path "~/.hoerc"
56 | skip = if File.exist? rcpath then
57 | conf = maybe_load_yaml_file rcpath
58 | conf["multiruby_skip"] || []
59 | end
60 | excl = (ENV["EXCLUDED_VERSIONS"] || "").split(/:/) + skip
61 | unless excl.empty? then
62 | excludes = Regexp.union(*excl)
63 | versions = versions.delete_if { |v| v =~ excludes }
64 | end
65 |
66 | # safekeep original PATH
67 | original_path = ENV['PATH']
68 |
69 | results = {}
70 | versions.each do |version|
71 | dir = "#{root_dir}/#{version}"
72 | ruby = "#{dir}/bin/ruby"
73 | ver = version.delete_prefix "ruby-"
74 |
75 | puts
76 | puts "VERSION = #{ver}"
77 | cmd = [ruby, ARGV].flatten.map { |s| s =~ /\"/ ? "'#{s}'" : s }.join(' ')
78 | cmd.sub!(/#{ENV['HOME']}/, '~')
79 | puts "CMD = #{cmd}"
80 | puts
81 |
82 | setenv dir
83 |
84 | system ruby, *ARGV
85 | puts
86 | puts "RESULT = #{$?}"
87 | results[ver] = $?
88 |
89 | # restore the path to original state
90 | ENV['PATH'] = original_path
91 | end
92 |
93 | passed, failed = results.keys.partition { |v| results[v] == 0 }
94 |
95 | puts
96 | puts "TOTAL RESULT = #{failed.size} failures out of #{results.size}"
97 | puts
98 | puts "Passed: #{passed.join(", ")}"
99 | puts "Failed: #{failed.join(", ")}"
100 |
101 | exit failed.size
102 |
--------------------------------------------------------------------------------
/bin/unit_diff:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby -ws
2 | #
3 | # unit_diff - a ruby unit test filter by Ryan Davis