boc 0.4.2-java

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,20 @@
1
+ require_relative 'main'
2
+
3
+ class JrubyTest < BocTest
4
+ require 'jruby'
5
+ prop = "jruby.astInspector.enabled"
6
+ puts("#{prop}: " + java.lang.System.get_properties[prop].inspect)
7
+
8
+ class A
9
+ def f
10
+ eval("x", Boc.value)
11
+ end
12
+ end
13
+
14
+ def test_explosion
15
+ #p { }
16
+ Boc.enable A, :f
17
+ x = 33
18
+ assert_equal 33, A.new.f
19
+ end
20
+ end if RUBY_ENGINE == "jruby"
data/test/main.rb ADDED
@@ -0,0 +1,56 @@
1
+ $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
2
+
3
+ require 'minitest/unit'
4
+ require 'minitest/autorun' unless defined? Rake
5
+
6
+ require 'pp'
7
+ require 'boc'
8
+
9
+ class JLMiniTest < MiniTest::Unit::TestCase
10
+ def self.test_methods
11
+ default = super
12
+ onlies = default.select { |m| m =~ %r!__only\Z! }
13
+ if onlies.empty?
14
+ default
15
+ else
16
+ puts "\nNOTE: running ONLY *__only tests for #{self}"
17
+ onlies
18
+ end
19
+ end
20
+
21
+ def delim(char)
22
+ "\n" << (char*72) << "\n"
23
+ end
24
+
25
+ def mu_pp(obj)
26
+ delim("_") <<
27
+ obj.pretty_inspect.chomp <<
28
+ delim("=")
29
+ end
30
+
31
+ def unfixable
32
+ begin
33
+ yield
34
+ raise "claimed to be unfixable, but assertion succeeded"
35
+ rescue MiniTest::Assertion
36
+ end
37
+ end
38
+
39
+ def assert_nothing_raised
40
+ yield
41
+ assert_nil nil
42
+ rescue => ex
43
+ raise MiniTest::Assertion,
44
+ exception_details(ex, "Expected nothing raised, but got:")
45
+ end
46
+
47
+ %w[
48
+ empty equal in_delta in_epsilon includes instance_of
49
+ kind_of match nil operator respond_to same
50
+ ].each { |name|
51
+ alias_method "assert_not_#{name}", "refute_#{name}"
52
+ }
53
+ end
54
+
55
+ BocTest = JLMiniTest
56
+
@@ -0,0 +1,9 @@
1
+ require_relative 'main'
2
+ require_relative '../devel/levitate'
3
+
4
+ if RUBY_ENGINE == "ruby"
5
+ Levitate.doc_to_test(
6
+ "README.rdoc",
7
+ "Synopsis",
8
+ "<code>Binding.of_caller</code>")
9
+ end
data/test/shim_test.rb ADDED
@@ -0,0 +1,26 @@
1
+ require_relative 'main'
2
+
3
+ class ShimTest < BocTest
4
+ def initialize(*args)
5
+ super
6
+ require 'boc/binding_of_caller'
7
+ end
8
+
9
+ class A
10
+ def f
11
+ Binding.of_caller do |bind|
12
+ eval("x", bind) + 11
13
+ end
14
+ end
15
+
16
+ def g
17
+ x = 33
18
+ f
19
+ end
20
+ end
21
+
22
+ def test_old_style
23
+ Boc.enable A, :f
24
+ assert_equal 44, A.new.g
25
+ end
26
+ end
metadata ADDED
@@ -0,0 +1,88 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: boc
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.4.2
6
+ platform: java
7
+ authors:
8
+ - James M. Lawrence
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-03-21 00:00:00 -04:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: rake-compiler
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ~>
23
+ - !ruby/object:Gem::Version
24
+ version: 0.7.6
25
+ type: :development
26
+ version_requirements: *id001
27
+ description: "Binding of caller: obtain a caller's binding."
28
+ email:
29
+ - quixoticsycophant@gmail.com
30
+ executables: []
31
+
32
+ extensions: []
33
+
34
+ extra_rdoc_files:
35
+ - README.rdoc
36
+ - CHANGES.rdoc
37
+ files:
38
+ - CHANGES.rdoc
39
+ - README.rdoc
40
+ - Rakefile
41
+ - devel/levitate.rb
42
+ - ext/boc/boc.c
43
+ - ext/boc/extconf.rb
44
+ - jext/boc/BocService.java
45
+ - lib/boc.rb
46
+ - lib/boc/binding_of_caller.rb
47
+ - lib/boc/version.rb
48
+ - test/basic_test.rb
49
+ - test/jruby_trial.rb
50
+ - test/main.rb
51
+ - test/readme_test.rb
52
+ - test/shim_test.rb
53
+ - lib/boc/boc.jar
54
+ has_rdoc: true
55
+ homepage: http://quix.github.com/boc
56
+ licenses: []
57
+
58
+ post_install_message:
59
+ rdoc_options:
60
+ - --main
61
+ - README.rdoc
62
+ - --title
63
+ - "boc: Binding of caller"
64
+ - --exclude
65
+ - lib/boc/binding_of_caller.rb
66
+ require_paths:
67
+ - lib
68
+ required_ruby_version: !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: 1.9.2
74
+ required_rubygems_version: !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: "0"
80
+ requirements: []
81
+
82
+ rubyforge_project:
83
+ rubygems_version: 1.6.2
84
+ signing_key:
85
+ specification_version: 3
86
+ summary: Binding of caller.
87
+ test_files: []
88
+