mirror of
https://github.com/zhigang1992/RubyMotion.git
synced 2026-04-24 04:46:05 +08:00
add a spec for the new __annotation__ feature
This commit is contained in:
16
test/test-android/app/rubymotion/java_annotation_spec.rb
Normal file
16
test/test-android/app/rubymotion/java_annotation_spec.rb
Normal file
@@ -0,0 +1,16 @@
|
||||
class Java_Annotation_Test < Java::Lang::Object
|
||||
__annotation__('@android.webkit.JavascriptInterface')
|
||||
def foo
|
||||
42
|
||||
end
|
||||
end
|
||||
|
||||
describe "Java annotations" do
|
||||
it "can be attached to Ruby methods using the __annotation__() class method" do
|
||||
method = Java_Annotation_Test.getMethod('foo', [])
|
||||
method.should != nil
|
||||
annotations = method.getDeclaredAnnotations
|
||||
annotations.size.should == 1
|
||||
annotations[0].toString.should == '@android.webkit.JavascriptInterface()'
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user