summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuxuan 'fishy' Wang <yuxuan.wang@reddit.com>2021-02-18 09:09:20 -0800
committerYuxuan 'fishy' Wang <fishywang@gmail.com>2021-02-22 10:02:58 -0800
commitbb8fec7930a3a6789d0b9602412ee57a56ad551c (patch)
tree56d9c29b339113981dbcfdbd4d1340bbdf524ea0
parentabb8fa8c44caaa0e46038f7a0840e559cd3b51be (diff)
downloadthrift-bb8fec7930a3a6789d0b9602412ee57a56ad551c.tar.gz
Move ConflictingNamesTest to lib/go/test
Client: go Also add missing copyright header for files added in https://github.com/apache/thrift/pull/2307.
-rw-r--r--lib/go/test/ConflictArgNamesTest.thrift32
-rw-r--r--lib/go/test/EqualsTest.thrift21
-rw-r--r--lib/go/test/Makefile.am9
-rw-r--r--lib/go/test/tests/conflict_arg_names_test.go27
-rw-r--r--lib/go/test/tests/equals_test.go19
-rw-r--r--test/ThriftTest.thrift14
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 000000000..11323ecaf
--- /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 c699232b4..57ce131ec 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 2f748c6fa..4be652ed6 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 000000000..92791517e
--- /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 3489efa0d..deecb77ee 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 c88187c54..ac49aee01 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,
- )
-}