You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by yu...@apache.org on 2021/02/22 18:03:05 UTC

[thrift] branch master updated: Move ConflictingNamesTest to lib/go/test

This is an automated email from the ASF dual-hosted git repository.

yuxuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git


The following commit(s) were added to refs/heads/master by this push:
     new b0b3531  Move ConflictingNamesTest to lib/go/test
b0b3531 is described below

commit b0b353191aeaa1b427d105892efa7facea6d4f1f
Author: Yuxuan 'fishy' Wang <yu...@reddit.com>
AuthorDate: Thu Feb 18 09:09:20 2021 -0800

    Move ConflictingNamesTest to lib/go/test
    
    Client: go
    
    Also add missing copyright header for files added in
    https://github.com/apache/thrift/pull/2307.
---
 lib/go/test/ConflictArgNamesTest.thrift      | 32 ++++++++++++++++++++++++++++
 lib/go/test/EqualsTest.thrift                | 21 +++++++++++++++++-
 lib/go/test/Makefile.am                      |  9 ++++++--
 lib/go/test/tests/conflict_arg_names_test.go | 27 +++++++++++++++++++++++
 lib/go/test/tests/equals_test.go             | 19 +++++++++++++++++
 test/ThriftTest.thrift                       | 14 ------------
 6 files changed, 105 insertions(+), 17 deletions(-)

diff --git a/lib/go/test/ConflictArgNamesTest.thrift b/lib/go/test/ConflictArgNamesTest.thrift
new file mode 100644
index 0000000..11323ec
--- /dev/null
+++ b/lib/go/test/ConflictArgNamesTest.thrift
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+
+service ConflictArgNamesTest {
+  /**
+   * Use some names that could conflict with the compiler code as args
+   * to make sure that the compiler handled them correctly.
+   */
+  void testNameConflicts(
+    // 1: string args, // args is already a reserved keyword in thrift compiler
+    2: string result,
+    3: string meta,
+    4: string r,
+    5: string err,
+  )
+}
diff --git a/lib/go/test/EqualsTest.thrift b/lib/go/test/EqualsTest.thrift
index c699232..57ce131 100644
--- a/lib/go/test/EqualsTest.thrift
+++ b/lib/go/test/EqualsTest.thrift
@@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
 typedef i8 mybyte
 typedef string mystr
 typedef binary mybin
@@ -106,4 +125,4 @@ struct MapEqualsFoo {
     18: optional map<i64, mybyte> OptInt64MyByteMapFoo,
     19: map<mybyte, i64> MyByteInt64MapFoo,
     20: optional map<mybyte, i64> OptMyByteInt64MapFoo,
-}
\ No newline at end of file
+}
diff --git a/lib/go/test/Makefile.am b/lib/go/test/Makefile.am
index 2f748c6..4be652e 100644
--- a/lib/go/test/Makefile.am
+++ b/lib/go/test/Makefile.am
@@ -46,7 +46,9 @@ gopath: $(THRIFT) $(THRIFTTEST) \
 				ConflictNamespaceTestD.thrift \
 				ConflictNamespaceTestSuperThing.thrift \
 				ConflictNamespaceServiceTest.thrift \
-				DuplicateImportsTest.thrift
+				DuplicateImportsTest.thrift \
+				EqualsTest.thrift \
+				ConflictArgNamesTest.thrift
 	mkdir -p gopath/src
 	grep -v list.*map.*list.*map $(THRIFTTEST) | grep -v 'set<Insanity>' > ThriftTest.thrift
 	$(THRIFT) $(THRIFTARGS) -r IncludesTest.thrift
@@ -74,6 +76,7 @@ gopath: $(THRIFT) $(THRIFTTEST) \
 	$(THRIFT) $(THRIFTARGS) ConflictNamespaceServiceTest.thrift
 	$(THRIFT) $(THRIFTARGS) -r DuplicateImportsTest.thrift
 	$(THRIFT) $(THRIFTARGS) EqualsTest.thrift
+	$(THRIFT) $(THRIFTARGS) ConflictArgNamesTest.thrift
 	GOPATH=`pwd`/gopath $(GO) get github.com/golang/mock/gomock || true
 	sed -i 's/\"context\"/\"golang.org\/x\/net\/context\"/g' gopath/src/github.com/golang/mock/gomock/controller.go || true
 	GOPATH=`pwd`/gopath $(GO) get github.com/golang/mock/gomock
@@ -99,7 +102,8 @@ check: gopath
 				conflict/context/conflict_service-remote \
 				servicestest/container_test-remote \
 				duplicateimportstest \
-				equalstest
+				equalstest \
+				conflictargnamestest
 	GOPATH=`pwd`/gopath $(GO) test thrift tests dontexportrwtest
 
 clean-local:
@@ -113,6 +117,7 @@ EXTRA_DIST = \
 	tests \
 	common \
 	BinaryKeyTest.thrift \
+	ConflictArgNamesTest.thrift \
 	ConflictNamespaceServiceTest.thrift \
 	ConflictNamespaceTestA.thrift \
 	ConflictNamespaceTestB.thrift \
diff --git a/lib/go/test/tests/conflict_arg_names_test.go b/lib/go/test/tests/conflict_arg_names_test.go
new file mode 100644
index 0000000..9279151
--- /dev/null
+++ b/lib/go/test/tests/conflict_arg_names_test.go
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+package tests
+
+import (
+	"conflictargnamestest"
+)
+
+// We just want to make sure that the conflictargnamestest package compiles.
+var _ = conflictargnamestest.GoUnusedProtection__
diff --git a/lib/go/test/tests/equals_test.go b/lib/go/test/tests/equals_test.go
index 3489efa..deecb77 100644
--- a/lib/go/test/tests/equals_test.go
+++ b/lib/go/test/tests/equals_test.go
@@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
 package tests
 
 import (
diff --git a/test/ThriftTest.thrift b/test/ThriftTest.thrift
index c88187c..ac49aee 100644
--- a/test/ThriftTest.thrift
+++ b/test/ThriftTest.thrift
@@ -411,17 +411,3 @@ struct StructB {
 struct OptionalSetDefaultTest {
   1: optional set<string> with_default = [ "test" ]
 }
-
-service ConflictingNamesTest {
-  /**
-   * Use some names that could conflict with the compiler code as args
-   * to make sure that the compiler handled them correctly.
-   */
-  void testNameConflicts(
-    // 1: string args,   // args is already a reserved keyword in thrift compiler
-    // 2: string result, // result will cause problems in compiled netstd code
-    3: string meta,
-    4: string r,
-    5: string err,
-  )
-}