turn 0.6.3 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
data/.meta/version CHANGED
@@ -1 +1 @@
1
- 0.6.3
1
+ 0.7.0
data/History.txt CHANGED
@@ -1,3 +1,9 @@
1
+ == 0.7.0 / 2009-10-13
2
+ * Fix typo and potential bug.
3
+ * Running ruby with /usr/bin/env for portability
4
+ * Adding --name=PATTERN for test name filtering
5
+ * ANSI class is all caps
6
+
1
7
  == 0.6.3 / 2009-10-12
2
8
  * Fixing require statements
3
9
 
data/bin/turn CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/ruby
1
+ #!/usr/bin/env ruby
2
2
 
3
3
  load 'turn/command.rb'
4
4
 
data/lib/turn/command.rb CHANGED
@@ -7,6 +7,7 @@
7
7
  # -h --help display this help information
8
8
  # --live don't use loadpath
9
9
  # --log log results to a file
10
+ # -n --name=PATTERN only run tests that match regexp PATTERN
10
11
  # -I --loadpath=PATHS add given paths to the $LOAD_PATH
11
12
  # -r --requires=PATHS require given paths before running tests
12
13
  #
@@ -32,6 +33,7 @@ opts = GetoptLong.new(
32
33
  [ '--help', '-h', GetoptLong::NO_ARGUMENT ],
33
34
  [ '--live', GetoptLong::NO_ARGUMENT ],
34
35
  [ '--log', GetoptLong::OPTIONAL_ARGUMENT ],
36
+ [ '--name', '-n', GetoptLong::REQUIRED_ARGUMENT ],
35
37
  [ '--loadpath', '-I', GetoptLong::REQUIRED_ARGUMENT ],
36
38
  [ '--requires', '-r', GetoptLong::REQUIRED_ARGUMENT ],
37
39
 
@@ -50,6 +52,7 @@ opts = GetoptLong.new(
50
52
 
51
53
  live = nil
52
54
  log = nil
55
+ pattern = nil
53
56
  loadpath = []
54
57
  requires = []
55
58
 
@@ -67,6 +70,8 @@ opts.each do |opt, arg|
67
70
  live = true
68
71
  when '--log'
69
72
  log = true
73
+ when '--name'
74
+ pattern = Regexp.new(arg, Regexp::IGNORECASE)
70
75
  when '--loadpath'
71
76
  loadpath << arg
72
77
  when '--requires'
@@ -126,6 +131,7 @@ controller = Turn::Controller.new do |c|
126
131
  c.tests = tests
127
132
  c.runner = runner
128
133
  c.reporter = reporter
134
+ c.pattern = pattern
129
135
  end
130
136
 
131
137
  controller.start
@@ -28,6 +28,10 @@ module Turn
28
28
  # Files globs to specially exclude.
29
29
  attr_accessor :exclude
30
30
 
31
+ # Regexp pattern that all test name's must
32
+ # match to be eligible to run.
33
+ attr_accessor :pattern
34
+
31
35
  # Add these folders to the $LOAD_PATH.
32
36
  attr_accessor :loadpath
33
37
 
@@ -64,11 +68,12 @@ module Turn
64
68
  @loadpath ||= ['lib']
65
69
  @tests ||= "test/**/{test,}*{,test}"
66
70
  @exclude ||= []
67
- @reqiures ||= []
71
+ @requires ||= []
68
72
  @live ||= false
69
73
  @log ||= true
70
74
  @reporter ||= OutlineReporter.new($stdout)
71
75
  @runner ||= TestRunner.new
76
+ @pattern ||= /.*/
72
77
  end
73
78
 
74
79
  # Collect test configuation.
@@ -109,8 +114,8 @@ module Turn
109
114
  @exclude = list_option(paths)
110
115
  end
111
116
 
112
- def requries=(paths)
113
- @requries = list_option(paths)
117
+ def requires=(paths)
118
+ @requires = list_option(paths)
114
119
  end
115
120
 
116
121
  def files
@@ -8,7 +8,7 @@ module Turn
8
8
  class ProgressReporter < Reporter
9
9
 
10
10
  def start_suite(suite)
11
- @pbar = ::Ansi::Progressbar.new('Testing', suite.size)
11
+ @pbar = ::ANSI::Progressbar.new('Testing', suite.size)
12
12
  @pbar.inc
13
13
  end
14
14
 
@@ -34,6 +34,11 @@ module Turn
34
34
  suite = Test::Unit::TestSuite.new('') # FIXME: Name?
35
35
  sub_suites.sort_by{|s|s.name}.each{|s| suite << s}
36
36
 
37
+ suite.tests.each do |c|
38
+ pattern = controller.pattern
39
+ c.tests.reject! { |t| pattern !~ t.method_name }
40
+ end
41
+
37
42
  @t_reporter = controller.reporter
38
43
 
39
44
  super(suite, output_level, $stdout)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: turn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.3
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Pease
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-12 00:00:00 -07:00
12
+ date: 2009-11-13 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -40,7 +40,7 @@ dependencies:
40
40
  requirements:
41
41
  - - ">="
42
42
  - !ruby/object:Gem::Version
43
- version: 1.0.0
43
+ version: 1.1.0
44
44
  version:
45
45
  - !ruby/object:Gem::Dependency
46
46
  name: bones