ZenTest 3.2.0 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/History.txt +21 -0
  2. data/Manifest.txt +8 -24
  3. data/Rakefile +32 -8
  4. data/bin/autotest +4 -1
  5. data/bin/multiruby +20 -6
  6. data/bin/ruby_fork +6 -0
  7. data/bin/ruby_fork_client +6 -0
  8. data/example_dot_autotest.rb +148 -0
  9. data/lib/autotest.rb +201 -254
  10. data/lib/rails_autotest.rb +48 -110
  11. data/lib/ruby_fork.rb +178 -0
  12. data/lib/test/rails.rb +2 -2
  13. data/lib/test/rails/controller_test_case.rb +1 -1
  14. data/lib/test/rails/helper_test_case.rb +60 -0
  15. data/lib/test/rails/pp_html_document.rb +74 -0
  16. data/lib/test/rails/rake_tasks.rb +13 -12
  17. data/lib/test/rails/view_test_case.rb +2 -2
  18. data/lib/test/zentest_assertions.rb +39 -0
  19. data/lib/unit_diff.rb +6 -3
  20. data/lib/zentest.rb +1 -1
  21. data/test/test_autotest.rb +160 -208
  22. data/test/test_rails_autotest.rb +115 -138
  23. data/test/test_ruby_fork.rb +172 -0
  24. data/test/test_unit_diff.rb +69 -1
  25. data/test/test_zentest_assertions.rb +66 -0
  26. metadata +13 -27
  27. data/test/data/normal/lib/.#photo.rb +0 -0
  28. data/test/data/normal/lib/blah.rb +0 -0
  29. data/test/data/normal/lib/photo.rb +0 -0
  30. data/test/data/normal/test/#test_photo.rb# +0 -0
  31. data/test/data/normal/test/test_camelcase.rb +0 -0
  32. data/test/data/normal/test/test_photo.rb +0 -0
  33. data/test/data/normal/test/test_route.rb +0 -0
  34. data/test/data/normal/test/test_user.rb +0 -0
  35. data/test/data/rails/app/controllers/admin/theme_controller.rb +0 -0
  36. data/test/data/rails/app/controllers/route_controller.rb +0 -0
  37. data/test/data/rails/app/models/flickr_photo.rb +0 -0
  38. data/test/data/rails/app/models/route.rb +0 -0
  39. data/test/data/rails/app/views/route/index.rhtml +0 -0
  40. data/test/data/rails/config/environment.rb +0 -0
  41. data/test/data/rails/config/routes.rb +0 -0
  42. data/test/data/rails/test/controllers/route_controller_test.rb +0 -0
  43. data/test/data/rails/test/fixtures/routes.yml +0 -0
  44. data/test/data/rails/test/functional/admin/themes_controller_test.rb +0 -0
  45. data/test/data/rails/test/functional/dummy_controller_test.rb +0 -0
  46. data/test/data/rails/test/functional/route_controller_test.rb +0 -0
  47. data/test/data/rails/test/unit/flickr_photo_test.rb +0 -0
  48. data/test/data/rails/test/unit/photo_test.rb +0 -0
  49. data/test/data/rails/test/unit/route_test.rb +0 -0
  50. data/test/data/rails/test/views/route_view_test.rb +0 -0
@@ -28,6 +28,24 @@ class TestUnitDiff < Test::Unit::TestCase
28
28
  assert_equal expected, @diff.input(input)
29
29
  end
30
30
 
31
+ def test_unit_diff_empty # simulates broken pipe at the least
32
+ input = ""
33
+ expected = ""
34
+ assert_equal expected, @diff.unit_diff(input)
35
+ end
36
+
37
+ def test_parse_diff_angles
38
+ input = [" 1) Failure:\n",
39
+ "test_test1(TestBlah) [./blah.rb:25]:\n",
40
+ "<\"<html>\"> expected but was\n",
41
+ "<\"<body>\">.\n"
42
+ ]
43
+
44
+ expected = [[" 1) Failure:\n", "test_test1(TestBlah) [./blah.rb:25]:\n"], ["<html>"], ["<body>"]]
45
+
46
+ assert_equal expected, @diff.parse_diff(input)
47
+ end
48
+
31
49
  def test_parse_diff1
32
50
  input = [" 1) Failure:\n",
33
51
  "test_test1(TestBlah) [./blah.rb:25]:\n",
@@ -67,6 +85,40 @@ class TestUnitDiff < Test::Unit::TestCase
67
85
  assert_equal expected, @diff.parse_diff(input)
68
86
  end
69
87
 
88
+ def test_parse_diff_suspect_equals
89
+ input = ["1) Failure:\n",
90
+ "test_util_capture(AssertionsTest) [test/test_zentest_assertions.rb:53]:\n",
91
+ "<\"out\"> expected but was\n",
92
+ "<\"out\">.\n"]
93
+ expected = [["1) Failure:\n",
94
+ "test_util_capture(AssertionsTest) [test/test_zentest_assertions.rb:53]:\n"],
95
+ ["out"],
96
+ ["out"]]
97
+
98
+ assert_equal expected, @diff.parse_diff(input)
99
+ end
100
+
101
+ def test_parse_diff_NOT_suspect_equals
102
+ input = ["1) Failure:\n",
103
+ "test_util_capture(AssertionsTest) [test/test_zentest_assertions.rb:53]:\n",
104
+ "<\"out\"> expected but was\n",
105
+ "<\"out\\n\">.\n"]
106
+ expected = [["1) Failure:\n",
107
+ "test_util_capture(AssertionsTest) [test/test_zentest_assertions.rb:53]:\n"],
108
+ ["out"],
109
+ ["out\\n"]]
110
+
111
+ assert_equal expected, @diff.parse_diff(input)
112
+ end
113
+
114
+ def test_unit_diff_angles
115
+ input = "Loaded suite ./blah\nStarted\nF\nFinished in 0.035332 seconds.\n\n 1) Failure:\ntest_test1(TestBlah) [./blah.rb:25]:\n<\"<html>\"> expected but was\n<\"<body>\">.\n\n1 tests, 1 assertions, 1 failures, 0 errors\n"
116
+
117
+ expected = "Loaded suite ./blah\nStarted\nF\nFinished in 0.035332 seconds.\n\n1) Failure:\ntest_test1(TestBlah) [./blah.rb:25]:\n1c1\n< <html>\n---\n> <body>\n\n1 tests, 1 assertions, 1 failures, 0 errors"
118
+
119
+ assert_equal expected, @diff.unit_diff(input)
120
+ end
121
+
70
122
  def test_unit_diff1
71
123
  input = "Loaded suite ./blah\nStarted\nF\nFinished in 0.035332 seconds.\n\n 1) Failure:\ntest_test1(TestBlah) [./blah.rb:25]:\n<\"line1\\nline2\\nline3\\n\"> expected but was\n<\"line4\\nline5\\nline6\\n\">.\n\n1 tests, 1 assertions, 1 failures, 0 errors\n"
72
124
 
@@ -78,7 +130,7 @@ class TestUnitDiff < Test::Unit::TestCase
78
130
  def test_unit_diff2
79
131
  input = "Loaded suite ./blah\nStarted\nFF\nFinished in 0.035332 seconds.\n\n 1) Failure:\ntest_test1(TestBlah) [./blah.rb:25]:\n<\"line1\\nline2\\nline3\\n\"> expected but was\n<\"line4\\nline5\\nline6\\n\">.\n\n 2) Failure:\ntest_test2(TestBlah) [./blah.rb:29]:\n<\"line1\"> expected but was\n<\"line2\\nline3\\n\\n\">.\n\n2 tests, 2 assertions, 2 failures, 0 errors\n"
80
132
 
81
- expected = "Loaded suite ./blah\nStarted\nFF\nFinished in 0.035332 seconds.\n\n1) Failure:\ntest_test1(TestBlah) [./blah.rb:25]:\n1,3c1,3\n< line1\n< line2\n< line3\n---\n> line4\n> line5\n> line6\n\n2) Failure:\ntest_test2(TestBlah) [./blah.rb:29]:\n1c1,3\n< line1\n---\n> line2\n> line3\n>\n\n2 tests, 2 assertions, 2 failures, 0 errors"
133
+ expected = "Loaded suite ./blah\nStarted\nFF\nFinished in 0.035332 seconds.\n\n1) Failure:\ntest_test1(TestBlah) [./blah.rb:25]:\n1,3c1,3\n< line1\n< line2\n< line3\n---\n> line4\n> line5\n> line6\n\n2) Failure:\ntest_test2(TestBlah) [./blah.rb:29]:\n1c1,4\n< line1\n---\n> line2\n> line3\n>\n>\n\n2 tests, 2 assertions, 2 failures, 0 errors"
82
134
 
83
135
  assert_equal expected, @diff.unit_diff(input)
84
136
  end
@@ -91,5 +143,21 @@ class TestUnitDiff < Test::Unit::TestCase
91
143
  assert_equal expected, @diff.unit_diff(input)
92
144
  end
93
145
 
146
+ def test_unit_diff_suspect_equals
147
+ input = ".............................................F............................................\nFinished in 0.834671 seconds.\n\n 1) Failure:\ntest_unit_diff_suspect_equals(TestUnitDiff) [./test/test_unit_diff.rb:122]:\n<\"out\"> expected but was\n<\"out\">.\n\n90 tests, 241 assertions, 1 failures, 0 errors"
148
+
149
+ expected = ".............................................F............................................\nFinished in 0.834671 seconds.\n\n1) Failure:\ntest_unit_diff_suspect_equals(TestUnitDiff) [./test/test_unit_diff.rb:122]:\n[no difference--suspect ==]\n\n90 tests, 241 assertions, 1 failures, 0 errors"
150
+
151
+ assert_equal expected, @diff.unit_diff(input)
152
+ end
153
+
154
+ def test_unit_diff_NOT_suspect_equals
155
+ input = ".\nFinished in 0.0 seconds.\n\n 1) Failure:\ntest_blah(TestBlah)\n<\"out\"> expected but was\n<\"out\\n\">.\n\n1 tests, 1 assertions, 1 failures, 0 errors"
156
+
157
+ expected = ".\nFinished in 0.0 seconds.\n\n1) Failure:\ntest_blah(TestBlah)\n1a2\n>\n\n1 tests, 1 assertions, 1 failures, 0 errors"
158
+
159
+ assert_equal expected, @diff.unit_diff(input)
160
+ end
161
+
94
162
  end
95
163
 
@@ -0,0 +1,66 @@
1
+ require 'test/unit'
2
+ require 'test/zentest_assertions'
3
+
4
+ class AssertionsTest < Test::Unit::TestCase
5
+
6
+ def test_assert_empty
7
+ assert_empty []
8
+
9
+ assert_raise Test::Unit::AssertionFailedError do
10
+ assert_empty [true]
11
+ end
12
+ end
13
+
14
+ def test_deny
15
+ deny false
16
+ deny nil
17
+
18
+ assert_raise Test::Unit::AssertionFailedError do
19
+ deny true
20
+ end
21
+ end
22
+
23
+ def test_deny_equal
24
+ deny_equal true, false
25
+
26
+ assert_raise Test::Unit::AssertionFailedError do
27
+ deny_equal true, true
28
+ end
29
+ end
30
+
31
+ def test_deny_empty
32
+ deny_empty [true]
33
+
34
+ assert_raise Test::Unit::AssertionFailedError do
35
+ deny_empty []
36
+ end
37
+ end
38
+
39
+ def test_assert_includes
40
+ assert_includes [true], true
41
+
42
+ assert_raise Test::Unit::AssertionFailedError do
43
+ assert_includes [true], false
44
+ end
45
+ end
46
+
47
+ def test_deny_includes
48
+ deny_includes [true], false
49
+
50
+ assert_raise Test::Unit::AssertionFailedError do
51
+ deny_includes [true], true
52
+ end
53
+ end
54
+
55
+ def test_util_capture
56
+ out, err = util_capture do
57
+ puts 'out'
58
+ $stderr.puts 'err'
59
+ end
60
+
61
+ assert_equal "out\n", out.string
62
+ assert_equal "err\n", err.string
63
+ end
64
+
65
+ end
66
+
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.8.11.6
2
+ rubygems_version: 0.8.11.15
3
3
  specification_version: 1
4
4
  name: ZenTest
5
5
  version: !ruby/object:Gem::Version
6
- version: 3.2.0
7
- date: 2006-04-10 00:00:00 -07:00
6
+ version: 3.3.0
7
+ date: 2006-07-28 00:00:00 -07:00
8
8
  summary: |-
9
9
  ZenTest can also be used to evaluate generated code and execute your
10
10
  tests, allowing for very rapid development of both tests and
@@ -64,51 +64,35 @@ files:
64
64
  - bin/autotest
65
65
  - bin/multiruby
66
66
  - bin/rails_test_audit
67
+ - bin/ruby_fork
68
+ - bin/ruby_fork_client
67
69
  - bin/unit_diff
68
70
  - bin/zentest
69
71
  - example.txt
70
72
  - example1.rb
71
73
  - example2.rb
74
+ - example_dot_autotest.rb
72
75
  - lib/autotest.rb
73
76
  - lib/rails_autotest.rb
77
+ - lib/ruby_fork.rb
74
78
  - lib/test/rails.rb
75
79
  - lib/test/rails/controller_test_case.rb
76
80
  - lib/test/rails/functional_test_case.rb
81
+ - lib/test/rails/helper_test_case.rb
77
82
  - lib/test/rails/ivar_proxy.rb
83
+ - lib/test/rails/pp_html_document.rb
78
84
  - lib/test/rails/rake_tasks.rb
79
85
  - lib/test/rails/test_case.rb
80
86
  - lib/test/rails/view_test_case.rb
81
87
  - lib/test/zentest_assertions.rb
82
88
  - lib/unit_diff.rb
83
89
  - lib/zentest.rb
84
- - test/data/normal/lib/.#photo.rb
85
- - test/data/normal/lib/blah.rb
86
- - test/data/normal/lib/photo.rb
87
- - test/data/normal/test/#test_photo.rb#
88
- - test/data/normal/test/test_camelcase.rb
89
- - test/data/normal/test/test_photo.rb
90
- - test/data/normal/test/test_route.rb
91
- - test/data/normal/test/test_user.rb
92
- - test/data/rails/app/controllers/admin/theme_controller.rb
93
- - test/data/rails/app/controllers/route_controller.rb
94
- - test/data/rails/app/models/flickr_photo.rb
95
- - test/data/rails/app/models/route.rb
96
- - test/data/rails/app/views/route/index.rhtml
97
- - test/data/rails/config/environment.rb
98
- - test/data/rails/config/routes.rb
99
- - test/data/rails/test/controllers/route_controller_test.rb
100
- - test/data/rails/test/fixtures/routes.yml
101
- - test/data/rails/test/functional/admin/themes_controller_test.rb
102
- - test/data/rails/test/functional/dummy_controller_test.rb
103
- - test/data/rails/test/functional/route_controller_test.rb
104
- - test/data/rails/test/unit/flickr_photo_test.rb
105
- - test/data/rails/test/unit/photo_test.rb
106
- - test/data/rails/test/unit/route_test.rb
107
- - test/data/rails/test/views/route_view_test.rb
108
90
  - test/test_autotest.rb
109
91
  - test/test_rails_autotest.rb
92
+ - test/test_ruby_fork.rb
110
93
  - test/test_unit_diff.rb
111
94
  - test/test_zentest.rb
95
+ - test/test_zentest_assertions.rb
112
96
  test_files: []
113
97
 
114
98
  rdoc_options: []
@@ -119,6 +103,8 @@ executables:
119
103
  - autotest
120
104
  - multiruby
121
105
  - rails_test_audit
106
+ - ruby_fork
107
+ - ruby_fork_client
122
108
  - unit_diff
123
109
  - zentest
124
110
  extensions: []
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes