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.
Files changed (70) hide show
  1. data/ChangeLog +68 -0
  2. data/ext/glib2/rbglib.c +51 -15
  3. data/ext/glib2/rbglib.h +10 -2
  4. data/ext/glib2/rbglib_bookmarkfile.c +37 -74
  5. data/ext/glib2/rbglib_completion.c +8 -16
  6. data/ext/glib2/rbglib_convert.c +8 -18
  7. data/ext/glib2/rbglib_error.c +2 -8
  8. data/ext/glib2/rbglib_i18n.c +1 -2
  9. data/ext/glib2/rbglib_iochannel.c +81 -127
  10. data/ext/glib2/rbglib_keyfile.c +38 -86
  11. data/ext/glib2/rbglib_maincontext.c +29 -64
  12. data/ext/glib2/rbglib_mainloop.c +4 -8
  13. data/ext/glib2/rbglib_messages.c +7 -17
  14. data/ext/glib2/rbglib_pollfd.c +7 -14
  15. data/ext/glib2/rbglib_shell.c +3 -6
  16. data/ext/glib2/rbglib_source.c +14 -28
  17. data/ext/glib2/rbglib_spawn.c +7 -14
  18. data/ext/glib2/rbglib_threads.c +2 -4
  19. data/ext/glib2/rbglib_timer.c +7 -14
  20. data/ext/glib2/rbglib_unicode.c +45 -16
  21. data/ext/glib2/rbglib_utils.c +25 -50
  22. data/ext/glib2/rbglib_win32.c +10 -17
  23. data/ext/glib2/rbgobj_boxed.c +9 -21
  24. data/ext/glib2/rbgobj_closure.c +5 -11
  25. data/ext/glib2/rbgobj_enums.c +1 -2
  26. data/ext/glib2/rbgobj_object.c +23 -59
  27. data/ext/glib2/rbgobj_param.c +7 -15
  28. data/ext/glib2/rbgobj_signal.c +25 -65
  29. data/ext/glib2/rbgobj_type.c +36 -81
  30. data/ext/glib2/rbgobj_typeinstance.c +3 -6
  31. data/ext/glib2/rbgobj_typeinterface.c +3 -6
  32. data/ext/glib2/rbgobj_typemodule.c +4 -8
  33. data/ext/glib2/rbgobj_typeplugin.c +2 -4
  34. data/ext/glib2/rbgobj_valuetypes.c +7 -15
  35. data/ext/glib2/rbgobject.c +8 -18
  36. data/ext/glib2/rbgobject.h +3 -0
  37. data/ext/glib2/rbgprivate.h +0 -1
  38. data/ext/glib2/rbgutil.c +3 -6
  39. data/lib/1.8/glib2.so +0 -0
  40. data/lib/1.9/glib2.so +0 -0
  41. data/lib/gnome2-raketask.rb +1 -0
  42. data/lib/mkmf-gnome2.rb +12 -9
  43. data/test-unit/History.txt +43 -1
  44. data/test-unit/Manifest.txt +1 -1
  45. data/test-unit/html/index.html +62 -24
  46. data/test-unit/html/index.html.ja +54 -25
  47. data/test-unit/html/test-unit.css +3 -3
  48. data/test-unit/lib/test/unit/assertions.rb +489 -36
  49. data/test-unit/lib/test/unit/autorunner.rb +40 -0
  50. data/test-unit/lib/test/unit/collector.rb +6 -4
  51. data/test-unit/lib/test/unit/collector/load.rb +48 -5
  52. data/test-unit/lib/test/unit/collector/xml.rb +250 -0
  53. data/test-unit/lib/test/unit/error.rb +4 -3
  54. data/test-unit/lib/test/unit/fixture.rb +12 -3
  55. data/test-unit/lib/test/unit/runner/xml.rb +15 -0
  56. data/test-unit/lib/test/unit/testcase.rb +48 -16
  57. data/test-unit/lib/test/unit/testresult.rb +6 -2
  58. data/test-unit/lib/test/unit/testsuite.rb +24 -2
  59. data/test-unit/lib/test/unit/ui/console/testrunner.rb +65 -28
  60. data/test-unit/lib/test/unit/ui/testrunnermediator.rb +11 -2
  61. data/test-unit/lib/test/unit/ui/xml/testrunner.rb +224 -0
  62. data/test-unit/lib/test/unit/version.rb +1 -1
  63. data/test-unit/test/run-test.rb +7 -0
  64. data/test-unit/test/{test_assertions.rb → test-assertions.rb} +708 -77
  65. data/test-unit/test/test-fixture.rb +37 -0
  66. data/test-unit/test/test-testcase.rb +24 -7
  67. data/test-unit/test/test_testsuite.rb +19 -11
  68. data/test/test_iochannel.rb +9 -9
  69. data/test/test_unicode.rb +44 -31
  70. metadata +8 -5
@@ -83,6 +83,14 @@ module Test
83
83
  collector.collect(*auto_runner.to_run)
84
84
  end
85
85
 
86
+ # JUST TEST!
87
+ # register_collector(:xml) do |auto_runner|
88
+ # require 'test/unit/collector/xml'
89
+ # collector = Collector::XML.new
90
+ # collector.filter = auto_runner.filters
91
+ # collector.collect(auto_runner.to_run[0])
92
+ # end
93
+
86
94
  # deprecated
87
95
  register_collector(:object_space) do |auto_runner|
88
96
  require 'test/unit/collector/objectspace'
@@ -159,6 +167,13 @@ module Test
159
167
  @runner = r
160
168
  end
161
169
 
170
+ o.on
171
+ o.on('--collector=COLLECTOR', COLLECTORS,
172
+ "Use the given COLLECTOR.",
173
+ "(" + keyword_display(COLLECTORS) + ")") do |collector|
174
+ @collector = collector
175
+ end
176
+
162
177
  if (@standalone)
163
178
  o.on('-b', '--basedir=DIR', "Base directory of test suites.") do |b|
164
179
  @base = b
@@ -199,6 +214,18 @@ module Test
199
214
  end
200
215
  end
201
216
 
217
+ o.on('--ignore-name=NAME', String,
218
+ "Ignores tests matching NAME.",
219
+ "(patterns may be used).") do |n|
220
+ n = (%r{\A/(.*)/\Z} =~ n ? Regexp.new($1) : n)
221
+ case n
222
+ when Regexp
223
+ @filters << proc {|t| n =~ t.method_name ? false : true}
224
+ else
225
+ @filters << proc {|t| n != t.method_name}
226
+ end
227
+ end
228
+
202
229
  o.on('-t', '--testcase=TESTCASE', String,
203
230
  "Runs tests in TestCases matching TESTCASE.",
204
231
  "(patterns may be used).") do |n|
@@ -211,6 +238,18 @@ module Test
211
238
  end
212
239
  end
213
240
 
241
+ o.on('--ignore-testcase=TESTCASE', String,
242
+ "Ignores tests in TestCases matching TESTCASE.",
243
+ "(patterns may be used).") do |n|
244
+ n = (%r{\A/(.*)/\Z} =~ n ? Regexp.new($1) : n)
245
+ case n
246
+ when Regexp
247
+ @filters << proc {|t| n =~ t.class.name ? false : true}
248
+ else
249
+ @filters << proc {|t| n != t.class.name}
250
+ end
251
+ end
252
+
214
253
  priority_filter = Proc.new do |test|
215
254
  if @filters == [priority_filter]
216
255
  Priority::Checker.new(test).need_to_run?
@@ -373,3 +412,4 @@ end
373
412
  require 'test/unit/runner/console'
374
413
  require 'test/unit/runner/emacs'
375
414
  require 'test/unit/runner/tap'
415
+ require 'test/unit/runner/xml'
@@ -15,9 +15,9 @@ module Test
15
15
  end
16
16
 
17
17
  def add_suite(destination, suite)
18
- to_delete = suite.tests.find_all{|t| !include?(t)}
19
- to_delete.each{|t| suite.delete(t)}
20
- destination << suite unless(suite.size == 0)
18
+ to_delete = suite.tests.find_all {|t| !include?(t)}
19
+ to_delete.each {|t| suite.delete(t)}
20
+ destination << suite unless suite.empty?
21
21
  end
22
22
 
23
23
  def include?(test)
@@ -29,7 +29,9 @@ module Test
29
29
  end
30
30
 
31
31
  def sort(suites)
32
- suites.sort_by {|suite| suite.name || suite.to_s}
32
+ suites.sort_by do |suite|
33
+ [suite.priority, suite.name || suite.to_s]
34
+ end
33
35
  end
34
36
  end
35
37
  end
@@ -18,6 +18,7 @@ module Test
18
18
  @patterns = [/\Atest[_\-].+\.rb\z/m, /[_\-]test\.rb\z/]
19
19
  @excludes = []
20
20
  @base = nil
21
+ @require_failed_infos = []
21
22
  end
22
23
 
23
24
  def base=(base)
@@ -39,16 +40,18 @@ module Test
39
40
  collect_file(from, test_suites, already_gathered)
40
41
  end
41
42
  end
43
+ add_require_failed_test_suite(test_suites)
42
44
 
43
45
  if test_suites.size > 1
44
46
  test_suite = TestSuite.new("[#{froms.join(', ')}]")
45
47
  sort(test_suites).each do |sub_test_suite|
46
48
  test_suite << sub_test_suite
47
49
  end
48
- test_suite
49
50
  else
50
- test_suites.first
51
+ test_suite = test_suites.first
51
52
  end
53
+
54
+ test_suite
52
55
  end
53
56
  end
54
57
 
@@ -95,9 +98,14 @@ module Test
95
98
 
96
99
  def collect_file(path, test_suites, already_gathered)
97
100
  @program_file ||= File.expand_path($0)
98
- return if @program_file == path.expand_path.to_s
99
- add_load_path(path.expand_path.dirname) do
100
- require(path.to_s)
101
+ expanded_path = path.expand_path
102
+ return if @program_file == expanded_path.to_s
103
+ add_load_path(expanded_path.dirname) do
104
+ begin
105
+ require(path.to_s)
106
+ rescue LoadError
107
+ @require_failed_infos << {:path => expanded_path, :exception => $!}
108
+ end
101
109
  find_test_cases(already_gathered).each do |test_case|
102
110
  add_suite(test_suites, test_case.suite)
103
111
  end
@@ -138,6 +146,41 @@ module Test
138
146
 
139
147
  false
140
148
  end
149
+
150
+ def add_require_failed_test_suite(test_suites)
151
+ return if @require_failed_infos.empty?
152
+
153
+ require_failed_infos = @require_failed_infos
154
+ require_failed_omissions = Class.new(Test::Unit::TestCase)
155
+ require_failed_omissions.class_eval do
156
+ class << self
157
+ def name
158
+ "RequireFailedOmissions"
159
+ end
160
+ end
161
+
162
+ require_failed_infos.each do |info|
163
+ path = info[:path]
164
+ normalized_path = path.to_s.gsub(/[^a-z0-9\_]+/i, '_')
165
+ normalized_path = normalized_path.gsub(/\A_+/, '')
166
+ exception = info[:exception]
167
+ define_method("test_require_#{normalized_path}") do
168
+ @require_failed_exception = exception
169
+ omit("failed to load: <#{path}>: <#{exception.message}>")
170
+ end
171
+ end
172
+
173
+ def priority
174
+ 100
175
+ end
176
+
177
+ def filter_backtrace(location)
178
+ super(@require_failed_exception.backtrace)
179
+ end
180
+ end
181
+
182
+ add_suite(test_suites, require_failed_omissions.suite)
183
+ end
141
184
  end
142
185
  end
143
186
  end
@@ -0,0 +1,250 @@
1
+ #--
2
+ #
3
+ # Author:: Kouhei Sutou
4
+ # Copyright::
5
+ # * Copyright (c) 2011 Kouhei Sutou <kou@clear-code.com>
6
+ # License:: Ruby license.
7
+
8
+ # just test!!! don't use it yet!!!
9
+
10
+ require 'test/unit/collector'
11
+
12
+ require 'rexml/document'
13
+ require 'rexml/streamlistener'
14
+
15
+ module Test
16
+ module Unit
17
+ module Collector
18
+ class XML
19
+ include Collector
20
+
21
+ def collect(xml_log_path)
22
+ listener = Listener.new
23
+ File.open(xml_log_path) do |xml_log|
24
+ parser = REXML::Parsers::StreamParser.new(xml_log, listener)
25
+ parser.parse
26
+ end
27
+ suite = TestSuite.new("tests in #{xml_log_path}")
28
+ suites = listener.test_suites
29
+ sort(suites).each {|s| add_suite(suite, s)}
30
+ suite
31
+ end
32
+
33
+ class Listener
34
+ include REXML::StreamListener
35
+
36
+ attr_reader :test_suites
37
+ def initialize
38
+ @ns_stack = [{"xml" => :xml}]
39
+ @tag_stack = [["", :root]]
40
+ @text_stack = ['']
41
+ @state_stack = [:root]
42
+ @values = {}
43
+ @test_suites = []
44
+ end
45
+
46
+ def tag_start(name, attributes)
47
+ @text_stack.push('')
48
+
49
+ ns = @ns_stack.last.dup
50
+ attrs = {}
51
+ attributes.each do |n, v|
52
+ if /\Axmlns(?:\z|:)/ =~ n
53
+ ns[$POSTMATCH] = v
54
+ else
55
+ attrs[n] = v
56
+ end
57
+ end
58
+ @ns_stack.push(ns)
59
+
60
+ _parent_tag = parent_tag
61
+ prefix, local = split_name(name)
62
+ uri = _ns(ns, prefix)
63
+ @tag_stack.push([uri, local])
64
+
65
+ state = next_state(@state_stack.last, uri, local)
66
+ @state_stack.push(state)
67
+ case state
68
+ when :test_suite, :test_case
69
+ @values = {}
70
+ when :test
71
+ @values = {}
72
+ @n_pass_assertions = 0 if _parent_tag == "start-test"
73
+ when :backtrace
74
+ @backtrace = []
75
+ @values_backup = @values
76
+ @values = {}
77
+ end
78
+ end
79
+
80
+ def tag_end(name)
81
+ state = @state_stack.pop
82
+ text = @text_stack.pop
83
+ uri, local = @tag_stack.pop
84
+ no_action_states = [:root, :stream]
85
+ case state
86
+ when *no_action_states
87
+ # do nothing
88
+ when :test_suite
89
+ test_suite_end
90
+ when :complete_test_case
91
+ @test_suites.last << @test_case.suite
92
+ when :test_case
93
+ test_case_end
94
+ when :result
95
+ @result = @values
96
+ when :test
97
+ test_end
98
+ when :pass_assertion
99
+ @n_pass_assertions += 1
100
+ when :backtrace
101
+ @values = @values_backup
102
+ @values["backtrace"] = @backtrace
103
+ when :entry
104
+ file = @values['file']
105
+ line = @values['line']
106
+ info = @values['info']
107
+ @backtrace << "#{file}:#{line}: #{info}"
108
+ @values = {}
109
+ else
110
+ local = normalize_local(local)
111
+ @values[local] = text
112
+ end
113
+ @ns_stack.pop
114
+ end
115
+
116
+ def text(data)
117
+ @text_stack.last << data
118
+ end
119
+
120
+ private
121
+ def _ns(ns, prefix)
122
+ ns.fetch(prefix, "")
123
+ end
124
+
125
+ NAME_SPLIT = /^(?:([\w:][-\w\d.]*):)?([\w:][-\w\d.]*)/
126
+ def split_name(name)
127
+ name =~ NAME_SPLIT
128
+ [$1 || '', $2]
129
+ end
130
+
131
+ STATE_TABLE = {
132
+ :root => [:stream],
133
+ :stream => [:ready_test_suite,
134
+ :start_test_suite,
135
+ :ready_test_case,
136
+ :start_test_case,
137
+ :start_test,
138
+ :pass_assertion,
139
+ :test_result,
140
+ :complete_test,
141
+ :complete_test_case,
142
+ :complete_test_suite,
143
+ :success],
144
+ :ready_test_suite => [:n_tests],
145
+ :start_test_suite => [:test_suite],
146
+ :ready_test_case => [:test_case,
147
+ :n_tests],
148
+ :start_test_case => [:test_case],
149
+ :start_test => [:test],
150
+ :pass_assertion => [:test],
151
+ :complete_test => [:test, :success],
152
+ :complete_test_case => [:test_case,
153
+ :elapsed,
154
+ :success],
155
+ :complete_test_suite => [:test_suite,
156
+ :success],
157
+ :test_suite => [:start_time,
158
+ :elapsed],
159
+ :test_case => [:name,
160
+ :start_time,
161
+ :elapsed],
162
+ :test => [:name,
163
+ :start_time,
164
+ :elapsed],
165
+ :test_result => [:test,
166
+ :result],
167
+ :result => [:test_case,
168
+ :test,
169
+ :status,
170
+ :backtrace,
171
+ :detail],
172
+ :backtrace => [:entry],
173
+ :entry => [:file,
174
+ :line,
175
+ :info],
176
+ }
177
+ def next_state(current_state, uri, local)
178
+ local = normalize_local(local)
179
+ valid_elements = STATE_TABLE[current_state]
180
+ if valid_elements.nil?
181
+ raise "unexpected element: #{current_path}"
182
+ end
183
+ next_state = local.to_sym
184
+ unless valid_elements.include?(next_state)
185
+ raise "unexpected element: #{current_path}"
186
+ end
187
+ next_state
188
+ end
189
+
190
+ def current_path
191
+ locals = @tag_stack.collect do |uri, local|
192
+ local
193
+ end
194
+ ["", *locals].join("/")
195
+ end
196
+
197
+ def normalize_local(local)
198
+ local.gsub(/-/, "_")
199
+ end
200
+
201
+ def parent_tag
202
+ @tag_stack.last[1]
203
+ end
204
+
205
+ def test_suite_end
206
+ return unless parent_tag == "start-test-suite"
207
+ suite = TestSuite.new
208
+ ["start_time", "elapsed_time", "n_tests"].each do |key|
209
+ if @values.has_key?(key)
210
+ suite.instance_variable_set("@#{key}", @values[key])
211
+ end
212
+ end
213
+ @test_suites << suite
214
+ end
215
+
216
+ def test_case_end
217
+ return unless parent_tag == "start-test-case"
218
+ name = @values["name"]
219
+ @test_case = Class.new(TestCase) do
220
+ define_method(:name) do
221
+ name
222
+ end
223
+ end
224
+ end
225
+
226
+ def test_end
227
+ return unless parent_tag == "complete-test"
228
+ name = @values["name"]
229
+ n_pass_assertions = @n_pass_assertions
230
+ result = @result
231
+ @test_case.module_eval do
232
+ test
233
+ define_method(name) do
234
+ n_pass_assertions.times do
235
+ add_assertion
236
+ end
237
+ case result["status"]
238
+ when "omission"
239
+ add_omission(Omission.new(name,
240
+ result["backtrace"],
241
+ result["detail"]))
242
+ end
243
+ end
244
+ end
245
+ end
246
+ end
247
+ end
248
+ end
249
+ end
250
+ end
@@ -48,13 +48,14 @@ module Test
48
48
 
49
49
  # Returns a verbose version of the error description.
50
50
  def long_display
51
- backtrace_display = backtrace.join("\n ")
51
+ backtrace_display = location.join("\n ")
52
52
  "#{label}:\n#@test_name:\n#{message}\n #{backtrace_display}"
53
53
  end
54
54
 
55
- def backtrace
56
- filter_backtrace(@exception.backtrace)
55
+ def location
56
+ @location ||= filter_backtrace(@exception.backtrace)
57
57
  end
58
+ alias_method :backtrace, :location # Deprecated
58
59
 
59
60
  # Overridden to return long_display.
60
61
  def to_s