chaokunyang commented on code in PR #3394:
URL: https://github.com/apache/fory/pull/3394#discussion_r2890569018


##########
integration_tests/idl_tests/javascript/roundtrip.ts:
##########
@@ -0,0 +1,450 @@
+/*
+ * 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.
+ */
+
+/**
+ * Cross-language roundtrip program for TypeScript IDL tests.
+ *
+ * This script is invoked by the Java IdlRoundTripTest as a peer process.
+ * It reads binary data files (written by Java), deserializes them,
+ * re-serializes the objects, and writes the bytes back to the same files.
+ * Java then reads the files back and verifies the roundtrip integrity.
+ *
+ * Environment variables:
+ *   IDL_COMPATIBLE  - "true" for compatible mode, "false" for 
schema_consistent
+ *   DATA_FILE       - AddressBook binary data file path
+ *   DATA_FILE_AUTO_ID - Envelope (auto-id) binary data file path
+ *   DATA_FILE_PRIMITIVES - PrimitiveTypes binary data file path
+ *   DATA_FILE_COLLECTION - NumericCollections binary data file path
+ *   DATA_FILE_COLLECTION_UNION - NumericCollectionUnion binary data file path
+ *   DATA_FILE_COLLECTION_ARRAY - NumericCollectionsArray binary data file path
+ *   DATA_FILE_COLLECTION_ARRAY_UNION - NumericCollectionArrayUnion binary 
data file path
+ *   DATA_FILE_OPTIONAL_TYPES - OptionalHolder binary data file path
+ *   DATA_FILE_TREE - TreeNode binary data file path (ref tracking)
+ *   DATA_FILE_GRAPH - Graph binary data file path (ref tracking)
+ *   DATA_FILE_FLATBUFFERS_MONSTER - Monster binary data file path
+ *   DATA_FILE_FLATBUFFERS_TEST2 - Container binary data file path
+ */
+
+import * as fs from "fs";
+import Fory, { Type } from "@fory/fory";
+
+const compatible = process.env["IDL_COMPATIBLE"] === "true";
+
+// The Fory JS runtime does not support compatible mode (class metadata /
+// versioning is incomplete).  Skip all roundtrips when compatible = true so
+// Java reads back its own original bytes unchanged.
+if (compatible) {
+  console.log(
+    "TypeScript roundtrip: compatible mode not supported, skipping roundtrips."
+  );
+  process.exit(0);
+}
+
+// ---------------------------------------------------------------------------
+// Type definitions matching the IDL-generated types
+// ---------------------------------------------------------------------------
+
+// --- addressbook types ---
+const DogType = Type.struct(104, {

Review Comment:
   This is totally wrong, you are not testing the generated code from IDL. You 
are just define the types manually, so the whole 
integration_tests/idl_tests/javascript/roundtrip.ts doesn't cover any features 
in fory javascript IDL.
   
   Have you read other how IDL tests of other language works?
   
   I do not understand why you don't test on generated code but  use manually 
defined struct instead?



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to