From b753eefeedb442fa2b18986632c9b5c1a1fae109 Mon Sep 17 00:00:00 2001 From: olabini Date: Sat, 16 Aug 2008 13:57:04 +0000 Subject: [PATCH] Specs for JRUBY-2929. These are commented out since they actually totally fail right now. git-svn-id: http://svn.codehaus.org/jruby/trunk/jruby@7478 961051c9-f516-0410-bf72-c9f7e237a7b7 --- spec/java_integration/types/array_spec.rb | 68 +++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/spec/java_integration/types/array_spec.rb b/spec/java_integration/types/array_spec.rb index da4a86bb5..467970c6e 100644 --- a/spec/java_integration/types/array_spec.rb +++ b/spec/java_integration/types/array_spec.rb @@ -666,4 +666,72 @@ describe "A Java primitive Array of type" do ret.to_a.should == [h1, h2, h3] end end + + describe "Class ref" do + it "should be possible to create empty array" do + arr = java.lang.Class[0].new + arr.java_class.to_s.should == "[Ljava.lang.Class;" + end + + it "should be possible to create uninitialized single dimensional array" do + arr = java.lang.Class[10].new + arr.java_class.to_s.should == "[Ljava.lang.Class;" + end + + it "should be possible to create uninitialized multi dimensional array" do + arr = java.lang.Class[10,10].new + arr.java_class.to_s.should == "[[Ljava.lang.Class;" + end + + it "should be possible to create primitive array from Ruby array" do +# h1 = java.lang.String.java_class +# h2 = java.util.HashMap.java_class + +# arr = [h1, h2].to_java java.lang.Class +# arr.java_class.to_s.should == "[Ljava.lang.Class;" + +# arr.length.should == 2 + +# arr[0].should == h1 +# arr[1].should == h2 + end + + it "should be possible to set values in primitive array" do +# h1 = java.util.Set.java_class +# h2 = java.util.HashMap.java_class +# h3 = java.lang.ref.SoftReference.java_class + +# arr = java.lang.Class[5].new +# arr[0] = h1 +# arr[1] = h2 +# arr[2] = h3 + +# arr[0].should == h1 +# arr[1].should == h2 +# arr[2].should == h3 +# arr[3].should be_nil +# arr[4].should be_nil + end + + it "should be possible to get values from primitive array" do +# h1 = java.util.Set.java_class +# h2 = java.util.HashMap.java_class +# h3 = java.lang.ref.SoftReference.java_class + +# arr = [h1, h2, h3].to_java java.lang.Class +# arr[0].should == h1 +# arr[1].should == h2 +# arr[2].should == h3 + end + + it "should be possible to call methods that take primitive array" do +# h1 = java.util.Set.java_class +# h2 = java.util.HashMap.java_class +# h3 = java.lang.ref.SoftReference.java_class + +# arr = [h1, h2, h3].to_java java.lang.Class +# ret = ArrayReceiver::call_with_object(arr) +# ret.to_a.should == [h1, h2, h3] + end + end end -- 2.11.4.GIT