test-unit 3.4.4 → 3.4.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -3
  3. data/Rakefile +0 -9
  4. data/doc/text/getting-started.md +1 -1
  5. data/doc/text/news.md +26 -1
  6. data/lib/test/unit/assertions.rb +93 -17
  7. data/lib/test/unit/testcase.rb +1 -1
  8. data/lib/test/unit/testsuite.rb +1 -1
  9. data/lib/test/unit/util/memory-usage.rb +47 -0
  10. data/lib/test/unit/version.rb +1 -1
  11. data/lib/test/unit.rb +4 -4
  12. metadata +6 -83
  13. data/test/collector/test-descendant.rb +0 -182
  14. data/test/collector/test-load.rb +0 -475
  15. data/test/collector/test_dir.rb +0 -407
  16. data/test/collector/test_objectspace.rb +0 -102
  17. data/test/fixtures/header-label.csv +0 -3
  18. data/test/fixtures/header-label.tsv +0 -3
  19. data/test/fixtures/header.csv +0 -3
  20. data/test/fixtures/header.tsv +0 -3
  21. data/test/fixtures/no-header.csv +0 -2
  22. data/test/fixtures/no-header.tsv +0 -2
  23. data/test/fixtures/plus.csv +0 -3
  24. data/test/run-test.rb +0 -22
  25. data/test/test-assertions.rb +0 -2281
  26. data/test/test-attribute-matcher.rb +0 -38
  27. data/test/test-attribute.rb +0 -123
  28. data/test/test-code-snippet.rb +0 -79
  29. data/test/test-color-scheme.rb +0 -123
  30. data/test/test-color.rb +0 -47
  31. data/test/test-data.rb +0 -419
  32. data/test/test-diff.rb +0 -518
  33. data/test/test-emacs-runner.rb +0 -60
  34. data/test/test-error.rb +0 -26
  35. data/test/test-failure.rb +0 -33
  36. data/test/test-fault-location-detector.rb +0 -163
  37. data/test/test-fixture.rb +0 -713
  38. data/test/test-notification.rb +0 -33
  39. data/test/test-omission.rb +0 -81
  40. data/test/test-pending.rb +0 -70
  41. data/test/test-priority.rb +0 -184
  42. data/test/test-test-case.rb +0 -1284
  43. data/test/test-test-result.rb +0 -113
  44. data/test/test-test-suite-creator.rb +0 -97
  45. data/test/test-test-suite.rb +0 -151
  46. data/test/testunit-test-util.rb +0 -33
  47. data/test/ui/test_testrunmediator.rb +0 -20
  48. data/test/util/test-method-owner-finder.rb +0 -38
  49. data/test/util/test-output.rb +0 -11
  50. data/test/util/test_backtracefilter.rb +0 -52
  51. data/test/util/test_observable.rb +0 -102
  52. data/test/util/test_procwrapper.rb +0 -36
@@ -1,11 +0,0 @@
1
- require 'test/unit'
2
-
3
- class TestUnitOutput < Test::Unit::TestCase
4
- def test_capture_output
5
- assert_equal(["stdout\n", "stderr\n"],
6
- capture_output do
7
- puts("stdout")
8
- warn("stderr")
9
- end)
10
- end
11
- end
@@ -1,52 +0,0 @@
1
- require 'test/unit'
2
-
3
- require 'test/unit/util/backtracefilter'
4
-
5
- module Test::Unit::Util
6
- class TestBacktraceFilter < Test::Unit::TestCase
7
- include BacktraceFilter
8
-
9
- def test_filter_backtrace
10
- backtrace = [%q{C:\some\old\path/test/unit/assertions.rb:44:in 'assert'},
11
- %q{tc_thing.rb:4:in 'a'},
12
- %q{tc_thing.rb:4:in 'test_stuff'},
13
- %q{C:\some\old\path/test/unit/testcase.rb:44:in 'send'},
14
- %q{C:\some\old\path\test\unit\testcase.rb:44:in 'run'},
15
- %q{C:\some\old\path\test\unit.rb:44:in 'run'},
16
- %q{tc_thing.rb:3}]
17
- assert_equal(backtrace[1..2], filter_backtrace(backtrace, %q{C:\some\old\path\test\unit}), "Should filter out all TestUnit-specific lines")
18
-
19
- backtrace = [%q{tc_thing.rb:4:in 'a'},
20
- %q{tc_thing.rb:4:in 'test_stuff'},
21
- %q{tc_thing.rb:3}]
22
- assert_equal(backtrace, filter_backtrace(backtrace, %q{C:\some\old\path\test\unit}), "Shouldn't filter too much")
23
-
24
- backtrace = [%q{C:\some\old\path/test/unit/assertions.rb:44:in 'assert'},
25
- %q{tc_thing.rb:4:in 'a'},
26
- %q{tc_thing.rb:4:in 'test_stuff'},
27
- %q{tc_thing.rb:3}]
28
- assert_equal(backtrace[1..3], filter_backtrace(backtrace, %q{C:\some\old\path\test\unit}), "Should filter out all TestUnit-specific lines")
29
-
30
- backtrace = [%q{C:\some\old\path/test/unit/assertions.rb:44:in 'assert'},
31
- %q{C:\some\old\path/test/unit/testcase.rb:44:in 'send'},
32
- %q{C:\some\old\path\test\unit\testcase.rb:44:in 'run'},
33
- %q{C:\some\old\path\test\unit.rb:44:in 'run'}]
34
- assert_equal(backtrace, filter_backtrace(backtrace, %q{C:\some\old\path\test\unit}), "Should filter out all TestUnit-specific lines")
35
- end
36
-
37
- def test_nil_backtrace
38
- assert_equal(["No backtrace"], filter_backtrace(nil))
39
- end
40
-
41
- def test_power_assert_backtrace
42
- omit('test for power_assert') unless defined?(PowerAssert)
43
- blk = Proc.new {caller.find {|i| /power_assert.*in \`start\'/ =~ i}}
44
- PowerAssert.start(blk) do |pa|
45
- backtrace = [pa.yield,
46
- %q{tc_thing.rb:4:in 'a'},
47
- %q{tc_thing.rb:4:in 'test_stuff'}]
48
- assert_equal(backtrace[1..2], filter_backtrace(backtrace))
49
- end
50
- end
51
- end
52
- end
@@ -1,102 +0,0 @@
1
- # Author:: Nathaniel Talbott.
2
- # Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
3
- # License:: Ruby license.
4
-
5
- require 'test/unit/util/observable'
6
-
7
- module Test
8
- module Unit
9
- module Util
10
- class TC_Observable < TestCase
11
-
12
- class TF_Observable
13
- include Observable
14
- end
15
-
16
- def setup
17
- @observable = TF_Observable.new
18
- end
19
-
20
- def test_simple_observation
21
- assert_raises(ArgumentError, "add_listener should throw an exception if no callback is supplied") do
22
- @observable.add_listener(:property, "a")
23
- end
24
-
25
- heard = false
26
- callback = proc { heard = true }
27
- assert_equal("a", @observable.add_listener(:property, "a", &callback), "add_listener should return the listener that was added")
28
-
29
- count = 0
30
- @observable.instance_eval do
31
- count = notify_listeners(:property)
32
- end
33
- assert_equal(1, count, "notify_listeners should have returned the number of listeners that were notified")
34
- assert(heard, "Should have heard the property changed")
35
-
36
- heard = false
37
- assert_equal(callback, @observable.remove_listener(:property, "a"), "remove_listener should return the callback")
38
-
39
- count = 1
40
- @observable.instance_eval do
41
- count = notify_listeners(:property)
42
- end
43
- assert_equal(0, count, "notify_listeners should have returned the number of listeners that were notified")
44
- assert(!heard, "Should not have heard the property change")
45
- end
46
-
47
- def test_value_observation
48
- value = nil
49
- @observable.add_listener(:property, "a") do |passed_value|
50
- value = passed_value
51
- end
52
- count = 0
53
- @observable.instance_eval do
54
- count = notify_listeners(:property, "stuff")
55
- end
56
- assert_equal(1, count, "Should have update the correct number of listeners")
57
- assert_equal("stuff", value, "Should have received the value as an argument to the listener")
58
- end
59
-
60
- def test_multiple_value_observation
61
- values = []
62
- @observable.add_listener(:property, "a") do |first_value, second_value|
63
- values = [first_value, second_value]
64
- end
65
- count = 0
66
- @observable.instance_eval do
67
- count = notify_listeners(:property, "stuff", "more stuff")
68
- end
69
- assert_equal(1, count, "Should have update the correct number of listeners")
70
- assert_equal(["stuff", "more stuff"], values, "Should have received the value as an argument to the listener")
71
- end
72
-
73
- def test_add_remove_with_default_listener
74
- assert_raises(ArgumentError, "add_listener should throw an exception if no callback is supplied") do
75
- @observable.add_listener(:property)
76
- end
77
-
78
- heard = false
79
- callback = proc { heard = true }
80
- assert_equal(callback, @observable.add_listener(:property, &callback), "add_listener should return the listener that was added")
81
-
82
- count = 0
83
- @observable.instance_eval do
84
- count = notify_listeners(:property)
85
- end
86
- assert_equal(1, count, "notify_listeners should have returned the number of listeners that were notified")
87
- assert(heard, "Should have heard the property changed")
88
-
89
- heard = false
90
- assert_equal(callback, @observable.remove_listener(:property, callback), "remove_listener should return the callback")
91
-
92
- count = 1
93
- @observable.instance_eval do
94
- count = notify_listeners(:property)
95
- end
96
- assert_equal(0, count, "notify_listeners should have returned the number of listeners that were notified")
97
- assert(!heard, "Should not have heard the property change")
98
- end
99
- end
100
- end
101
- end
102
- end
@@ -1,36 +0,0 @@
1
- # Author:: Nathaniel Talbott.
2
- # Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
3
- # License:: Ruby license.
4
-
5
- require 'test/unit'
6
- require 'test/unit/util/procwrapper'
7
-
8
- module Test
9
- module Unit
10
- module Util
11
- class TC_ProcWrapper < TestCase
12
- def munge_proc(&a_proc)
13
- return a_proc
14
- end
15
- def setup
16
- @original = proc {}
17
- @munged = munge_proc(&@original)
18
- @wrapped_original = ProcWrapper.new(@original)
19
- @wrapped_munged = ProcWrapper.new(@munged)
20
- end
21
- def test_wrapping
22
- assert_same(@original, @wrapped_original.to_proc, "The wrapper should return what was wrapped")
23
- end
24
- def test_hashing
25
-
26
- assert_equal(@wrapped_original.hash, @wrapped_munged.hash, "The original and munged should have the same hash when wrapped")
27
- assert_equal(@wrapped_original, @wrapped_munged, "The wrappers should be equivalent")
28
-
29
- a_hash = {@wrapped_original => @original}
30
- assert(a_hash[@wrapped_original], "Should be able to access the wrapper in the hash")
31
- assert_equal(a_hash[@wrapped_original], @original, "Should be able to access the wrapper in the hash")
32
- end
33
- end
34
- end
35
- end
36
- end