rice 1.4.3 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/COPYING +2 -2
- data/Doxyfile +1 -1
- data/Makefile.in +296 -166
- data/README +18 -13
- data/Rakefile +3 -2
- data/aclocal.m4 +375 -248
- data/config.guess +296 -261
- data/config.sub +268 -94
- data/configure +2789 -3054
- data/configure.ac +1 -1
- data/depcomp +403 -197
- data/extconf.rb +14 -3
- data/install-sh +139 -119
- data/missing +154 -306
- data/rice/Builtin_Object_defn.hpp +0 -1
- data/rice/Constructor.hpp +31 -30
- data/rice/Data_Object_defn.hpp +8 -2
- data/rice/Hash.hpp +26 -9
- data/rice/Hash.ipp +52 -60
- data/rice/Makefile.am +0 -1
- data/rice/Makefile.in +278 -152
- data/rice/Module_impl.ipp +1 -1
- data/rice/VM.cpp +1 -11
- data/rice/config.hpp +3 -0
- data/rice/config.hpp.in +3 -0
- data/rice/detail/Auto_Function_Wrapper.hpp +69 -0
- data/rice/detail/Auto_Function_Wrapper.ipp +815 -512
- data/rice/detail/Auto_Member_Function_Wrapper.hpp +69 -0
- data/rice/detail/Auto_Member_Function_Wrapper.ipp +543 -272
- data/rice/detail/object_call.hpp +1 -0
- data/rice/detail/ruby.hpp +0 -9
- data/rice/detail/ruby_version_code.hpp +1 -1
- data/rice/detail/st.hpp +0 -38
- data/rice/protect.hpp +1 -0
- data/rice/protect.ipp +1 -0
- data/rice/to_from_ruby.ipp +1 -1
- data/ruby.ac +2 -2
- data/ruby/Makefile.in +221 -134
- data/ruby/lib/Makefile.in +133 -44
- data/ruby/lib/mkmf-rice.rb.in +1 -4
- data/ruby/lib/version.rb +1 -1
- data/sample/Makefile.in +96 -31
- data/test/Makefile.am +0 -1
- data/test/Makefile.in +617 -219
- data/test/ext/Makefile.in +96 -31
- data/test/test_Class.cpp +2 -2
- data/test/test_Data_Object.cpp +11 -11
- data/test/test_Hash.cpp +7 -4
- data/test/test_Module.cpp +17 -1
- data/test/test_To_From_Ruby.cpp +44 -0
- data/test/test_rice.rb +2 -2
- metadata +29 -43
- data/rice/Allocation_Strategies.hpp +0 -37
- data/test/test_Allocation_Strategies.cpp +0 -77
data/test/ext/Makefile.in
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
# Makefile.in generated by automake 1.
|
1
|
+
# Makefile.in generated by automake 1.13.1 from Makefile.am.
|
2
2
|
# @configure_input@
|
3
3
|
|
4
|
-
# Copyright (C) 1994
|
5
|
-
|
4
|
+
# Copyright (C) 1994-2012 Free Software Foundation, Inc.
|
5
|
+
|
6
6
|
# This Makefile.in is free software; the Free Software Foundation
|
7
7
|
# gives unlimited permission to copy and/or distribute it,
|
8
8
|
# with or without modifications, as long as this notice is preserved.
|
@@ -14,9 +14,27 @@
|
|
14
14
|
|
15
15
|
@SET_MAKE@
|
16
16
|
VPATH = @srcdir@
|
17
|
+
am__make_dryrun = \
|
18
|
+
{ \
|
19
|
+
am__dry=no; \
|
20
|
+
case $$MAKEFLAGS in \
|
21
|
+
*\\[\ \ ]*) \
|
22
|
+
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
|
23
|
+
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
|
24
|
+
*) \
|
25
|
+
for am__flg in $$MAKEFLAGS; do \
|
26
|
+
case $$am__flg in \
|
27
|
+
*=*|--*) ;; \
|
28
|
+
*n*) am__dry=yes; break;; \
|
29
|
+
esac; \
|
30
|
+
done;; \
|
31
|
+
esac; \
|
32
|
+
test $$am__dry = yes; \
|
33
|
+
}
|
17
34
|
pkgdatadir = $(datadir)/@PACKAGE@
|
18
|
-
pkglibdir = $(libdir)/@PACKAGE@
|
19
35
|
pkgincludedir = $(includedir)/@PACKAGE@
|
36
|
+
pkglibdir = $(libdir)/@PACKAGE@
|
37
|
+
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
20
38
|
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
21
39
|
install_sh_DATA = $(install_sh) -c -m 644
|
22
40
|
install_sh_PROGRAM = $(install_sh) -c
|
@@ -32,7 +50,7 @@ POST_UNINSTALL = :
|
|
32
50
|
build_triplet = @build@
|
33
51
|
host_triplet = @host@
|
34
52
|
subdir = test/ext
|
35
|
-
DIST_COMMON = $(srcdir)/Makefile.
|
53
|
+
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
|
36
54
|
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
37
55
|
am__aclocal_m4_deps = $(top_srcdir)/ruby.ac $(top_srcdir)/doxygen.ac \
|
38
56
|
$(top_srcdir)/configure.ac
|
@@ -41,11 +59,31 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
|
41
59
|
mkinstalldirs = $(install_sh) -d
|
42
60
|
CONFIG_HEADER = $(top_builddir)/rice/config.hpp
|
43
61
|
CONFIG_CLEAN_FILES =
|
62
|
+
CONFIG_CLEAN_VPATH_FILES =
|
63
|
+
AM_V_P = $(am__v_P_@AM_V@)
|
64
|
+
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
65
|
+
am__v_P_0 = false
|
66
|
+
am__v_P_1 = :
|
67
|
+
AM_V_GEN = $(am__v_GEN_@AM_V@)
|
68
|
+
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
|
69
|
+
am__v_GEN_0 = @echo " GEN " $@;
|
70
|
+
am__v_GEN_1 =
|
71
|
+
AM_V_at = $(am__v_at_@AM_V@)
|
72
|
+
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
|
73
|
+
am__v_at_0 = @
|
74
|
+
am__v_at_1 =
|
44
75
|
SOURCES =
|
45
76
|
DIST_SOURCES =
|
77
|
+
am__can_run_installinfo = \
|
78
|
+
case $$AM_UPDATE_INFO_DIR in \
|
79
|
+
n|no|NO) false;; \
|
80
|
+
*) (install-info --version) >/dev/null 2>&1;; \
|
81
|
+
esac
|
82
|
+
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
46
83
|
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
47
84
|
ACLOCAL = @ACLOCAL@
|
48
85
|
AMTAR = @AMTAR@
|
86
|
+
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
49
87
|
AUTOCONF = @AUTOCONF@
|
50
88
|
AUTOHEADER = @AUTOHEADER@
|
51
89
|
AUTOMAKE = @AUTOMAKE@
|
@@ -102,6 +140,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
|
102
140
|
PACKAGE_NAME = @PACKAGE_NAME@
|
103
141
|
PACKAGE_STRING = @PACKAGE_STRING@
|
104
142
|
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
143
|
+
PACKAGE_URL = @PACKAGE_URL@
|
105
144
|
PACKAGE_VERSION = @PACKAGE_VERSION@
|
106
145
|
PATH_SEPARATOR = @PATH_SEPARATOR@
|
107
146
|
RANLIB = @RANLIB@
|
@@ -171,6 +210,7 @@ sharedstatedir = @sharedstatedir@
|
|
171
210
|
srcdir = @srcdir@
|
172
211
|
sysconfdir = @sysconfdir@
|
173
212
|
target_alias = @target_alias@
|
213
|
+
top_build_prefix = @top_build_prefix@
|
174
214
|
top_builddir = @top_builddir@
|
175
215
|
top_srcdir = @top_srcdir@
|
176
216
|
RUBY_EXTCONF_OPTIONS = -I@RICE_ROOT@/ruby/lib
|
@@ -188,14 +228,14 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
|
188
228
|
@for dep in $?; do \
|
189
229
|
case '$(am__configure_deps)' in \
|
190
230
|
*$$dep*) \
|
191
|
-
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
|
192
|
-
|
231
|
+
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
232
|
+
&& { if test -f $@; then exit 0; else break; fi; }; \
|
193
233
|
exit 1;; \
|
194
234
|
esac; \
|
195
235
|
done; \
|
196
|
-
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu
|
197
|
-
|
198
|
-
$(AUTOMAKE) --gnu
|
236
|
+
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu test/ext/Makefile'; \
|
237
|
+
$(am__cd) $(top_srcdir) && \
|
238
|
+
$(AUTOMAKE) --gnu test/ext/Makefile
|
199
239
|
.PRECIOUS: Makefile
|
200
240
|
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
201
241
|
@case '$?' in \
|
@@ -213,11 +253,12 @@ $(top_srcdir)/configure: $(am__configure_deps)
|
|
213
253
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
214
254
|
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
215
255
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
216
|
-
|
217
|
-
TAGS:
|
256
|
+
$(am__aclocal_m4_deps):
|
257
|
+
tags TAGS:
|
218
258
|
|
219
|
-
ctags
|
220
|
-
|
259
|
+
ctags CTAGS:
|
260
|
+
|
261
|
+
cscope cscopelist:
|
221
262
|
|
222
263
|
|
223
264
|
distdir: $(DISTFILES)
|
@@ -236,13 +277,17 @@ distdir: $(DISTFILES)
|
|
236
277
|
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
237
278
|
if test -d $$d/$$file; then \
|
238
279
|
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
280
|
+
if test -d "$(distdir)/$$file"; then \
|
281
|
+
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
282
|
+
fi; \
|
239
283
|
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
240
|
-
cp -
|
284
|
+
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
285
|
+
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
241
286
|
fi; \
|
242
|
-
cp -
|
287
|
+
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
243
288
|
else \
|
244
|
-
test -f "$(distdir)
|
245
|
-
|| cp -p $$d/$$file "$(distdir)
|
289
|
+
test -f "$(distdir)/$$file" \
|
290
|
+
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
246
291
|
|| exit 1; \
|
247
292
|
fi; \
|
248
293
|
done
|
@@ -260,16 +305,22 @@ install-am: all-am
|
|
260
305
|
|
261
306
|
installcheck: installcheck-am
|
262
307
|
install-strip:
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
308
|
+
if test -z '$(STRIP)'; then \
|
309
|
+
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
310
|
+
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
311
|
+
install; \
|
312
|
+
else \
|
313
|
+
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
314
|
+
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
315
|
+
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
316
|
+
fi
|
267
317
|
mostlyclean-generic:
|
268
318
|
|
269
319
|
clean-generic:
|
270
320
|
|
271
321
|
distclean-generic:
|
272
322
|
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
323
|
+
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
273
324
|
|
274
325
|
maintainer-clean-generic:
|
275
326
|
@echo "This command is intended for maintainers to use"
|
@@ -284,6 +335,8 @@ dvi-am:
|
|
284
335
|
|
285
336
|
html: html-am
|
286
337
|
|
338
|
+
html-am:
|
339
|
+
|
287
340
|
info: info-am
|
288
341
|
|
289
342
|
info-am:
|
@@ -292,18 +345,28 @@ install-data-am:
|
|
292
345
|
|
293
346
|
install-dvi: install-dvi-am
|
294
347
|
|
348
|
+
install-dvi-am:
|
349
|
+
|
295
350
|
install-exec-am:
|
296
351
|
|
297
352
|
install-html: install-html-am
|
298
353
|
|
354
|
+
install-html-am:
|
355
|
+
|
299
356
|
install-info: install-info-am
|
300
357
|
|
358
|
+
install-info-am:
|
359
|
+
|
301
360
|
install-man:
|
302
361
|
|
303
362
|
install-pdf: install-pdf-am
|
304
363
|
|
364
|
+
install-pdf-am:
|
365
|
+
|
305
366
|
install-ps: install-ps-am
|
306
367
|
|
368
|
+
install-ps-am:
|
369
|
+
|
307
370
|
installcheck-am:
|
308
371
|
|
309
372
|
maintainer-clean: maintainer-clean-am
|
@@ -326,15 +389,16 @@ uninstall-am:
|
|
326
389
|
|
327
390
|
.MAKE: install-am install-strip
|
328
391
|
|
329
|
-
.PHONY: all all-am check check-am clean clean-generic
|
330
|
-
distclean-generic distdir dvi dvi-am html
|
331
|
-
|
332
|
-
install-
|
333
|
-
install-
|
334
|
-
install-
|
335
|
-
install-
|
336
|
-
|
337
|
-
|
392
|
+
.PHONY: all all-am check check-am clean clean-generic cscopelist-am \
|
393
|
+
ctags-am distclean distclean-generic distdir dvi dvi-am html \
|
394
|
+
html-am info info-am install install-am install-data \
|
395
|
+
install-data-am install-dvi install-dvi-am install-exec \
|
396
|
+
install-exec-am install-html install-html-am install-info \
|
397
|
+
install-info-am install-man install-pdf install-pdf-am \
|
398
|
+
install-ps install-ps-am install-strip installcheck \
|
399
|
+
installcheck-am installdirs maintainer-clean \
|
400
|
+
maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
|
401
|
+
pdf-am ps ps-am tags-am uninstall uninstall-am
|
338
402
|
|
339
403
|
|
340
404
|
all:
|
@@ -370,6 +434,7 @@ t1_distclean:
|
|
370
434
|
|
371
435
|
t2_distclean:
|
372
436
|
make -C t2 distclean
|
437
|
+
|
373
438
|
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
374
439
|
# Otherwise a system limit (for SysV at least) may be exceeded.
|
375
440
|
.NOEXPORT:
|
data/test/test_Class.cpp
CHANGED
@@ -258,7 +258,7 @@ TESTCASE(define_method_int_foo)
|
|
258
258
|
define_method_int_result = 0;
|
259
259
|
Foo * foo = new Foo;
|
260
260
|
foo->x = 1024;
|
261
|
-
VALUE f = Data_Wrap_Struct(rb_cObject, 0,
|
261
|
+
VALUE f = Data_Wrap_Struct(rb_cObject, 0, Default_Free_Function<Foo>::free, foo);
|
262
262
|
o.call("foo", 42, Object(f));
|
263
263
|
ASSERT_EQUAL(42, define_method_int_foo_result_i);
|
264
264
|
ASSERT_EQUAL(foo, define_method_int_foo_result_x);
|
@@ -332,7 +332,7 @@ TESTCASE(define_iterator)
|
|
332
332
|
c.define_iterator(&Container::begin, &Container::end);
|
333
333
|
Container * container = new Container(array, 3);
|
334
334
|
Object wrapped_container = Data_Wrap_Struct(
|
335
|
-
c, 0,
|
335
|
+
c, 0, Default_Free_Function<Container>::free, container);
|
336
336
|
Array a = wrapped_container.instance_eval("a = []; each() { |x| a << x }; a");
|
337
337
|
ASSERT_EQUAL(3u, a.size());
|
338
338
|
ASSERT_EQUAL(to_ruby(1), Object(a[0]));
|
data/test/test_Data_Object.cpp
CHANGED
@@ -51,7 +51,7 @@ TESTCASE(construct_from_pointer_with_defaults)
|
|
51
51
|
expected_mark_func,
|
52
52
|
RDATA(wrapped_foo.value())->dmark);
|
53
53
|
ASSERT_EQUAL(
|
54
|
-
RUBY_DATA_FUNC(
|
54
|
+
RUBY_DATA_FUNC(Default_Free_Function<Foo>::free),
|
55
55
|
RUBY_DATA_FUNC(RDATA(wrapped_foo.value())->dfree));
|
56
56
|
ASSERT_EQUAL(foo, DATA_PTR(wrapped_foo.value()));
|
57
57
|
}
|
@@ -71,7 +71,7 @@ TESTCASE(construct_from_pointer_and_klass)
|
|
71
71
|
expected_mark_func,
|
72
72
|
RDATA(wrapped_foo.value())->dmark);
|
73
73
|
ASSERT_EQUAL(
|
74
|
-
RUBY_DATA_FUNC(
|
74
|
+
RUBY_DATA_FUNC(Default_Free_Function<Foo>::free),
|
75
75
|
RUBY_DATA_FUNC(RDATA(wrapped_foo.value())->dfree));
|
76
76
|
ASSERT_EQUAL(foo, DATA_PTR(wrapped_foo.value()));
|
77
77
|
}
|
@@ -91,7 +91,7 @@ TESTCASE(construct_from_pointer_and_alternate_klass)
|
|
91
91
|
expected_mark_func,
|
92
92
|
RDATA(wrapped_foo.value())->dmark);
|
93
93
|
ASSERT_EQUAL(
|
94
|
-
RUBY_DATA_FUNC(
|
94
|
+
RUBY_DATA_FUNC(Default_Free_Function<Foo>::free),
|
95
95
|
RUBY_DATA_FUNC(RDATA(wrapped_foo.value())->dfree));
|
96
96
|
ASSERT_EQUAL(foo, DATA_PTR(wrapped_foo.value()));
|
97
97
|
}
|
@@ -112,7 +112,7 @@ TESTCASE(construct_from_pointer_and_klass_and_mark_function)
|
|
112
112
|
ASSERT_EQUAL(Data_Type<Foo>::klass(), wrapped_foo.class_of());
|
113
113
|
ASSERT_EQUAL((void *)dummy_mark, RDATA(wrapped_foo.value())->dmark);
|
114
114
|
ASSERT_EQUAL(
|
115
|
-
RUBY_DATA_FUNC(
|
115
|
+
RUBY_DATA_FUNC(Default_Free_Function<Foo>::free),
|
116
116
|
RUBY_DATA_FUNC(RDATA(wrapped_foo.value())->dfree));
|
117
117
|
ASSERT_EQUAL(foo, DATA_PTR(wrapped_foo.value()));
|
118
118
|
}
|
@@ -142,14 +142,14 @@ TESTCASE(construct_from_pointer_and_klass_and_mark_and_free)
|
|
142
142
|
TESTCASE(construct_from_ruby_object)
|
143
143
|
{
|
144
144
|
Foo * foo = new Foo;
|
145
|
-
VALUE wrapped_foo = Data_Wrap_Struct(Data_Type<Foo>::klass(), 0,
|
145
|
+
VALUE wrapped_foo = Data_Wrap_Struct(Data_Type<Foo>::klass(), 0, Default_Free_Function<Foo>::free, foo);
|
146
146
|
Data_Object<Foo> data_object_foo(wrapped_foo);
|
147
147
|
ASSERT_EQUAL(foo, data_object_foo.get());
|
148
148
|
ASSERT_EQUAL(Data_Type<Foo>::klass(), data_object_foo.class_of());
|
149
149
|
ASSERT_EQUAL(RDATA(wrapped_foo), RDATA(data_object_foo.value()));
|
150
150
|
ASSERT_EQUAL(RUBY_DATA_FUNC(0), RDATA(data_object_foo.value())->dmark);
|
151
151
|
ASSERT_EQUAL(
|
152
|
-
RUBY_DATA_FUNC(
|
152
|
+
RUBY_DATA_FUNC(Default_Free_Function<Foo>::free),
|
153
153
|
RUBY_DATA_FUNC(RDATA(data_object_foo.value())->dfree));
|
154
154
|
ASSERT_EQUAL(foo, DATA_PTR(data_object_foo.value()));
|
155
155
|
}
|
@@ -158,14 +158,14 @@ TESTCASE(construct_from_ruby_object_and_class)
|
|
158
158
|
{
|
159
159
|
Data_Type<Foo> rb_cFoo;
|
160
160
|
Foo * foo = new Foo;
|
161
|
-
VALUE wrapped_foo = Data_Wrap_Struct(Data_Type<Foo>::klass(), 0,
|
161
|
+
VALUE wrapped_foo = Data_Wrap_Struct(Data_Type<Foo>::klass(), 0, Default_Free_Function<Foo>::free, foo);
|
162
162
|
Data_Object<Foo> data_object_foo(wrapped_foo, rb_cFoo);
|
163
163
|
ASSERT_EQUAL(foo, data_object_foo.get());
|
164
164
|
ASSERT_EQUAL(Data_Type<Foo>::klass(), data_object_foo.class_of());
|
165
165
|
ASSERT_EQUAL(RDATA(wrapped_foo), RDATA(data_object_foo.value()));
|
166
166
|
ASSERT_EQUAL(RUBY_DATA_FUNC(0), RDATA(data_object_foo.value())->dmark);
|
167
167
|
ASSERT_EQUAL(
|
168
|
-
RUBY_DATA_FUNC(
|
168
|
+
RUBY_DATA_FUNC(Default_Free_Function<Foo>::free),
|
169
169
|
RUBY_DATA_FUNC(RDATA(data_object_foo.value())->dfree));
|
170
170
|
ASSERT_EQUAL(foo, DATA_PTR(data_object_foo.value()));
|
171
171
|
}
|
@@ -174,7 +174,7 @@ TESTCASE(construct_from_ruby_object_and_wrong_class)
|
|
174
174
|
{
|
175
175
|
Foo * foo = new Foo;
|
176
176
|
Data_Type<Foo> rb_cFoo;
|
177
|
-
VALUE wrapped_foo = Data_Wrap_Struct(rb_cObject, 0,
|
177
|
+
VALUE wrapped_foo = Data_Wrap_Struct(rb_cObject, 0, Default_Free_Function<Foo>::free, foo);
|
178
178
|
ASSERT_EXCEPTION_CHECK(
|
179
179
|
Exception,
|
180
180
|
Data_Object<Foo> data_object_foo(wrapped_foo, rb_cFoo),
|
@@ -189,7 +189,7 @@ TESTCASE(copy_construct)
|
|
189
189
|
{
|
190
190
|
Data_Type<Foo> rb_cFoo;
|
191
191
|
Foo * foo = new Foo;
|
192
|
-
VALUE wrapped_foo = Data_Wrap_Struct(Data_Type<Foo>::klass(), 0,
|
192
|
+
VALUE wrapped_foo = Data_Wrap_Struct(Data_Type<Foo>::klass(), 0, Default_Free_Function<Foo>::free, foo);
|
193
193
|
Data_Object<Foo> orig_data_object_foo(wrapped_foo, rb_cFoo);
|
194
194
|
Data_Object<Foo> data_object_foo(orig_data_object_foo);
|
195
195
|
ASSERT_EQUAL(foo, data_object_foo.get());
|
@@ -197,7 +197,7 @@ TESTCASE(copy_construct)
|
|
197
197
|
ASSERT_EQUAL(RDATA(wrapped_foo), RDATA(data_object_foo.value()));
|
198
198
|
ASSERT_EQUAL(RUBY_DATA_FUNC(0), RDATA(data_object_foo.value())->dmark);
|
199
199
|
ASSERT_EQUAL(
|
200
|
-
RUBY_DATA_FUNC(
|
200
|
+
RUBY_DATA_FUNC(Default_Free_Function<Foo>::free),
|
201
201
|
RUBY_DATA_FUNC(RDATA(data_object_foo.value())->dfree));
|
202
202
|
ASSERT_EQUAL(foo, DATA_PTR(data_object_foo.value()));
|
203
203
|
}
|
data/test/test_Hash.cpp
CHANGED
@@ -17,7 +17,7 @@ TESTCASE(default_construct)
|
|
17
17
|
{
|
18
18
|
Hash h;
|
19
19
|
ASSERT_EQUAL(T_HASH, rb_type(h));
|
20
|
-
ASSERT_EQUAL(0,
|
20
|
+
ASSERT_EQUAL(0, RHASH_SIZE(h.value()));
|
21
21
|
}
|
22
22
|
|
23
23
|
TESTCASE(construct_from_object)
|
@@ -25,7 +25,7 @@ TESTCASE(construct_from_object)
|
|
25
25
|
Object o(rb_hash_new());
|
26
26
|
Hash h(o);
|
27
27
|
ASSERT_EQUAL(T_HASH, rb_type(h));
|
28
|
-
ASSERT_EQUAL(0,
|
28
|
+
ASSERT_EQUAL(0, RHASH_SIZE(h.value()));
|
29
29
|
}
|
30
30
|
|
31
31
|
TESTCASE(construct_from_value)
|
@@ -33,7 +33,7 @@ TESTCASE(construct_from_value)
|
|
33
33
|
VALUE v(rb_hash_new());
|
34
34
|
Hash h(v);
|
35
35
|
ASSERT_EQUAL(T_HASH, rb_type(h));
|
36
|
-
ASSERT_EQUAL(0,
|
36
|
+
ASSERT_EQUAL(0, RHASH_SIZE(h.value()));
|
37
37
|
}
|
38
38
|
|
39
39
|
TESTCASE(copy_construct)
|
@@ -95,6 +95,7 @@ TESTCASE(construct_vector_from_hash_iterators)
|
|
95
95
|
h[6] = 9;
|
96
96
|
h[42] = 42;
|
97
97
|
h[6] = 1;
|
98
|
+
|
98
99
|
std::vector<Hash::Entry> v(h.begin(), h.end());
|
99
100
|
std::sort(v.begin(), v.end());
|
100
101
|
ASSERT_EQUAL(3u, v.size());
|
@@ -119,13 +120,16 @@ TESTCASE(iterate)
|
|
119
120
|
h[6] = 9;
|
120
121
|
h[42] = 42;
|
121
122
|
h[6] = 1;
|
123
|
+
|
122
124
|
std::vector<Hash::Entry> v;
|
123
125
|
Hash::iterator it = h.begin();
|
124
126
|
Hash::iterator end = h.end();
|
127
|
+
|
125
128
|
for(; it != end; ++it)
|
126
129
|
{
|
127
130
|
v.push_back(*it);
|
128
131
|
}
|
132
|
+
|
129
133
|
std::sort(v.begin(), v.end());
|
130
134
|
ASSERT_EQUAL(3u, v.size());
|
131
135
|
ASSERT_EQUAL(v[0].key, to_ruby(1));
|
@@ -192,4 +196,3 @@ TESTCASE(iterate_and_change)
|
|
192
196
|
ASSERT_EQUAL(to_ruby(m[6]), h[6]);
|
193
197
|
ASSERT_EQUAL(to_ruby(m[42]), h[42]);
|
194
198
|
}
|
195
|
-
|
data/test/test_Module.cpp
CHANGED
@@ -94,6 +94,22 @@ TESTCASE(define_module_function_simple)
|
|
94
94
|
ASSERT(define_method_simple_ok);
|
95
95
|
}
|
96
96
|
|
97
|
+
TESTCASE(define_module_does_not_leak_method_to_Object)
|
98
|
+
{
|
99
|
+
Module m = define_module("TestModule");
|
100
|
+
m.define_module_function("test_module_function", &define_method_simple_helper);
|
101
|
+
|
102
|
+
Module runner(anonymous_module());
|
103
|
+
ASSERT_EXCEPTION_CHECK(
|
104
|
+
Exception,
|
105
|
+
runner.instance_eval("Object.test_module_function"),
|
106
|
+
ASSERT_EQUAL(
|
107
|
+
Object(rb_eNoMethodError),
|
108
|
+
Object(CLASS_OF(ex.value()))
|
109
|
+
)
|
110
|
+
);
|
111
|
+
}
|
112
|
+
|
97
113
|
namespace
|
98
114
|
{
|
99
115
|
|
@@ -184,7 +200,7 @@ TESTCASE(define_singleton_method_int_foo)
|
|
184
200
|
define_method_int_result = 0;
|
185
201
|
Foo * foo = new Foo;
|
186
202
|
foo->x = 1024;
|
187
|
-
VALUE f = Data_Wrap_Struct(rb_cObject, 0,
|
203
|
+
VALUE f = Data_Wrap_Struct(rb_cObject, 0, Default_Free_Function<Foo>::free, foo);
|
188
204
|
m.call("int_and_foo", 42, Object(f));
|
189
205
|
ASSERT_EQUAL(42, define_method_int_foo_result_i);
|
190
206
|
ASSERT_EQUAL(foo, define_method_int_foo_result_x);
|