turn 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,7 @@
1
+ == 0.9.1 / 2012-02-01
2
+ * MiniTest Only
3
+ * Fix issues with 1.8.7 support.
4
+
1
5
  == 0.9.0 / 2012-01-30
2
6
  * Fix bundle exec issue, which means...
3
7
  * Developer's must require `turn/autorun` instead fo just `turn`.
@@ -1 +1 @@
1
- 0.9.0
1
+ 0.9.1
@@ -1,9 +1,4 @@
1
- #
2
1
  module Turn
3
- # Are we using Test::Unit (1.x)?
4
- def self.testunit?
5
- defined?(Test::Unit) && !defined?(MiniTest)
6
- end
7
2
  end
8
3
 
9
4
  require 'fileutils'
@@ -14,15 +9,5 @@ require 'turn/configuration'
14
9
  require 'turn/colorize'
15
10
  require 'turn/components'
16
11
  require 'turn/controller'
17
-
18
- if Turn.testunit?
19
- require 'turn/testunit'
20
- else
21
- require 'turn/minitest'
22
- end
23
-
24
- #if ENV['autorun']
25
- # warn "Use `require 'turn/autorun'` instead of `require 'turn'` for future versions."
26
- # MiniTest::Unit.autorun
27
- #end
12
+ require 'turn/minitest'
28
13
 
@@ -1,6 +1,6 @@
1
1
  # This is a "dirty trick" to load `test/unit` or `minitest/unit` if sought.
2
2
  # Eventually a way to handle this more robustly (without autoreload)
3
3
  # should be worked out. But how?
4
- autoload "Test", 'test/unit'
5
- autoload "MiniTest", 'minitest/unit'
4
+ #autoload "Test", 'test/unit'
5
+ #autoload "MiniTest", 'minitest/unit'
6
6
 
@@ -1,8 +1,4 @@
1
1
  require 'turn'
2
2
 
3
- if Turn.testunit?
4
- Test::Unit.run = true
5
- else
6
- MiniTest::Unit.autorun
7
- end
3
+ MiniTest::Unit.autorun
8
4
 
@@ -16,7 +16,6 @@ module Turn
16
16
  # -c --case=PATTERN only run testcases that match regexp PATTERN
17
17
  # -I --loadpath=PATHS add given PATHS to the $LOAD_PATH
18
18
  # -r --requires=LIBS require given LIBS before running tests
19
- # -m --minitest Force use of MiniTest framework.
20
19
  # -b --backtrace=INT Set the number of lines to show in backtrace.
21
20
  #
22
21
  # RUN MODES
@@ -85,7 +84,6 @@ module Turn
85
84
  @requires = []
86
85
  @runmode = nil
87
86
  @outmode = nil
88
- #@framework = RUBY_VERSION >= "1.9" ? :minitest : :testunit
89
87
  @trace = nil
90
88
  @natural = false
91
89
  @ansi = nil
@@ -128,10 +126,6 @@ module Turn
128
126
  end
129
127
  end
130
128
 
131
- #opts.on('-m', '--minitest', "Force use of MiniTest framework") do
132
- # @framework = :minitest
133
- #end
134
-
135
129
  opts.on('-b', '--backtrace', '--trace INT', "Limit the number of lines of backtrace.") do |int|
136
130
  @trace = int
137
131
  end
@@ -242,7 +236,6 @@ module Turn
242
236
  c.format = outmode
243
237
  c.pattern = pattern
244
238
  c.matchcase = matchcase
245
- #c.framework = framework
246
239
  c.trace = trace
247
240
  c.natural = natural
248
241
  c.ansi = ansi unless ansi.nil?
@@ -35,20 +35,11 @@ module Turn
35
35
  # Insatance of Runner, selected based on format and runmode.
36
36
  def runner
37
37
  @runner ||= (
38
- #case config.framework
39
- #when :minitest
40
- require 'turn/runners/minirunner'
41
- #else
42
- # require 'turn/runners/testrunner'
43
- #end
38
+ require 'turn/runners/minirunner'
44
39
 
45
40
  case config.runmode
46
41
  when :marshal
47
- #if config.framework == :minitest
48
- Turn::MiniRunner
49
- #else
50
- # Turn::TestRunner
51
- #end
42
+ Turn::MiniRunner
52
43
  when :solo
53
44
  require 'turn/runners/solorunner'
54
45
  Turn::SoloRunner
@@ -56,11 +47,7 @@ module Turn
56
47
  require 'turn/runners/crossrunner'
57
48
  Turn::CrossRunner
58
49
  else
59
- #if config.framework == :minitest
60
- Turn::MiniRunner
61
- #else
62
- # Turn::TestRunner
63
- #end
50
+ Turn::MiniRunner
64
51
  end
65
52
  )
66
53
  end
@@ -1,5 +1,3 @@
1
- #require 'turn'
2
-
3
1
  # make sure latest verison is used, rather than ruby's built-in
4
2
  begin; gem 'minitest'; rescue Exception; end
5
3
 
@@ -7,6 +5,9 @@ begin; gem 'minitest'; rescue Exception; end
7
5
  require 'minitest/unit'
8
6
  require 'minitest/spec'
9
7
 
8
+ # compatability with old Test::Unit
9
+ Test = MiniTest unless defined?(Test)
10
+
10
11
  # load Turn's minitest runner
11
12
  require 'turn/runners/minirunner'
12
13
 
@@ -41,7 +41,8 @@ module Turn
41
41
  # Override #_run_suite to setup Turn.
42
42
  def _run_suites suites, type
43
43
  # Someone want to explain to me why these are fucking here?
44
- suites = suites - [MiniTest::Spec, Test::Unit::TestCase]
44
+ suites = suites - [MiniTest::Spec]
45
+ suites = suites - [Test::Unit::TestCase] if defined?(Test::Unit::TestCase)
45
46
 
46
47
  @turn_suite = Turn::TestSuite.new(@turn_config.suite_name)
47
48
  @turn_suite.size = suites.size #::MiniTest::Unit::TestCase.test_suites.size
@@ -1,5 +1,24 @@
1
- require 'turn/runners/testrunner'
1
+ module Turn
2
2
 
3
- # need to turn this off unless autorun mode
4
- Test::Unit.run = false
3
+ # For TestUnit 1.x, completely outdated.
4
+ def self.bootstrap_legacy(autorun=false)
5
+ require 'fileutils'
6
+
7
+ require 'turn/version'
8
+ require 'turn/autoload'
9
+ require 'turn/configuration'
10
+ require 'turn/colorize'
11
+ require 'turn/components'
12
+ require 'turn/controller'
13
+
14
+ require 'test/unit'
15
+ require 'turn/runners/testrunner'
16
+
17
+ # need to turn this off unless autorun mode
18
+ Test::Unit.run = autorun
19
+ end
20
+
21
+ end
22
+
23
+ Turn.bootstrap_legacy(true)
5
24
 
@@ -17,14 +17,23 @@ require 'turn'
17
17
 
18
18
  #
19
19
  def turn(*args)
20
- `ruby -Ilib bin/turn -Ilib #{args.join(' ')} 2>&1`
20
+ if RUBY_VERSION < '1.9'
21
+ `ruby1.8 -Ilib bin/turn -Ilib #{args.join(' ')} 2>&1`
22
+ else
23
+ `ruby -Ilib bin/turn -Ilib #{args.join(' ')} 2>&1`
24
+ end
21
25
  end
22
26
 
23
27
  #
24
28
  def turn2(*args)
25
- `ruby -Ilib bin/turn -Ilib #{args.join(' ')}`
29
+ if RUBY_VERSION < '1.9'
30
+ `ruby1.8 -Ilib bin/turn -Ilib #{args.join(' ')}`
31
+ else
32
+ `ruby -Ilib bin/turn -Ilib #{args.join(' ')}`
33
+ end
26
34
  end
27
35
 
36
+ #
28
37
  def turn_with_term(term, *args)
29
38
  `TERM="#{term}" ruby -Ilib bin/turn -Ilib #{args.join(' ')} 2>&1`
30
39
  end
@@ -43,6 +52,20 @@ end
43
52
  save_test(text, name)
44
53
  end
45
54
 
55
+ #
56
+ def setup_testunit(required=false, name=nil)
57
+ text = ''
58
+ text << "require '#{required}'\n" if required
59
+ text << <<-HERE
60
+ class TestTest < Test::Unit::TestCase
61
+ #{standard_test_body}
62
+ end
63
+ HERE
64
+ #name = framwwork.downcase
65
+ #name = name + '_required' if requires
66
+ save_test(text, name)
67
+ end
68
+
46
69
  #
47
70
  def save_test(text, name=nil)
48
71
  file = File.join('tmp', name || 'test.rb')
@@ -78,7 +101,7 @@ HERE
78
101
  end
79
102
 
80
103
  #
81
- def setup_outline_test
104
+ def setup_testunit_outline
82
105
  text = <<-HERE
83
106
  class OutlineTest < Test::Unit::TestCase
84
107
  def test_sample_pass
@@ -12,34 +12,41 @@ if RUBY_VERSION >= '1.9'
12
12
  end
13
13
 
14
14
  def test_ruby19_minitest_color
15
- term, stdout = ENV['TERM'], $stdout
16
- host_os, ansicon, = ::RbConfig::CONFIG['host_os'], ENV['ANSICON']
17
- $stdout = $stdout.dup
18
- def $stdout.tty?
19
- true
20
- end
21
- ENV['ANSICON'] = nil
22
- ENV['TERM'] = 'xterm'
23
- assert_equal true, Turn::Colorize.color_supported?
24
- ENV['TERM'] = 'dumb'
25
- assert_equal false, Turn::Colorize.color_supported?
26
- ENV['TERM'] = nil
27
- assert_equal false, Turn::Colorize.color_supported?
28
- ['mingw32', 'mswin32'].each do |os|
29
- ::RbConfig::CONFIG['host_os'] = os
30
- ENV['ANSICON'] = '120x5000 (120x50)'
31
- assert_equal true, Turn::Colorize.color_supported?
15
+ unless defined?(ANSI)
16
+ assert true # skip ?
17
+ return
18
+ end
19
+
20
+ begin
21
+ term, stdout = ENV['TERM'], $stdout
22
+ host_os, ansicon, = ::RbConfig::CONFIG['host_os'], ENV['ANSICON']
23
+ $stdout = $stdout.dup
24
+ def $stdout.tty?
25
+ true
26
+ end
32
27
  ENV['ANSICON'] = nil
28
+ ENV['TERM'] = 'xterm'
29
+ assert_equal true, Turn::Colorize.color_supported?
30
+ ENV['TERM'] = 'dumb'
33
31
  assert_equal false, Turn::Colorize.color_supported?
32
+ ENV['TERM'] = nil
33
+ assert_equal false, Turn::Colorize.color_supported?
34
+ ['mingw32', 'mswin32'].each do |os|
35
+ ::RbConfig::CONFIG['host_os'] = os
36
+ ENV['ANSICON'] = '120x5000 (120x50)'
37
+ assert_equal true, Turn::Colorize.color_supported?
38
+ ENV['ANSICON'] = nil
39
+ assert_equal false, Turn::Colorize.color_supported?
40
+ end
41
+ ENV['TERM'] = 'xterm'
42
+ def $stdout.tty?
43
+ false
44
+ end
45
+ assert_equal false, Turn::Colorize.color_supported?
46
+ ensure
47
+ ENV['TERM'], $stdout = term, stdout
48
+ ::RbConfig::CONFIG['host_os'], ENV['ANSICON'] = host_os, ansicon
34
49
  end
35
- ENV['TERM'] = 'xterm'
36
- def $stdout.tty?
37
- false
38
- end
39
- assert_equal false, Turn::Colorize.color_supported?
40
- ensure
41
- ENV['TERM'], $stdout = term, stdout
42
- ::RbConfig::CONFIG['host_os'], ENV['ANSICON'] = host_os, ansicon
43
50
  end
44
51
 
45
52
  #def test_ruby19_minitest_force
@@ -61,7 +68,7 @@ if RUBY_VERSION >= '1.9'
61
68
  #end
62
69
 
63
70
  def test_ruby19_minitest_mocking
64
- setup_test('Test')
71
+ setup_testunit
65
72
  result = turn 'tmp/test.rb'
66
73
  assert result.index('PASS')
67
74
  end
@@ -86,7 +93,7 @@ if RUBY_VERSION >= '1.9'
86
93
 
87
94
  #
88
95
  def test_ruby19_testunit_required
89
- setup_test('Test', 'test/unit')
96
+ setup_testunit
90
97
  result = turn 'turn tmp/test.rb'
91
98
  assert result.index('PASS')
92
99
  end
@@ -112,27 +119,27 @@ else
112
119
  class TestRuby18Framework < Test::Unit::TestCase
113
120
 
114
121
  def test_ruby18_testunit
115
- setup_test('Test')
122
+ setup_testunit
116
123
  result = turn 'tmp/test.rb'
117
- assert result.index('PASS')
124
+ assert result.index('PASS'), "ACTUAL RESULT:\n#{result}"
118
125
  end
119
126
 
120
127
  def test_ruby18_testunit_required
121
- setup_test('Test', 'test/unit')
128
+ setup_testunit
122
129
  result = turn 'tmp/test.rb'
123
- assert result.index('PASS')
130
+ assert result.index('PASS'), "ACTUAL RESULT:\n#{result}"
124
131
  end
125
132
 
126
133
  def test_ruby18_minitest
127
134
  setup_test('MiniTest')
128
- result = turn '--minitest tmp/test.rb'
129
- assert result.index('PASS')
135
+ result = turn 'tmp/test.rb'
136
+ assert result.index('PASS'), "ACTUAL RESULT:\n#{result}"
130
137
  end
131
138
 
132
139
  def test_ruby18_minitest_mocking_testunit
133
140
  setup_test('Test')
134
- result = turn '--minitest tmp/test.rb'
135
- assert result.index('PASS')
141
+ result = turn 'tmp/test.rb'
142
+ assert result.index('PASS'), "ACTUAL RESULT:\n#{result}"
136
143
  end
137
144
 
138
145
  # You can't use minitest and have ++require 'test/unit'++ in your tests.
@@ -152,8 +159,8 @@ else
152
159
 
153
160
  def test_ruby18_minitest_required_force
154
161
  setup_test('MiniTest', 'minitest/unit')
155
- result = turn '--minitest tmp/test.rb'
156
- assert result.index('PASS')
162
+ result = turn 'tmp/test.rb'
163
+ assert result.index('PASS'), "ACTUAL RESULT:\n#{result}"
157
164
  end
158
165
 
159
166
  end
@@ -5,7 +5,7 @@ class TestReporters < Test::Unit::TestCase
5
5
  begin
6
6
  require 'ansi'
7
7
  def test_progress
8
- file = setup_test('Test')
8
+ file = setup_testunit
9
9
  result = turn '--progress', file
10
10
  assert(result.index('PASS'), result)
11
11
  end
@@ -13,31 +13,31 @@ class TestReporters < Test::Unit::TestCase
13
13
  end
14
14
 
15
15
  def test_dotted
16
- file = setup_test('Test')
16
+ file = setup_testunit
17
17
  result = turn '--dotted', file
18
- assert result.index('0 failures')
19
- assert result.index('0 errors')
18
+ assert result.index('0 failures'), "ACTUAL RESULT:\n#{result}"
19
+ assert result.index('0 errors'), "ACTUAL RESULT:\n#{result}"
20
20
  end
21
21
 
22
22
  def test_marshal
23
- file = setup_test('Test')
23
+ file = setup_testunit
24
24
  result = turn '--marshal', file
25
- assert !result.index('error: true')
26
- assert !result.index('fail: true')
25
+ assert !result.index('error: true'), "ACTUAL RESULT:\n#{result}"
26
+ assert !result.index('fail: true'), "ACTUAL RESULT:\n#{result}"
27
27
  end
28
28
 
29
29
  def test_outline
30
- file = setup_outline_test
30
+ file = setup_testunit_outline
31
31
  result = turn '--outline', file
32
- assert result.index('You should see me')
33
- assert !result.index('You should not see me')
32
+ assert result.index('You should see me'), "ACTUAL RESULT:\n#{result}"
33
+ assert !result.index('You should not see me'), "ACTUAL RESULT:\n#{result}"
34
34
  end
35
35
 
36
36
  def test_pretty
37
- file = setup_test('Test')
37
+ file = setup_testunit
38
38
  result = turn '--pretty', file
39
- assert result.index('0 errors')
40
- assert result.index('0 failures')
39
+ assert result.index('0 errors'), "ACTUAL RESULT:\n#{result}"
40
+ assert result.index('0 failures'), "ACTUAL RESULT:\n#{result}"
41
41
  end
42
42
 
43
43
  end
@@ -3,19 +3,19 @@ require File.expand_path(File.dirname(__FILE__)) + '/helper.rb'
3
3
  class TestRunners < Test::Unit::TestCase
4
4
 
5
5
  def test_solo
6
- file = setup_test('Test', false, 'test_solo.rb')
6
+ file = setup_testunit(false, 'test_solo.rb')
7
7
  result = turn2 '--solo', file
8
- assert result.index('pass: 1')
9
- assert result.index('fail: 0')
10
- assert result.index('error: 0')
8
+ assert result.index('pass: 1'), "ACTUAL RESULT --->\n #{result}"
9
+ assert result.index('fail: 0'), "ACTUAL RESULT --->\n #{result}"
10
+ assert result.index('error: 0'), "ACTUAL RESULT --->\n #{result}"
11
11
  end
12
12
 
13
13
  def test_cross
14
- file1 = setup_test('Test', false, 'test1.rb')
15
- file2 = setup_test('Test', false, 'test2.rb')
14
+ file1 = setup_testunit(false, 'test1.rb')
15
+ file2 = setup_testunit(false, 'test2.rb')
16
16
  result = turn2 '--cross', file1, file2
17
- assert result.index('pass: 2')
18
- assert result.index('error: 0')
17
+ assert result.index('pass: 2'), "ACTUAL RESULT --->\n #{result}"
18
+ assert result.index('error: 0'), "ACTUAL RESULT --->\n #{result}"
19
19
  end
20
20
 
21
21
  # autorun
@@ -23,11 +23,11 @@ class TestRunners < Test::Unit::TestCase
23
23
  #if RUBY_VERSION < '1.9'
24
24
 
25
25
  def test_autorun_testunit
26
- file = setup_test('Test', 'turn/autorun', 'test_autorun.rb')
26
+ file = setup_testunit('turn/autorun', 'test_autorun.rb')
27
27
  result = `ruby -Ilib #{file} 2>&1`
28
- assert(result.index('pass: 1'))
29
- assert(result.index('fail: 0'))
30
- assert(result.index('error: 0'))
28
+ assert(result.index('pass: 1'), "ACTUAL RESULT:\n #{result}")
29
+ assert(result.index('fail: 0'), "ACTUAL RESULT:\n #{result}")
30
+ assert(result.index('error: 0'), "ACTUAL RESULT:\n #{result}")
31
31
  end
32
32
 
33
33
  #else
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.9.0
4
+ version: 0.9.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-02-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ansi
16
- requirement: &23349740 !ruby/object:Gem::Requirement
16
+ requirement: &15635820 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *23349740
24
+ version_requirements: *15635820
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: minitest
27
- requirement: &23349320 !ruby/object:Gem::Requirement
27
+ requirement: &15635380 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *23349320
35
+ version_requirements: *15635380
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bones-git
38
- requirement: &23348880 !ruby/object:Gem::Requirement
38
+ requirement: &15634880 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *23348880
46
+ version_requirements: *15634880
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: bones
49
- requirement: &23348420 !ruby/object:Gem::Requirement
49
+ requirement: &15634400 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: 3.7.3
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *23348420
57
+ version_requirements: *15634400
58
58
  description: ''
59
59
  email: tim.pease@gmail.com
60
60
  executables: