extpp 0.0.9 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/README.md +2 -2
- data/Rakefile +1 -28
- data/doc/text/news.md +6 -0
- data/include/ruby/class.hpp +191 -14
- data/{ext/extpp → include/ruby}/function.hpp +20 -7
- data/include/ruby/object.hpp +45 -6
- data/include/ruby/protect.hpp +9 -2
- data/include/ruby.hpp +0 -10
- data/lib/extpp/setup.rb +0 -4
- data/lib/extpp/version.rb +1 -1
- data/lib/extpp.rb +0 -12
- metadata +6 -73
- data/ext/extpp/class.cpp +0 -277
- data/ext/extpp/extconf.rb +0 -110
- data/ext/extpp/function.cpp +0 -28
- data/ext/extpp/object.cpp +0 -48
- data/ext/extpp/protect.cpp +0 -12
- data/lib/extpp/platform.rb +0 -8
- data/test/fixtures/cast/Makefile +0 -269
- data/test/fixtures/cast/cast.cpp +0 -39
- data/test/fixtures/cast/cast.o +0 -0
- data/test/fixtures/cast/cast.so +0 -0
- data/test/fixtures/cast/extconf.rb +0 -4
- data/test/fixtures/cast/mkmf.log +0 -144
- data/test/fixtures/class/Makefile +0 -269
- data/test/fixtures/class/class.cpp +0 -46
- data/test/fixtures/class/class.o +0 -0
- data/test/fixtures/class/class.so +0 -0
- data/test/fixtures/class/extconf.rb +0 -4
- data/test/fixtures/class/mkmf.log +0 -144
- data/test/fixtures/object/Makefile +0 -269
- data/test/fixtures/object/extconf.rb +0 -4
- data/test/fixtures/object/mkmf.log +0 -144
- data/test/fixtures/object/object.cpp +0 -102
- data/test/fixtures/object/object.o +0 -0
- data/test/fixtures/object/object.so +0 -0
- data/test/fixtures/protect/Makefile +0 -269
- data/test/fixtures/protect/extconf.rb +0 -4
- data/test/fixtures/protect/mkmf.log +0 -144
- data/test/fixtures/protect/protect.cpp +0 -70
- data/test/fixtures/protect/protect.o +0 -0
- data/test/fixtures/protect/protect.so +0 -0
- data/test/helper.rb +0 -11
- data/test/run-test.rb +0 -31
- data/test/test-cast.rb +0 -46
- data/test/test-class.rb +0 -47
- data/test/test-object.rb +0 -68
- data/test/test-protect.rb +0 -54
data/test/test-protect.rb
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
class ProtectTest < Test::Unit::TestCase
|
2
|
-
extend Helper::Fixture
|
3
|
-
|
4
|
-
class << self
|
5
|
-
def startup
|
6
|
-
return unless self == ProtectTest
|
7
|
-
lib_dir = File.join(__dir__, "..", "lib")
|
8
|
-
Dir.chdir(fixture_path("protect")) do
|
9
|
-
system(RbConfig.ruby, "-w", "-I", lib_dir, "extconf.rb")
|
10
|
-
system("make")
|
11
|
-
end
|
12
|
-
require fixture_path("protect", "protect")
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
class Listener
|
17
|
-
attr_reader :events
|
18
|
-
def initialize
|
19
|
-
@events = []
|
20
|
-
end
|
21
|
-
|
22
|
-
def notify(event)
|
23
|
-
@events << event
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def setup
|
28
|
-
@protect_methods = ProtectMethods.new
|
29
|
-
end
|
30
|
-
|
31
|
-
def assert_protect(method_name)
|
32
|
-
listener = Listener.new
|
33
|
-
assert_raise(RuntimeError.new("message")) do
|
34
|
-
@protect_methods.__send__(method_name, listener) do
|
35
|
-
raise "message"
|
36
|
-
end
|
37
|
-
end
|
38
|
-
assert_equal([
|
39
|
-
"outer: constructed",
|
40
|
-
"inner: constructed",
|
41
|
-
"inner: destructed",
|
42
|
-
"outer: caught",
|
43
|
-
],
|
44
|
-
listener.events)
|
45
|
-
end
|
46
|
-
|
47
|
-
def test_raw
|
48
|
-
assert_protect(:protect_raw)
|
49
|
-
end
|
50
|
-
|
51
|
-
def test_closure
|
52
|
-
assert_protect(:protect_closure)
|
53
|
-
end
|
54
|
-
end
|