glib2 0.90.7-x86-mingw32 → 0.90.8-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +68 -0
- data/ext/glib2/rbglib.c +51 -15
- data/ext/glib2/rbglib.h +10 -2
- data/ext/glib2/rbglib_bookmarkfile.c +37 -74
- data/ext/glib2/rbglib_completion.c +8 -16
- data/ext/glib2/rbglib_convert.c +8 -18
- data/ext/glib2/rbglib_error.c +2 -8
- data/ext/glib2/rbglib_i18n.c +1 -2
- data/ext/glib2/rbglib_iochannel.c +81 -127
- data/ext/glib2/rbglib_keyfile.c +38 -86
- data/ext/glib2/rbglib_maincontext.c +29 -64
- data/ext/glib2/rbglib_mainloop.c +4 -8
- data/ext/glib2/rbglib_messages.c +7 -17
- data/ext/glib2/rbglib_pollfd.c +7 -14
- data/ext/glib2/rbglib_shell.c +3 -6
- data/ext/glib2/rbglib_source.c +14 -28
- data/ext/glib2/rbglib_spawn.c +7 -14
- data/ext/glib2/rbglib_threads.c +2 -4
- data/ext/glib2/rbglib_timer.c +7 -14
- data/ext/glib2/rbglib_unicode.c +45 -16
- data/ext/glib2/rbglib_utils.c +25 -50
- data/ext/glib2/rbglib_win32.c +10 -17
- data/ext/glib2/rbgobj_boxed.c +9 -21
- data/ext/glib2/rbgobj_closure.c +5 -11
- data/ext/glib2/rbgobj_enums.c +1 -2
- data/ext/glib2/rbgobj_object.c +23 -59
- data/ext/glib2/rbgobj_param.c +7 -15
- data/ext/glib2/rbgobj_signal.c +25 -65
- data/ext/glib2/rbgobj_type.c +36 -81
- data/ext/glib2/rbgobj_typeinstance.c +3 -6
- data/ext/glib2/rbgobj_typeinterface.c +3 -6
- data/ext/glib2/rbgobj_typemodule.c +4 -8
- data/ext/glib2/rbgobj_typeplugin.c +2 -4
- data/ext/glib2/rbgobj_valuetypes.c +7 -15
- data/ext/glib2/rbgobject.c +8 -18
- data/ext/glib2/rbgobject.h +3 -0
- data/ext/glib2/rbgprivate.h +0 -1
- data/ext/glib2/rbgutil.c +3 -6
- data/lib/1.8/glib2.so +0 -0
- data/lib/1.9/glib2.so +0 -0
- data/lib/gnome2-raketask.rb +1 -0
- data/lib/mkmf-gnome2.rb +12 -9
- data/test-unit/History.txt +43 -1
- data/test-unit/Manifest.txt +1 -1
- data/test-unit/html/index.html +62 -24
- data/test-unit/html/index.html.ja +54 -25
- data/test-unit/html/test-unit.css +3 -3
- data/test-unit/lib/test/unit/assertions.rb +489 -36
- data/test-unit/lib/test/unit/autorunner.rb +40 -0
- data/test-unit/lib/test/unit/collector.rb +6 -4
- data/test-unit/lib/test/unit/collector/load.rb +48 -5
- data/test-unit/lib/test/unit/collector/xml.rb +250 -0
- data/test-unit/lib/test/unit/error.rb +4 -3
- data/test-unit/lib/test/unit/fixture.rb +12 -3
- data/test-unit/lib/test/unit/runner/xml.rb +15 -0
- data/test-unit/lib/test/unit/testcase.rb +48 -16
- data/test-unit/lib/test/unit/testresult.rb +6 -2
- data/test-unit/lib/test/unit/testsuite.rb +24 -2
- data/test-unit/lib/test/unit/ui/console/testrunner.rb +65 -28
- data/test-unit/lib/test/unit/ui/testrunnermediator.rb +11 -2
- data/test-unit/lib/test/unit/ui/xml/testrunner.rb +224 -0
- data/test-unit/lib/test/unit/version.rb +1 -1
- data/test-unit/test/run-test.rb +7 -0
- data/test-unit/test/{test_assertions.rb → test-assertions.rb} +708 -77
- data/test-unit/test/test-fixture.rb +37 -0
- data/test-unit/test/test-testcase.rb +24 -7
- data/test-unit/test/test_testsuite.rb +19 -11
- data/test/test_iochannel.rb +9 -9
- data/test/test_unicode.rb +44 -31
- metadata +8 -5
@@ -154,13 +154,22 @@ module Test
|
|
154
154
|
end
|
155
155
|
|
156
156
|
private
|
157
|
-
def run_fixture(fixture)
|
157
|
+
def run_fixture(fixture, options={})
|
158
158
|
[
|
159
159
|
self.class.send("before_#{fixture}_methods"),
|
160
160
|
fixture,
|
161
161
|
self.class.send("after_#{fixture}_methods")
|
162
162
|
].flatten.each do |method_name|
|
163
|
-
|
163
|
+
next unless respond_to?(method_name, true)
|
164
|
+
if options[:handle_exception]
|
165
|
+
begin
|
166
|
+
send(method_name)
|
167
|
+
rescue Exception
|
168
|
+
raise unless handle_exception($!)
|
169
|
+
end
|
170
|
+
else
|
171
|
+
send(method_name)
|
172
|
+
end
|
164
173
|
end
|
165
174
|
end
|
166
175
|
|
@@ -169,7 +178,7 @@ module Test
|
|
169
178
|
end
|
170
179
|
|
171
180
|
def run_teardown
|
172
|
-
run_fixture(:teardown)
|
181
|
+
run_fixture(:teardown, :handle_exception => true)
|
173
182
|
end
|
174
183
|
end
|
175
184
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Test
|
2
|
+
module Unit
|
3
|
+
AutoRunner.register_runner(:xml) do |auto_runner|
|
4
|
+
require 'test/unit/ui/xml/testrunner'
|
5
|
+
Test::Unit::UI::XML::TestRunner
|
6
|
+
end
|
7
|
+
|
8
|
+
AutoRunner.setup_option do |auto_runner, opts|
|
9
|
+
opts.on("--output-file-descriptor=FD", Integer,
|
10
|
+
"Outputs to file descriptor FD") do |fd|
|
11
|
+
auto_runner.runner_options[:output_file_descriptor] = fd
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -87,6 +87,8 @@ module Test
|
|
87
87
|
|
88
88
|
STARTED = name + "::STARTED" # :nodoc:
|
89
89
|
FINISHED = name + "::FINISHED" # :nodoc:
|
90
|
+
STARTED_OBJECT = name + "::STARTED::OBJECT" # :nodoc:
|
91
|
+
FINISHED_OBJECT = name + "::FINISHED::OBJECT" # :nodoc:
|
90
92
|
|
91
93
|
DESCENDANTS = [] # :nodoc:
|
92
94
|
AVAILABLE_ORDERS = [:alphabetic, :random, :defined] # :nodoc:
|
@@ -219,9 +221,11 @@ module Test
|
|
219
221
|
@@test_orders[self] = order
|
220
222
|
end
|
221
223
|
|
222
|
-
# Defines a test in declarative syntax
|
224
|
+
# Defines a test in declarative syntax or marks
|
225
|
+
# following method as a test method.
|
223
226
|
#
|
224
|
-
#
|
227
|
+
# In declarative syntax usage, the following two
|
228
|
+
# test definitions are the almost same:
|
225
229
|
#
|
226
230
|
# description "register user"
|
227
231
|
# def test_register_user
|
@@ -231,11 +235,33 @@ module Test
|
|
231
235
|
# test "register user" do
|
232
236
|
# ...
|
233
237
|
# end
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
238
|
+
#
|
239
|
+
# In test method mark usage, the "my_test_method" is
|
240
|
+
# treated as a test method:
|
241
|
+
#
|
242
|
+
# test
|
243
|
+
# def my_test_method
|
244
|
+
# assert_equal("call me", ...)
|
245
|
+
# end
|
246
|
+
def test(*test_description_or_targets, &block)
|
247
|
+
if block_given?
|
248
|
+
test_description = test_description_or_targets.first
|
249
|
+
if test_description.nil?
|
250
|
+
raise ArgumentError, "test description is missing"
|
251
|
+
end
|
252
|
+
n_arguments = test_description_or_targets.size
|
253
|
+
if n_arguments > 1
|
254
|
+
message = "wrong number of arguments (#{n_arguments} for 1)"
|
255
|
+
raise ArgumentError, message
|
256
|
+
end
|
257
|
+
method_name = test_description
|
258
|
+
define_method(method_name, &block)
|
259
|
+
description(test_description, method_name)
|
260
|
+
attribute(:test, true, {}, method_name)
|
261
|
+
else
|
262
|
+
targets = test_description_or_targets
|
263
|
+
attribute(:test, true, {}, *targets)
|
264
|
+
end
|
239
265
|
end
|
240
266
|
|
241
267
|
# Describes a test.
|
@@ -259,7 +285,7 @@ module Test
|
|
259
285
|
name.to_s
|
260
286
|
end
|
261
287
|
test_names = method_names.find_all do |method_name|
|
262
|
-
method_name =~ /^test./
|
288
|
+
method_name =~ /^test./ or get_attribute(method_name, :test)
|
263
289
|
end
|
264
290
|
send("sort_test_names_in_#{test_order}_order", test_names)
|
265
291
|
end
|
@@ -291,7 +317,7 @@ module Test
|
|
291
317
|
# :startdoc:
|
292
318
|
end
|
293
319
|
|
294
|
-
attr_reader :method_name
|
320
|
+
attr_reader :method_name, :start_time, :elapsed_time
|
295
321
|
|
296
322
|
# Creates a new instance of the fixture for running the
|
297
323
|
# test represented by test_method_name.
|
@@ -306,6 +332,8 @@ module Test
|
|
306
332
|
@method_name = test_method_name
|
307
333
|
@test_passed = true
|
308
334
|
@interrupted = false
|
335
|
+
@start_time = nil
|
336
|
+
@elapsed_time = nil
|
309
337
|
end
|
310
338
|
|
311
339
|
# Runs the individual test method represented by this
|
@@ -314,7 +342,9 @@ module Test
|
|
314
342
|
def run(result)
|
315
343
|
begin
|
316
344
|
@_result = result
|
345
|
+
@start_time = Time.now
|
317
346
|
yield(STARTED, name)
|
347
|
+
yield(STARTED_OBJECT, self)
|
318
348
|
begin
|
319
349
|
run_setup
|
320
350
|
run_test
|
@@ -328,8 +358,10 @@ module Test
|
|
328
358
|
raise unless handle_exception($!)
|
329
359
|
end
|
330
360
|
end
|
361
|
+
@elapsed_time = Time.now - @start_time
|
331
362
|
result.add_run
|
332
363
|
yield(FINISHED, name)
|
364
|
+
yield(FINISHED_OBJECT, self)
|
333
365
|
ensure
|
334
366
|
# @_result = nil # For test-spec's after_all :<
|
335
367
|
end
|
@@ -440,6 +472,13 @@ module Test
|
|
440
472
|
@interrupted
|
441
473
|
end
|
442
474
|
|
475
|
+
# Returns whether this individual test passed or
|
476
|
+
# not. Primarily for use in teardown so that artifacts
|
477
|
+
# can be left behind if the test fails.
|
478
|
+
def passed?
|
479
|
+
@test_passed
|
480
|
+
end
|
481
|
+
|
443
482
|
private
|
444
483
|
def current_result
|
445
484
|
@_result
|
@@ -460,13 +499,6 @@ module Test
|
|
460
499
|
false
|
461
500
|
end
|
462
501
|
|
463
|
-
# Returns whether this individual test passed or
|
464
|
-
# not. Primarily for use in teardown so that artifacts
|
465
|
-
# can be left behind if the test fails.
|
466
|
-
def passed?
|
467
|
-
@test_passed
|
468
|
-
end
|
469
|
-
|
470
502
|
def problem_occurred
|
471
503
|
@test_passed = false
|
472
504
|
end
|
@@ -31,8 +31,10 @@ module Test
|
|
31
31
|
include TestResultOmissionSupport
|
32
32
|
include TestResultNotificationSupport
|
33
33
|
|
34
|
-
|
35
|
-
|
34
|
+
FINISHED = name + "::FINISHED"
|
35
|
+
CHANGED = name + "::CHANGED"
|
36
|
+
PASS_ASSERTION = name + "::PASS_ASSERTION"
|
37
|
+
FAULT = name + "::FAULT"
|
36
38
|
|
37
39
|
attr_reader :run_count, :pass_count, :assertion_count, :faults
|
38
40
|
|
@@ -48,6 +50,7 @@ module Test
|
|
48
50
|
# Records a test run.
|
49
51
|
def add_run
|
50
52
|
@run_count += 1
|
53
|
+
notify_listeners(FINISHED, self)
|
51
54
|
notify_changed
|
52
55
|
end
|
53
56
|
|
@@ -58,6 +61,7 @@ module Test
|
|
58
61
|
# Records an individual assertion.
|
59
62
|
def add_assertion
|
60
63
|
@assertion_count += 1
|
64
|
+
notify_listeners(PASS_ASSERTION, self)
|
61
65
|
notify_changed
|
62
66
|
end
|
63
67
|
|
@@ -2,6 +2,7 @@
|
|
2
2
|
#
|
3
3
|
# Author:: Nathaniel Talbott.
|
4
4
|
# Copyright:: Copyright (c) 2000-2003 Nathaniel Talbott. All rights reserved.
|
5
|
+
# Copyright:: Copyright (c) 2008-2011 Kouhei Sutou. All rights reserved.
|
5
6
|
# License:: Ruby license.
|
6
7
|
|
7
8
|
require 'test/unit/error'
|
@@ -17,10 +18,16 @@ module Test
|
|
17
18
|
# has a suite method as simply providing a way to get a
|
18
19
|
# meaningful TestSuite instance.
|
19
20
|
class TestSuite
|
20
|
-
attr_reader :name, :tests
|
21
|
-
|
21
|
+
attr_reader :name, :tests, :test_case, :start_time, :elapsed_time
|
22
|
+
|
23
|
+
# Test suite that has higher priority is ran prior to
|
24
|
+
# test suites that have lower priority.
|
25
|
+
attr_accessor :priority
|
26
|
+
|
22
27
|
STARTED = name + "::STARTED"
|
28
|
+
STARTED_OBJECT = name + "::STARTED::OBJECT"
|
23
29
|
FINISHED = name + "::FINISHED"
|
30
|
+
FINISHED_OBJECT = name + "::FINISHED::OBJECT"
|
24
31
|
|
25
32
|
# Creates a new TestSuite with the given name.
|
26
33
|
def initialize(name="Unnamed TestSuite", test_case=nil)
|
@@ -28,19 +35,29 @@ module Test
|
|
28
35
|
@tests = []
|
29
36
|
@test_case = test_case
|
30
37
|
@n_tests = 0
|
38
|
+
@priority = 0
|
39
|
+
@start_time = nil
|
40
|
+
@elapsed_time = nil
|
41
|
+
@passed = true
|
31
42
|
end
|
32
43
|
|
33
44
|
# Runs the tests and/or suites contained in this
|
34
45
|
# TestSuite.
|
35
46
|
def run(result, &progress_block)
|
47
|
+
@start_time = Time.now
|
36
48
|
yield(STARTED, name)
|
49
|
+
yield(STARTED_OBJECT, self)
|
37
50
|
run_startup(result)
|
38
51
|
while test = @tests.shift
|
39
52
|
@n_tests += test.size
|
40
53
|
test.run(result, &progress_block)
|
54
|
+
@passed = false unless test.passed?
|
41
55
|
end
|
42
56
|
run_shutdown(result)
|
57
|
+
ensure
|
58
|
+
@elapsed_time = Time.now - @start_time
|
43
59
|
yield(FINISHED, name)
|
60
|
+
yield(FINISHED_OBJECT, self)
|
44
61
|
end
|
45
62
|
|
46
63
|
# Adds the test to the suite.
|
@@ -79,6 +96,10 @@ module Test
|
|
79
96
|
@tests == other.tests
|
80
97
|
end
|
81
98
|
|
99
|
+
def passed?
|
100
|
+
@passed
|
101
|
+
end
|
102
|
+
|
82
103
|
private
|
83
104
|
def run_startup(result)
|
84
105
|
return if @test_case.nil? or !@test_case.respond_to?(:startup)
|
@@ -104,6 +125,7 @@ module Test
|
|
104
125
|
false
|
105
126
|
else
|
106
127
|
result.add_error(Error.new(@test_case.name, exception))
|
128
|
+
@passed = false
|
107
129
|
true
|
108
130
|
end
|
109
131
|
end
|
@@ -56,21 +56,28 @@ module Test
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def attach_to_mediator
|
59
|
-
@mediator.add_listener(TestResult::FAULT,
|
60
|
-
|
61
|
-
@mediator.add_listener(TestRunnerMediator::
|
62
|
-
|
63
|
-
@mediator.add_listener(
|
64
|
-
|
65
|
-
@mediator.add_listener(
|
59
|
+
@mediator.add_listener(TestResult::FAULT,
|
60
|
+
&method(:add_fault))
|
61
|
+
@mediator.add_listener(TestRunnerMediator::STARTED,
|
62
|
+
&method(:started))
|
63
|
+
@mediator.add_listener(TestRunnerMediator::FINISHED,
|
64
|
+
&method(:finished))
|
65
|
+
@mediator.add_listener(TestCase::STARTED_OBJECT,
|
66
|
+
&method(:test_started))
|
67
|
+
@mediator.add_listener(TestCase::FINISHED_OBJECT,
|
68
|
+
&method(:test_finished))
|
69
|
+
@mediator.add_listener(TestSuite::STARTED_OBJECT,
|
70
|
+
&method(:test_suite_started))
|
71
|
+
@mediator.add_listener(TestSuite::FINISHED_OBJECT,
|
72
|
+
&method(:test_suite_finished))
|
66
73
|
end
|
67
|
-
|
74
|
+
|
68
75
|
def add_fault(fault)
|
69
76
|
@faults << fault
|
70
77
|
output_progress(fault.single_character_display, fault_color(fault))
|
71
78
|
@already_outputted = true if fault.critical?
|
72
79
|
end
|
73
|
-
|
80
|
+
|
74
81
|
def started(result)
|
75
82
|
@result = result
|
76
83
|
output_started
|
@@ -92,6 +99,15 @@ module Test
|
|
92
99
|
nl
|
93
100
|
output(@result, result_color)
|
94
101
|
output("%g%% passed" % @result.pass_percentage, result_color)
|
102
|
+
unless elapsed_time.zero?
|
103
|
+
nl
|
104
|
+
throuputs =
|
105
|
+
[
|
106
|
+
"%.2f tests/s" % [@result.run_count / elapsed_time],
|
107
|
+
"%.2f assertions/s" % [@result.assertion_count / elapsed_time],
|
108
|
+
]
|
109
|
+
output(throuputs.join(", "))
|
110
|
+
end
|
95
111
|
end
|
96
112
|
|
97
113
|
def output_fault(fault)
|
@@ -133,18 +149,43 @@ module Test
|
|
133
149
|
end
|
134
150
|
|
135
151
|
def output_fault_message(fault)
|
152
|
+
if fault.expected.respond_to?(:encoding) and
|
153
|
+
fault.actual.respond_to?(:encoding) and
|
154
|
+
fault.expected.encoding != fault.actual.encoding
|
155
|
+
need_encoding = true
|
156
|
+
else
|
157
|
+
need_encoding = false
|
158
|
+
end
|
136
159
|
output(fault.user_message) if fault.user_message
|
137
160
|
output_single("<")
|
138
161
|
output_single(fault.inspected_expected, color("pass"))
|
139
|
-
|
162
|
+
output_single(">")
|
163
|
+
if need_encoding
|
164
|
+
output_single("(")
|
165
|
+
output_single(fault.expected.encoding.name, color("pass"))
|
166
|
+
output_single(")")
|
167
|
+
end
|
168
|
+
output(" expected but was")
|
140
169
|
output_single("<")
|
141
170
|
output_single(fault.inspected_actual, color("failure"))
|
142
|
-
|
171
|
+
output_single(">")
|
172
|
+
if need_encoding
|
173
|
+
output_single("(")
|
174
|
+
output_single(fault.actual.encoding.name, color("failure"))
|
175
|
+
output_single(")")
|
176
|
+
end
|
177
|
+
output("")
|
143
178
|
from, to = prepare_for_diff(fault.expected, fault.actual)
|
144
179
|
if from and to
|
145
|
-
|
146
|
-
|
147
|
-
|
180
|
+
from_lines = from.split(/\r?\n/)
|
181
|
+
to_lines = to.split(/\r?\n/)
|
182
|
+
if need_encoding
|
183
|
+
from_lines << ""
|
184
|
+
to_lines << ""
|
185
|
+
from_lines << "Encoding: #{fault.expected.encoding.name}"
|
186
|
+
to_lines << "Encoding: #{fault.actual.encoding.name}"
|
187
|
+
end
|
188
|
+
differ = ColorizedReadableDiffer.new(from_lines, to_lines, self)
|
148
189
|
if differ.need_diff?
|
149
190
|
output("")
|
150
191
|
output("diff:")
|
@@ -157,10 +198,10 @@ module Test
|
|
157
198
|
fault.long_display
|
158
199
|
end
|
159
200
|
|
160
|
-
def test_started(
|
201
|
+
def test_started(test)
|
161
202
|
return unless output?(VERBOSE)
|
162
203
|
|
163
|
-
name = name.sub(/\(.+?\)\z/, '')
|
204
|
+
name = test.name.sub(/\(.+?\)\z/, '')
|
164
205
|
right_space = 8 * 2
|
165
206
|
left_space = @progress_row_max - right_space
|
166
207
|
left_space = left_space - indent.size - name.size
|
@@ -169,7 +210,7 @@ module Test
|
|
169
210
|
@test_start = Time.now
|
170
211
|
end
|
171
212
|
|
172
|
-
def test_finished(
|
213
|
+
def test_finished(test)
|
173
214
|
unless @already_outputted
|
174
215
|
output_progress(".", color("pass"))
|
175
216
|
end
|
@@ -180,24 +221,24 @@ module Test
|
|
180
221
|
output(": (%f)" % (Time.now - @test_start), nil, VERBOSE)
|
181
222
|
end
|
182
223
|
|
183
|
-
def test_suite_started(
|
224
|
+
def test_suite_started(suite)
|
184
225
|
if @top_level
|
185
226
|
@top_level = false
|
186
227
|
return
|
187
228
|
end
|
188
229
|
|
189
230
|
output_single(indent, nil, VERBOSE)
|
190
|
-
if
|
191
|
-
_color = color("case")
|
192
|
-
else
|
231
|
+
if suite.test_case.nil?
|
193
232
|
_color = color("suite")
|
233
|
+
else
|
234
|
+
_color = color("case")
|
194
235
|
end
|
195
|
-
output_single(name, _color, VERBOSE)
|
236
|
+
output_single(suite.name, _color, VERBOSE)
|
196
237
|
output(": ", nil, VERBOSE)
|
197
238
|
@indent += 2
|
198
239
|
end
|
199
240
|
|
200
|
-
def test_suite_finished(
|
241
|
+
def test_suite_finished(suite)
|
201
242
|
@indent -= 2
|
202
243
|
end
|
203
244
|
|
@@ -286,7 +327,7 @@ module Test
|
|
286
327
|
end
|
287
328
|
|
288
329
|
def guess_term_width
|
289
|
-
Integer(ENV["TERM_WIDTH"] || 0)
|
330
|
+
Integer(ENV["COLUMNS"] || ENV["TERM_WIDTH"] || 0)
|
290
331
|
rescue ArgumentError
|
291
332
|
0
|
292
333
|
end
|
@@ -424,7 +465,3 @@ module Test
|
|
424
465
|
end
|
425
466
|
end
|
426
467
|
end
|
427
|
-
|
428
|
-
if __FILE__ == $0
|
429
|
-
Test::Unit::UI::Console::TestRunner.start_command_line_test
|
430
|
-
end
|