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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a7e97b6b271ee3c9ca4451ace9e8bb1115c9d716
4
- data.tar.gz: 8de2a46ee639fd1476d86b8d4beaaf96bc25edc9
3
+ metadata.gz: 9e7751a421093e3a44ec79ec224af12626d1670a
4
+ data.tar.gz: ca7f17bbc9d2faf07a128a558a27b2d91b572853
5
5
  SHA512:
6
- metadata.gz: 5724e2ba8c64c10c43dda924f0927108855633083e09a26097ee89c0c134eaa413670f5efbd5eb6d614d354ca322884e8d7f3716acc85390150534c70cd343c9
7
- data.tar.gz: 93f6688b63c71d22a8717a0c6bd10a24dddad0a61dc24c22a1180c1eeac730590872a8165548c17e86775b74df54d13f64d37995508c22170227dc21bc412408
6
+ metadata.gz: 327e80a8dbcb05746e22598dfb80db2b8991f2ead2b3000ede6519ae07a9372547a80f516a67bb6e3fb91a4709295b345afc3206cc4f28b5d7c3c434878c79cd
7
+ data.tar.gz: 487a434c962a899a9cb85a51c4577ee8d0b020f06828623b2a3133a6a99b80a5f020414a2d0635ad4422b55062c0b8f9d6a3fd3e52e6d24709642bd66556c492
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- serpent (0.2.1)
4
+ serpent (0.3.0)
5
5
 
6
6
  GEM
7
7
  remote: https://ruby.taobao.org/
@@ -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)
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : ascii-8bit -*-
2
2
  module Serpent
3
- VERSION = '0.2.1'
3
+ VERSION = '0.3.0'
4
4
  end
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serpent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Xie