kou commented on code in PR #55464:
URL: https://github.com/apache/arrow/pull/55464#discussion_r4657028314


##########
c_glib/test/test-file-system.cpp:
##########


Review Comment:
   We don't need a test written by C or C++. We use only Ruby for test.



##########
c_glib/test/test-file-system.rb:
##########
@@ -0,0 +1,65 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+class TestFileSystem < Test::Unit::TestCase
+  class RegisteredFileSystem < Arrow::FileSystem
+    type_register
+  end
+
+  class DuplicateFileSystem < Arrow::FileSystem
+    type_register
+  end
+
+  sub_test_case("register_type") do

Review Comment:
   Could you use `.XXX` to indicate that `register_type` is a class method?
   
   ```suggestion
     sub_test_case(".register_type") do
   ```



##########
c_glib/arrow-glib/file-system.cpp:
##########
@@ -554,7 +592,7 @@ enum {
   PROP_FILE_SYSTEM = 1
 };
 
-G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GArrowFileSystem, garrow_file_system, 
G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE(GArrowFileSystem, garrow_file_system, G_TYPE_OBJECT)

Review Comment:
   Why do we need this change?



##########
c_glib/test/test-file-system.rb:
##########
@@ -0,0 +1,65 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+class TestFileSystem < Test::Unit::TestCase
+  class RegisteredFileSystem < Arrow::FileSystem
+    type_register
+  end
+
+  class DuplicateFileSystem < Arrow::FileSystem
+    type_register
+  end
+
+  sub_test_case("register_type") do
+    def test_valid
+      assert_true(Arrow::FileSystem.register_type("test-file-system-valid",
+                                                  RegisteredFileSystem.gtype))
+    end
+
+    def test_duplicate
+      type_name = "test-file-system-duplicate"
+      Arrow::FileSystem.register_type(type_name, DuplicateFileSystem.gtype)
+      assert_raise(Arrow::Error::Key) do
+        Arrow::FileSystem.register_type(type_name, 
Arrow::LocalFileSystem.gtype)
+      end
+    end
+
+    def test_type_alias
+      assert_raise(Arrow::Error::Key) do
+        Arrow::FileSystem.register_type("test-file-system-alias",
+                                        Arrow::MockFileSystem.gtype)
+      end
+    end
+
+    def test_empty_name
+      assert_raise(Arrow::Error::Invalid) do
+        Arrow::FileSystem.register_type("", Arrow::MockFileSystem.gtype)
+      end
+    end
+
+    def test_unrelated_type
+      assert_raise(Arrow::Error::Invalid) do
+        Arrow::FileSystem.register_type("test-file-system-unrelated",
+                                        Arrow::Int32Array.gtype)
+      end
+    end
+  end
+
+  def test_create_mock
+    assert_instance_of(Arrow::MockFileSystem, 
Arrow::FileSystem.create("mock:///"))
+  end

Review Comment:
   We don't need this test because The mock filesystem support is covered by 
`test-mock-file-system.rb`. In general, we don't need `assert_instance_of`. We 
should check behavior not class.
   
   
   ```suggestion
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to