rucy 0.1.15 → 0.1.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.doc/ext/rucy/class.cpp +2 -2
- data/.doc/ext/rucy/tester.cpp +2 -2
- data/VERSION +1 -1
- data/bin/rucy2rdoc +9 -9
- data/ext/rucy/class.cpp +2 -2
- data/ext/rucy/tester.cpp +2 -2
- data/include/rucy/exception.h +29 -9
- data/include/rucy/extension.h.erb +16 -4
- data/include/rucy/module.h.erb +1 -1
- data/include/rucy/ruby.h +0 -1
- data/lib/rucy/module.rb +5 -5
- data/lib/rucy/rake.rb +3 -3
- data/rucy.gemspec +1 -1
- data/src/module.cpp.erb +1 -1
- data/src/value.cpp.erb +17 -2
- data/test/test_class.rb +21 -21
- data/test/test_exception.rb +7 -7
- data/test/test_function.rb +6 -6
- data/test/test_struct.rb +4 -4
- data/test/test_value.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be3ad08f2350b6189dc5017966c8b56f690fc3c2e1b30c3b55fefc8a9c43ab65
|
4
|
+
data.tar.gz: 476beb3b1428d3000300fe8eb1a24dc1ce504832ec2ac78ddc5c9d5a22e248b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b9762e6f235eea1d474c8d8ed10e2aa89e09f790acb9765bc202549efcff7382b2f182a7b26babf7474b99c91d7c788c4fa5fc1b6308e9623de7f8a28205d25
|
7
|
+
data.tar.gz: db15d626a323c41c328ebeeb5f03212ba81ea4535b20704e6a2acb6c87cfba34aeac77b91858531d4af8574e2a3eada723e0ba972f53bec4adc7e4391919c5af
|
data/.doc/ext/rucy/class.cpp
CHANGED
@@ -177,6 +177,6 @@ Init_class ()
|
|
177
177
|
cSimpleObj = rb_define_class_under(mTester, "SimpleObj", rb_cObject);
|
178
178
|
rb_define_alloc_func(cSimpleObj, simpleobj_alloc);
|
179
179
|
rb_define_private_method(cSimpleObj, "initialize", RUBY_METHOD_FUNC(simpleobj_initialize), 1);
|
180
|
-
|
181
|
-
|
180
|
+
rb_define_module_function(cSimpleObj, "set_refs", RUBY_METHOD_FUNC(simpleobj_set_refs), 1);
|
181
|
+
rb_define_module_function(cSimpleObj, "clear_refs", RUBY_METHOD_FUNC(simpleobj_clear_refs), 0);
|
182
182
|
}
|
data/.doc/ext/rucy/tester.cpp
CHANGED
@@ -54,8 +54,8 @@ Init_tester ()
|
|
54
54
|
Module mRucy = rb_define_module("Rucy");
|
55
55
|
Module mTester = rb_define_module_under(mRucy, "Tester");
|
56
56
|
|
57
|
-
|
58
|
-
|
57
|
+
rb_define_module_function(mTester, "all_logs", RUBY_METHOD_FUNC(all_logs), 0);
|
58
|
+
rb_define_module_function(mTester, "clear_logs", RUBY_METHOD_FUNC(clear_logs), 0);
|
59
59
|
|
60
60
|
Init_value();
|
61
61
|
Init_exception();
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.22
|
data/bin/rucy2rdoc
CHANGED
@@ -3,12 +3,12 @@
|
|
3
3
|
|
4
4
|
class Parser
|
5
5
|
|
6
|
-
def initialize
|
6
|
+
def initialize(lines)
|
7
7
|
@funs = {}
|
8
8
|
@lines = lines
|
9
9
|
end
|
10
10
|
|
11
|
-
def parse
|
11
|
+
def parse()
|
12
12
|
parse_functions @lines
|
13
13
|
parse_Init @lines
|
14
14
|
@lines
|
@@ -16,7 +16,7 @@ class Parser
|
|
16
16
|
|
17
17
|
private
|
18
18
|
|
19
|
-
def process_lines
|
19
|
+
def process_lines(lines, regexp, &block)
|
20
20
|
lines.gsub! regexp do |str|
|
21
21
|
params = $~[1..-1]
|
22
22
|
params.unshift str
|
@@ -24,7 +24,7 @@ class Parser
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
def parse_functions
|
27
|
+
def parse_functions(lines)
|
28
28
|
re = %r{
|
29
29
|
(?:RUCY_)?DEF(\d+|N|_ALLOC)\( (\w+) \s* ((?:\, \s* \w+)*) \s* \) \s*
|
30
30
|
(\{ \s*
|
@@ -50,7 +50,7 @@ class Parser
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
-
def parse_Init
|
53
|
+
def parse_Init(lines)
|
54
54
|
re = %r{
|
55
55
|
Init_(\w*) \s* \( \s* \) \s*
|
56
56
|
\{ \s*
|
@@ -64,7 +64,7 @@ class Parser
|
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
|
-
def parse_module_and_class
|
67
|
+
def parse_module_and_class(lines)
|
68
68
|
re = %r{
|
69
69
|
(\w+) \s* \= \s*
|
70
70
|
(?: (\w+) \s* \. )? \s* (define_(?:module|class)) \s*
|
@@ -79,7 +79,7 @@ class Parser
|
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
|
-
def parse_methods
|
82
|
+
def parse_methods(lines)
|
83
83
|
re = %r{
|
84
84
|
(\w+) \s* \. \s* (define_\w+) \s*
|
85
85
|
\( \s* (?: (\"\w+(?:\=|\?\!)?\") \s* \, \s* )? (\w+) \s* \) \s* ;
|
@@ -100,11 +100,11 @@ class Parser
|
|
100
100
|
end# Parser
|
101
101
|
|
102
102
|
|
103
|
-
def usage
|
103
|
+
def usage()
|
104
104
|
"rucy2rdoc FILE"
|
105
105
|
end
|
106
106
|
|
107
|
-
def main
|
107
|
+
def main(argv)
|
108
108
|
if path = argv.shift
|
109
109
|
print Parser.new(File.read path).parse
|
110
110
|
else
|
data/ext/rucy/class.cpp
CHANGED
@@ -190,6 +190,6 @@ Init_class ()
|
|
190
190
|
cSimpleObj = mTester.define_class("SimpleObj");
|
191
191
|
cSimpleObj.define_alloc_func(simpleobj_alloc);
|
192
192
|
cSimpleObj.define_private_method("initialize", simpleobj_initialize);
|
193
|
-
cSimpleObj.
|
194
|
-
cSimpleObj.
|
193
|
+
cSimpleObj.define_module_function("set_refs", simpleobj_set_refs);
|
194
|
+
cSimpleObj.define_module_function("clear_refs", simpleobj_clear_refs);
|
195
195
|
}
|
data/ext/rucy/tester.cpp
CHANGED
@@ -56,8 +56,8 @@ Init_tester ()
|
|
56
56
|
Module mRucy = define_module("Rucy");
|
57
57
|
Module mTester = mRucy.define_module("Tester");
|
58
58
|
|
59
|
-
mTester.
|
60
|
-
mTester.
|
59
|
+
mTester.define_module_function("all_logs", all_logs);
|
60
|
+
mTester.define_module_function("clear_logs", clear_logs);
|
61
61
|
|
62
62
|
Init_value();
|
63
63
|
Init_exception();
|
data/include/rucy/exception.h
CHANGED
@@ -47,31 +47,51 @@ namespace Rucy
|
|
47
47
|
};// RubyJumpTag
|
48
48
|
|
49
49
|
|
50
|
+
[[noreturn]]
|
50
51
|
void raise (const char* format = NULL, ...);
|
51
52
|
|
53
|
+
[[noreturn]]
|
52
54
|
void raise (RubyValue exception, const char* format = NULL, ...);
|
53
55
|
|
54
56
|
|
55
|
-
|
57
|
+
[[noreturn]]
|
58
|
+
void rucy_error (
|
59
|
+
const char* file, int line, const char* format = NULL, ...);
|
56
60
|
|
57
|
-
|
61
|
+
[[noreturn]]
|
62
|
+
void type_error (
|
63
|
+
const char* file, int line, const char* format = NULL, ...);
|
58
64
|
|
59
|
-
|
65
|
+
[[noreturn]]
|
66
|
+
void argument_error (
|
67
|
+
const char* file, int line, const char* format = NULL, ...);
|
60
68
|
|
61
|
-
|
69
|
+
[[noreturn]]
|
70
|
+
void arg_count_error (
|
71
|
+
const char* file, int line,
|
62
72
|
const char* method, int nargs, int nargs_expected,
|
63
73
|
int n1 = -1, int n2 = -1, int n3 = -1, int n4 = -1, int n5 = -1,
|
64
74
|
int n6 = -1, int n7 = -1, int n8 = -1, int n9 = -1, int n10 = -1);
|
65
75
|
|
66
|
-
|
76
|
+
[[noreturn]]
|
77
|
+
void invalid_state_error (
|
78
|
+
const char* file, int line, const char* format = NULL, ...);
|
67
79
|
|
68
|
-
|
80
|
+
[[noreturn]]
|
81
|
+
void invalid_object_error (
|
82
|
+
const char* file, int line, const char* format = NULL, ...);
|
69
83
|
|
70
|
-
|
84
|
+
[[noreturn]]
|
85
|
+
void index_error (
|
86
|
+
const char* file, int line, const char* format = NULL, ...);
|
71
87
|
|
72
|
-
|
88
|
+
[[noreturn]]
|
89
|
+
void not_implemented_error (
|
90
|
+
const char* file, int line, const char* format = NULL, ...);
|
73
91
|
|
74
|
-
|
92
|
+
[[noreturn]]
|
93
|
+
void system_error (
|
94
|
+
const char* file, int line, const char* format = NULL, ...);
|
75
95
|
|
76
96
|
|
77
97
|
}// Rucy
|
@@ -27,14 +27,20 @@
|
|
27
27
|
template <> const native_class& value_to<const native_class&> (Value value, bool convert); \
|
28
28
|
}
|
29
29
|
|
30
|
-
#define
|
31
|
-
RUCY_DECLARE_VALUE_TO(native_class) \
|
30
|
+
#define RUCY_DECLARE_ARRAY_TO(native_class) \
|
32
31
|
namespace Rucy \
|
33
32
|
{ \
|
34
33
|
template <> native_class value_to<native_class> (Value value, bool convert); \
|
35
34
|
template <> native_class value_to<native_class> (int argc, const Value* argv, bool convert); \
|
36
35
|
}
|
37
36
|
|
37
|
+
#define RUCY_DECLARE_CONVERT_TO(native_type) \
|
38
|
+
RUCY_DECLARE_ARRAY_TO(native_type)
|
39
|
+
|
40
|
+
#define RUCY_DECLARE_VALUE_OR_ARRAY_TO(native_class) \
|
41
|
+
RUCY_DECLARE_VALUE_TO(native_class) \
|
42
|
+
RUCY_DECLARE_ARRAY_TO(native_class)
|
43
|
+
|
38
44
|
#define RUCY_DECLARE_WRAPPER_VALUE_FROM(native_class) \
|
39
45
|
namespace Rucy \
|
40
46
|
{ \
|
@@ -92,8 +98,7 @@
|
|
92
98
|
} \
|
93
99
|
}
|
94
100
|
|
95
|
-
#define
|
96
|
-
RUCY_DEFINE_VALUE_TO(native_class) \
|
101
|
+
#define RUCY_DEFINE_ARRAY_TO(native_class) \
|
97
102
|
namespace Rucy \
|
98
103
|
{ \
|
99
104
|
template <> native_class \
|
@@ -106,6 +111,13 @@
|
|
106
111
|
} \
|
107
112
|
}
|
108
113
|
|
114
|
+
#define RUCY_DEFINE_CONVERT_TO(native_type) \
|
115
|
+
RUCY_DEFINE_ARRAY_TO(native_type)
|
116
|
+
|
117
|
+
#define RUCY_DEFINE_VALUE_OR_ARRAY_TO(native_class) \
|
118
|
+
RUCY_DEFINE_VALUE_TO(native_class) \
|
119
|
+
RUCY_DEFINE_ARRAY_TO(native_class)
|
120
|
+
|
109
121
|
#define RUCY_DEFINE_WRAPPER_VALUE_FROM(native_class) \
|
110
122
|
namespace Rucy \
|
111
123
|
{ \
|
data/include/rucy/module.h.erb
CHANGED
data/include/rucy/ruby.h
CHANGED
data/lib/rucy/module.rb
CHANGED
@@ -8,23 +8,23 @@ module Rucy
|
|
8
8
|
|
9
9
|
module_function
|
10
10
|
|
11
|
-
def name
|
11
|
+
def name()
|
12
12
|
super.split('::')[-2]
|
13
13
|
end
|
14
14
|
|
15
|
-
def version
|
15
|
+
def version()
|
16
16
|
open(root_dir 'VERSION') {|f| f.readline.chomp}
|
17
17
|
end
|
18
18
|
|
19
|
-
def root_dir
|
19
|
+
def root_dir(path = '')
|
20
20
|
File.expand_path "../../#{path}", __dir__
|
21
21
|
end
|
22
22
|
|
23
|
-
def inc_dir
|
23
|
+
def inc_dir()
|
24
24
|
root_dir 'include'
|
25
25
|
end
|
26
26
|
|
27
|
-
def lib_dir
|
27
|
+
def lib_dir()
|
28
28
|
root_dir 'lib'
|
29
29
|
end
|
30
30
|
|
data/lib/rucy/rake.rb
CHANGED
@@ -10,15 +10,15 @@ module Rucy
|
|
10
10
|
module Rake
|
11
11
|
|
12
12
|
|
13
|
-
def rdoc
|
13
|
+
def rdoc()
|
14
14
|
env :RDOC, 'rdoc'# 'yardoc'
|
15
15
|
end
|
16
16
|
|
17
|
-
def rucy2rdoc
|
17
|
+
def rucy2rdoc()
|
18
18
|
env :RUCY2RDOC, 'rucy2rdoc'
|
19
19
|
end
|
20
20
|
|
21
|
-
def generate_documents
|
21
|
+
def generate_documents()
|
22
22
|
rdocdir = ".doc/#{ext_dir}"
|
23
23
|
srcs = FileList["#{ext_dir}/**/*.{#{src_exts.join ','}}"]
|
24
24
|
rdocs = Hash[srcs.map{|path| [path, "#{rdocdir}/#{File.basename path}"]}]
|
data/rucy.gemspec
CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |s|
|
|
28
28
|
s.platform = Gem::Platform::RUBY
|
29
29
|
s.required_ruby_version = '~> 2'
|
30
30
|
|
31
|
-
s.add_runtime_dependency 'xot', '~> 0.1'
|
31
|
+
s.add_runtime_dependency 'xot', '~> 0.1.22'
|
32
32
|
|
33
33
|
s.files = `git ls-files`.split $/
|
34
34
|
s.executables = s.files.grep(%r{^bin/}) {|f| File.basename f}
|
data/src/module.cpp.erb
CHANGED
@@ -58,7 +58,7 @@ namespace Rucy
|
|
58
58
|
}
|
59
59
|
|
60
60
|
% [
|
61
|
-
% ['
|
61
|
+
% ['define_module_function', 'rb_define_module_function'],
|
62
62
|
% ['define_method', 'rb_define_method'],
|
63
63
|
% ['define_private_method', 'rb_define_private_method'],
|
64
64
|
% ['define_singleton_method', 'rb_define_singleton_method']
|
data/src/value.cpp.erb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
|
4
4
|
|
5
5
|
#include <assert.h>
|
6
|
+
#include <ruby/encoding.h>
|
6
7
|
#include "rucy/function.h"
|
7
8
|
#include "rucy/exception.h"
|
8
9
|
#include "rucy/debug.h"
|
@@ -55,15 +56,29 @@ namespace Rucy
|
|
55
56
|
{
|
56
57
|
}
|
57
58
|
|
59
|
+
static VALUE
|
60
|
+
str_new (const char* s)
|
61
|
+
{
|
62
|
+
rb_encoding* e = rb_default_internal_encoding();
|
63
|
+
return e ? rb_enc_str_new_cstr(s, e) : rb_str_new_cstr(s);
|
64
|
+
}
|
65
|
+
|
66
|
+
static VALUE
|
67
|
+
str_new (const char* s, size_t len)
|
68
|
+
{
|
69
|
+
rb_encoding* e = rb_default_internal_encoding();
|
70
|
+
return e ? rb_enc_str_new(s, len, e) : rb_str_new(s, len);
|
71
|
+
}
|
72
|
+
|
58
73
|
Value::Value (const char* s)
|
59
|
-
: val(s ?
|
74
|
+
: val(s ? str_new(s) : Qnil)
|
60
75
|
{
|
61
76
|
if (!s)
|
62
77
|
argument_error(__FILE__, __LINE__);
|
63
78
|
}
|
64
79
|
|
65
80
|
Value::Value (const char* s, size_t len)
|
66
|
-
: val(s ?
|
81
|
+
: val(s ? str_new(s, len) : Qnil)
|
67
82
|
{
|
68
83
|
if (!s)
|
69
84
|
argument_error(__FILE__, __LINE__);
|
data/test/test_class.rb
CHANGED
@@ -6,11 +6,11 @@ require_relative 'helper'
|
|
6
6
|
|
7
7
|
class Temp < Rucy::Tester::Sub
|
8
8
|
|
9
|
-
def name
|
9
|
+
def name()
|
10
10
|
"Temp::name"
|
11
11
|
end
|
12
12
|
|
13
|
-
def name_overridable
|
13
|
+
def name_overridable()
|
14
14
|
"Temp::name_overridable"
|
15
15
|
end
|
16
16
|
|
@@ -21,33 +21,33 @@ class TestClass < Test::Unit::TestCase
|
|
21
21
|
|
22
22
|
include Rucy::Tester
|
23
23
|
|
24
|
-
def base
|
25
|
-
Base.new
|
24
|
+
def base(*args)
|
25
|
+
Base.new(*args)
|
26
26
|
end
|
27
27
|
|
28
|
-
def sub
|
29
|
-
Sub.new
|
28
|
+
def sub(*args)
|
29
|
+
Sub.new(*args)
|
30
30
|
end
|
31
31
|
|
32
|
-
def temp
|
33
|
-
Temp.new
|
32
|
+
def temp(*args)
|
33
|
+
Temp.new(*args)
|
34
34
|
end
|
35
35
|
|
36
|
-
def base_raw
|
37
|
-
Base.new_raw
|
36
|
+
def base_raw(*args)
|
37
|
+
Base.new_raw(*args)
|
38
38
|
end
|
39
39
|
|
40
|
-
def sub_raw
|
41
|
-
Sub.new_raw
|
40
|
+
def sub_raw(*args)
|
41
|
+
Sub.new_raw(*args)
|
42
42
|
end
|
43
43
|
|
44
|
-
def last_log
|
44
|
+
def last_log(pattern = nil)
|
45
45
|
logs = Rucy::Tester.all_logs
|
46
46
|
logs.select! {|o| o =~ pattern} if pattern
|
47
47
|
logs.last
|
48
48
|
end
|
49
49
|
|
50
|
-
def test_is_kind_of_base
|
50
|
+
def test_is_kind_of_base()
|
51
51
|
assert_kind_of Base, base
|
52
52
|
assert_kind_of Base, base_raw
|
53
53
|
|
@@ -69,7 +69,7 @@ class TestClass < Test::Unit::TestCase
|
|
69
69
|
assert_not sub_raw.kind_of?(Temp)
|
70
70
|
end
|
71
71
|
|
72
|
-
def test_name
|
72
|
+
def test_name()
|
73
73
|
assert_equal "Base::name", base .name
|
74
74
|
assert_equal "Base::name", base_raw.name
|
75
75
|
assert_equal "Sub::name", sub .name
|
@@ -77,7 +77,7 @@ class TestClass < Test::Unit::TestCase
|
|
77
77
|
assert_equal "Temp::name", temp .name
|
78
78
|
end
|
79
79
|
|
80
|
-
def test_name_overridable
|
80
|
+
def test_name_overridable()
|
81
81
|
assert_equal "Base::name_overridable", base .name_overridable
|
82
82
|
assert_equal "Base::name_overridable", base_raw.name_overridable
|
83
83
|
assert_equal "Sub::name_overridable", sub .name_overridable
|
@@ -85,7 +85,7 @@ class TestClass < Test::Unit::TestCase
|
|
85
85
|
assert_equal "Temp::name_overridable", temp .name_overridable
|
86
86
|
end
|
87
87
|
|
88
|
-
def test_call_name
|
88
|
+
def test_call_name()
|
89
89
|
assert_equal "Base::name", base .call_name
|
90
90
|
assert_equal "Base::name", base_raw.call_name
|
91
91
|
assert_equal "Sub::name", sub .call_name
|
@@ -93,7 +93,7 @@ class TestClass < Test::Unit::TestCase
|
|
93
93
|
assert_equal "Sub::name", temp .call_name# "Sub" instead of "Temp"!
|
94
94
|
end
|
95
95
|
|
96
|
-
def test_call_name_overridable
|
96
|
+
def test_call_name_overridable()
|
97
97
|
assert_equal "Base::name_overridable", base .call_name_overridable
|
98
98
|
assert_equal "Base::name_overridable", base_raw.call_name_overridable
|
99
99
|
assert_equal "Sub::name_overridable", sub .call_name_overridable
|
@@ -101,9 +101,9 @@ class TestClass < Test::Unit::TestCase
|
|
101
101
|
assert_equal "Temp::name_overridable", temp .call_name_overridable
|
102
102
|
end
|
103
103
|
|
104
|
-
def test_gc
|
105
|
-
def simple_objs
|
106
|
-
def gc
|
104
|
+
def test_gc()
|
105
|
+
def simple_objs(name, n = 10) ([nil] * n).map {SimpleObj.new name} end
|
106
|
+
def gc() GC.start end
|
107
107
|
rt = Rucy::Tester
|
108
108
|
|
109
109
|
gc
|
data/test/test_exception.rb
CHANGED
@@ -8,31 +8,31 @@ class TestException < Test::Unit::TestCase
|
|
8
8
|
|
9
9
|
include Rucy::Tester
|
10
10
|
|
11
|
-
def test_raise_ruby_exception
|
11
|
+
def test_raise_ruby_exception()
|
12
12
|
assert_raise(StandardError) {raise_ruby_exception}
|
13
13
|
end
|
14
14
|
|
15
|
-
def test_raise_in_eval
|
15
|
+
def test_raise_in_eval()
|
16
16
|
assert_raise(RuntimeError) {raise_in_eval}
|
17
17
|
end
|
18
18
|
|
19
|
-
def test_throw_std_exception
|
19
|
+
def test_throw_std_exception()
|
20
20
|
assert_raise(Rucy::NativeError) {throw_std_exception}
|
21
21
|
end
|
22
22
|
|
23
|
-
def test_throw_std_runtime_error
|
23
|
+
def test_throw_std_runtime_error()
|
24
24
|
assert_raise(Rucy::NativeError) {throw_std_runtime_error}
|
25
25
|
end
|
26
26
|
|
27
|
-
def test_throw_custom_exception
|
27
|
+
def test_throw_custom_exception()
|
28
28
|
assert_raise(Rucy::NativeError) {throw_custom_exception}
|
29
29
|
end
|
30
30
|
|
31
|
-
def test_throw_std_string
|
31
|
+
def test_throw_std_string()
|
32
32
|
assert_raise(Rucy::NativeError) {throw_std_string}
|
33
33
|
end
|
34
34
|
|
35
|
-
def test_throw_cstring
|
35
|
+
def test_throw_cstring()
|
36
36
|
assert_raise(Rucy::NativeError) {throw_cstring}
|
37
37
|
end
|
38
38
|
|
data/test/test_function.rb
CHANGED
@@ -8,27 +8,27 @@ class TestFunction < Test::Unit::TestCase
|
|
8
8
|
|
9
9
|
include Rucy::Tester
|
10
10
|
|
11
|
-
def test_do_nothing_returns_nil
|
11
|
+
def test_do_nothing_returns_nil()
|
12
12
|
assert_equal nil, do_nothing
|
13
13
|
end
|
14
14
|
|
15
|
-
def test_returns_nil
|
15
|
+
def test_returns_nil()
|
16
16
|
assert_equal nil, return_nil
|
17
17
|
end
|
18
18
|
|
19
|
-
def test_return_int
|
19
|
+
def test_return_int()
|
20
20
|
assert_kind_of Integer, return_int
|
21
21
|
end
|
22
22
|
|
23
|
-
def test_return_float
|
23
|
+
def test_return_float()
|
24
24
|
assert_kind_of Float, return_float
|
25
25
|
end
|
26
26
|
|
27
|
-
def test_return_string
|
27
|
+
def test_return_string()
|
28
28
|
assert_kind_of String, return_string
|
29
29
|
end
|
30
30
|
|
31
|
-
def test_check_arg_count
|
31
|
+
def test_check_arg_count()
|
32
32
|
assert_equal :ok, arg_count_must_1(:arg1)
|
33
33
|
assert_raise(ArgumentError) {arg_count_must_1}
|
34
34
|
assert_raises(ArgumentError) {arg_count_must_1 :arg1, :arg2}
|
data/test/test_struct.rb
CHANGED
@@ -6,20 +6,20 @@ require_relative 'helper'
|
|
6
6
|
|
7
7
|
class TestStruct < Test::Unit::TestCase
|
8
8
|
|
9
|
-
def setup
|
9
|
+
def setup()
|
10
10
|
@x = Rucy::Tester::Struct.new
|
11
11
|
end
|
12
12
|
|
13
|
-
def test_default_value_is_0
|
13
|
+
def test_default_value_is_0()
|
14
14
|
assert_equal 0, @x.num
|
15
15
|
end
|
16
16
|
|
17
|
-
def test_get_set_num
|
17
|
+
def test_get_set_num()
|
18
18
|
@x.num = 1
|
19
19
|
assert_equal 1, @x.num
|
20
20
|
end
|
21
21
|
|
22
|
-
def test_dup
|
22
|
+
def test_dup()
|
23
23
|
assert_equal 0, @x.num
|
24
24
|
x = @x.dup
|
25
25
|
@x.num = 1
|
data/test/test_value.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rucy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- xordog
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xot
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 0.1.22
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 0.1.22
|
27
27
|
description: This library helps you to develop Ruby Extension by C++.
|
28
28
|
email: xordog@gmail.com
|
29
29
|
executables:
|
@@ -91,7 +91,7 @@ files:
|
|
91
91
|
homepage: https://github.com/xord/rucy
|
92
92
|
licenses: []
|
93
93
|
metadata: {}
|
94
|
-
post_install_message:
|
94
|
+
post_install_message:
|
95
95
|
rdoc_options: []
|
96
96
|
require_paths:
|
97
97
|
- lib
|
@@ -107,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
107
|
version: '0'
|
108
108
|
requirements: []
|
109
109
|
rubygems_version: 3.0.3
|
110
|
-
signing_key:
|
110
|
+
signing_key:
|
111
111
|
specification_version: 4
|
112
112
|
summary: A Ruby C++ Extension Helper Library.
|
113
113
|
test_files:
|