Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 13
- Log:
Initial import of Typo 2.6.0 sources from a downloaded Tarball.
Typo is a Ruby On Rails based blog engine.
- Author:
- adh
- Date:
- Sat Jul 22 22:25:02 +0100 2006
- Size:
- 2517 Bytes
- Properties:
- Property svn:executable is set
1 | #!/usr/bin/ruby |
2 | # |
3 | # Test suite for BlueCloth classes |
4 | # $Id$ |
5 | # |
6 | |
7 | BEGIN { |
8 | $basedir = File::dirname( __FILE__ ) |
9 | ["lib", "tests", "redist"].each do |subdir| |
10 | $LOAD_PATH.unshift File::join( $basedir, subdir ) |
11 | end |
12 | |
13 | require "#{$basedir}/utils" |
14 | include UtilityFunctions |
15 | } |
16 | |
17 | verboseOff { |
18 | require 'bctestcase' |
19 | require 'find' |
20 | require 'test/unit' |
21 | require 'test/unit/testsuite' |
22 | require 'test/unit/ui/console/testrunner' |
23 | require 'optparse' |
24 | } |
25 | |
26 | # Turn off output buffering |
27 | $stderr.sync = $stdout.sync = true |
28 | $DebugPattern = nil |
29 | |
30 | # Initialize variables |
31 | safelevel = 0 |
32 | patterns = [] |
33 | requires = [] |
34 | |
35 | # Parse command-line switches |
36 | ARGV.options {|oparser| |
37 | oparser.banner = "Usage: #$0 [options] [TARGETS]\n" |
38 | |
39 | oparser.on( "--debug[=PATTERN]", "-d[=PATTERN]", String, |
40 | "Turn debugging on (for tests which match PATTERN)" ) {|arg| |
41 | if arg |
42 | $DebugPattern = Regexp::new( arg ) |
43 | puts "Turned debugging on for %p." % $DebugPattern |
44 | else |
45 | $DEBUG = true |
46 | debugMsg "Turned debugging on globally." |
47 | end |
48 | } |
49 | |
50 | oparser.on( "--verbose", "-v", TrueClass, "Make progress verbose" ) { |
51 | $VERBOSE = true |
52 | debugMsg "Turned verbose on." |
53 | } |
54 | |
55 | # Handle the 'help' option |
56 | oparser.on( "--help", "-h", "Display this text." ) { |
57 | $stderr.puts oparser |
58 | exit!(0) |
59 | } |
60 | |
61 | oparser.parse! |
62 | } |
63 | |
64 | # Parse test patterns |
65 | ARGV.each {|pat| patterns << Regexp::new( pat, Regexp::IGNORECASE )} |
66 | $stderr.puts "#{patterns.length} patterns given on the command line" |
67 | |
68 | ### Load all the tests from the tests dir |
69 | Find.find("#{$basedir}/tests") {|file| |
70 | Find.prune if /\/\./ =~ file or /~$/ =~ file |
71 | Find.prune if /TEMPLATE/ =~ file |
72 | next if File.stat( file ).directory? |
73 | |
74 | unless patterns.empty? |
75 | Find.prune unless patterns.find {|pat| pat =~ file} |
76 | end |
77 | |
78 | debugMsg "Considering '%s': " % file |
79 | next unless file =~ /\.tests.rb$/ |
80 | debugMsg "Requiring '%s'..." % file |
81 | require "#{file}" |
82 | requires << file |
83 | } |
84 | |
85 | $stderr.puts "Required #{requires.length} files." |
86 | unless patterns.empty? |
87 | $stderr.puts "[" + requires.sort.join( ", " ) + "]" |
88 | end |
89 | |
90 | # Build the test suite |
91 | class BlueClothTests |
92 | class << self |
93 | def suite |
94 | suite = Test::Unit::TestSuite.new( "BlueCloth" ) |
95 | |
96 | if suite.respond_to?( :add ) |
97 | ObjectSpace.each_object( Class ) {|klass| |
98 | suite.add( klass.suite ) if klass < BlueCloth::TestCase |
99 | } |
100 | else |
101 | ObjectSpace.each_object( Class ) {|klass| |
102 | suite << klass.suite if klass < BlueCloth::TestCase |
103 | } |
104 | end |
105 | |
106 | return suite |
107 | end |
108 | end |
109 | end |
110 | |
111 | # Run tests |
112 | $SAFE = safelevel |
113 | Test::Unit::UI::Console::TestRunner.new( BlueClothTests ).start |
114 | |
115 | |
116 | |
117 |