serpent 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/ext/serpent/serpent_ffi.cpp +5 -0
- data/lib/serpent/version.rb +1 -1
- data/test/serpent_test.rb +4 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e7751a421093e3a44ec79ec224af12626d1670a
|
4
|
+
data.tar.gz: ca7f17bbc9d2faf07a128a558a27b2d91b572853
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 327e80a8dbcb05746e22598dfb80db2b8991f2ead2b3000ede6519ae07a9372547a80f516a67bb6e3fb91a4709295b345afc3206cc4f28b5d7c3c434878c79cd
|
7
|
+
data.tar.gz: 487a434c962a899a9cb85a51c4577ee8d0b020f06828623b2a3133a6a99b80a5f020414a2d0635ad4422b55062c0b8f9d6a3fd3e52e6d24709642bd66556c492
|
data/Gemfile.lock
CHANGED
data/ext/serpent/serpent_ffi.cpp
CHANGED
@@ -87,11 +87,16 @@ unsigned int serpent_get_prefix(Object self, std::string signature) {
|
|
87
87
|
return getPrefix(signature);
|
88
88
|
}
|
89
89
|
|
90
|
+
void serpent_exception_handler(std::string const & ex) {
|
91
|
+
rb_raise(rb_eRuntimeError, ex.c_str());
|
92
|
+
}
|
93
|
+
|
90
94
|
extern "C"
|
91
95
|
void Init_serpent_ffi() {
|
92
96
|
Module rb_mSerpent = define_module("Serpent");
|
93
97
|
|
94
98
|
Module rb_mSerpentFFI = define_module_under(rb_mSerpent, "FFI")
|
99
|
+
.add_handler<std::string>(serpent_exception_handler)
|
95
100
|
.define_module_function("compile", &serpent_compile)
|
96
101
|
.define_module_function("compile_to_lll", &serpent_compile_to_lll)
|
97
102
|
.define_module_function("parse_lll", &serpent_parse_lll)
|
data/lib/serpent/version.rb
CHANGED
data/test/serpent_test.rb
CHANGED
@@ -28,6 +28,10 @@ EOF
|
|
28
28
|
assert_equal decode_hex('604a80600b6000396055567c0100000000000000000000000000000000000000000000000000000000600035046397d857aa8114156048576004356040526024356060526060516040510a60805260206080f35b505b6000f3'), Serpent.compile(CODE, foo: 1)
|
29
29
|
end
|
30
30
|
|
31
|
+
def test_compile_error
|
32
|
+
assert_raises(RuntimeError) { Serpent.compile('what?') }
|
33
|
+
end
|
34
|
+
|
31
35
|
def test_compile_to_lll
|
32
36
|
assert_match /^\(return 0 \n/, Serpent.compile_to_lll(CODE).to_s
|
33
37
|
end
|